mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06:00
Use the printing area (hull + adhesion for one-at-a-time) instead of
convex hull for build volume collision detection. The convex hull is not suitable for this purpose because for one-at-a-time it includes the machine head polygon, which should be allowed to travel outside the build volume CURA-6522
This commit is contained in:
parent
fc060f7724
commit
2d8a415a69
2 changed files with 15 additions and 10 deletions
|
@ -89,7 +89,7 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
||||||
return self._add2DAdhesionMargin(hull)
|
return self._add2DAdhesionMargin(hull)
|
||||||
|
|
||||||
## Get the unmodified 2D projected convex hull of the node (if any)
|
## Get the unmodified 2D projected convex hull of the node (if any)
|
||||||
# In case of all-at-once, this includes adhesion and head+fans clearance
|
# In case of one-at-a-time, this includes adhesion and head+fans clearance
|
||||||
def getConvexHull(self) -> Optional[Polygon]:
|
def getConvexHull(self) -> Optional[Polygon]:
|
||||||
if self._node is None:
|
if self._node is None:
|
||||||
return None
|
return None
|
||||||
|
@ -139,7 +139,7 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
## Get convex hull of the node
|
## Get convex hull of the node
|
||||||
# In case of printing all at once this is the same as the convex hull.
|
# In case of printing all at once this None??
|
||||||
# For one at the time this is the area without the head.
|
# For one at the time this is the area without the head.
|
||||||
def getConvexHullBoundary(self) -> Optional[Polygon]:
|
def getConvexHullBoundary(self) -> Optional[Polygon]:
|
||||||
if self._node is None:
|
if self._node is None:
|
||||||
|
@ -153,6 +153,17 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
||||||
return self._compute2DConvexHull()
|
return self._compute2DConvexHull()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
## Get the buildplate polygon where will be printed
|
||||||
|
# In case of printing all at once this is the same as convex hull (no individual adhesion)
|
||||||
|
# For one at the time this includes the adhesion area
|
||||||
|
def getPrintingArea(self) -> Optional[Polygon]:
|
||||||
|
if self._is_singular_one_at_a_time_node():
|
||||||
|
# In one-at-a-time mode, every printed object gets it's own adhesion
|
||||||
|
printing_area = self.getAdhesionArea()
|
||||||
|
else:
|
||||||
|
printing_area = self.getConvexHull()
|
||||||
|
return printing_area
|
||||||
|
|
||||||
## The same as recomputeConvexHull, but using a timer if it was set.
|
## The same as recomputeConvexHull, but using a timer if it was set.
|
||||||
def recomputeConvexHullDelayed(self) -> None:
|
def recomputeConvexHullDelayed(self) -> None:
|
||||||
if self._recompute_convex_hull_timer is not None:
|
if self._recompute_convex_hull_timer is not None:
|
||||||
|
@ -175,15 +186,9 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
||||||
self._convex_hull_node = None
|
self._convex_hull_node = None
|
||||||
return
|
return
|
||||||
|
|
||||||
if self._is_singular_one_at_a_time_node():
|
|
||||||
# In one-at-a-time mode, every printed object gets it's own adhesion
|
|
||||||
printing_area = self.getAdhesionArea()
|
|
||||||
else:
|
|
||||||
printing_area = self.getConvexHull()
|
|
||||||
|
|
||||||
if self._convex_hull_node:
|
if self._convex_hull_node:
|
||||||
self._convex_hull_node.setParent(None)
|
self._convex_hull_node.setParent(None)
|
||||||
hull_node = ConvexHullNode.ConvexHullNode(self._node, printing_area, self._raft_thickness, root)
|
hull_node = ConvexHullNode.ConvexHullNode(self._node, self.getPrintingArea(), self._raft_thickness, root)
|
||||||
self._convex_hull_node = hull_node
|
self._convex_hull_node = hull_node
|
||||||
|
|
||||||
def _onSettingValueChanged(self, key: str, property_name: str) -> None:
|
def _onSettingValueChanged(self, key: str, property_name: str) -> None:
|
||||||
|
|
|
@ -88,7 +88,7 @@ class CuraSceneNode(SceneNode):
|
||||||
|
|
||||||
## Return if any area collides with the convex hull of this scene node
|
## Return if any area collides with the convex hull of this scene node
|
||||||
def collidesWithAreas(self, areas: List[Polygon]) -> bool:
|
def collidesWithAreas(self, areas: List[Polygon]) -> bool:
|
||||||
convex_hull = self.callDecoration("getConvexHull")
|
convex_hull = self.callDecoration("getPrintingArea")
|
||||||
if convex_hull:
|
if convex_hull:
|
||||||
if not convex_hull.isValid():
|
if not convex_hull.isValid():
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue