|
@@ -88,27 +88,34 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
|
|
|
|
|
return self._add2DAdhesionMargin(hull)
|
|
|
|
|
|
- ## Get the unmodified 2D projected convex hull with 2D adhesion area of the node (if any)
|
|
|
+ ## Get the unmodified 2D projected convex hull of the node (if any)
|
|
|
+ # In case of one-at-a-time, this includes adhesion and head+fans clearance
|
|
|
def getConvexHull(self) -> Optional[Polygon]:
|
|
|
if self._node is None:
|
|
|
return None
|
|
|
if self._node.callDecoration("isNonPrintingMesh"):
|
|
|
return None
|
|
|
- hull = self._compute2DConvexHull()
|
|
|
|
|
|
- if self._global_stack and self._node is not None and hull is not None:
|
|
|
- # Parent can be None if node is just loaded.
|
|
|
- if self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" and not self.hasGroupAsParent(self._node):
|
|
|
- hull = hull.getMinkowskiHull(Polygon(numpy.array(self._global_stack.getProperty("machine_head_polygon", "value"), numpy.float32)))
|
|
|
- hull = self._add2DAdhesionMargin(hull)
|
|
|
- return hull
|
|
|
+ # Parent can be None if node is just loaded.
|
|
|
+ if self._isSingularOneAtATimeNode():
|
|
|
+ hull = self.getConvexHullHeadFull()
|
|
|
+ if hull is None:
|
|
|
+ return None
|
|
|
+ hull = self._add2DAdhesionMargin(hull)
|
|
|
+ return hull
|
|
|
+
|
|
|
+ return self._compute2DConvexHull()
|
|
|
|
|
|
- ## Get the convex hull of the node with the full head size
|
|
|
+ ## For one at the time this is the convex hull of the node with the full head size
|
|
|
+ # In case of printing all at once this is None.
|
|
|
def getConvexHullHeadFull(self) -> Optional[Polygon]:
|
|
|
if self._node is None:
|
|
|
return None
|
|
|
|
|
|
- return self._compute2DConvexHeadFull()
|
|
|
+ if self._isSingularOneAtATimeNode():
|
|
|
+ return self._compute2DConvexHeadFull()
|
|
|
+
|
|
|
+ return None
|
|
|
|
|
|
@staticmethod
|
|
|
def hasGroupAsParent(node: "SceneNode") -> bool:
|
|
@@ -118,38 +125,47 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
|
|
return bool(parent.callDecoration("isGroup"))
|
|
|
|
|
|
## Get convex hull of the object + head size
|
|
|
- # In case of printing all at once this is the same as the convex hull.
|
|
|
+ # In case of printing all at once this is None.
|
|
|
# For one at the time this is area with intersection of mirrored head
|
|
|
def getConvexHullHead(self) -> Optional[Polygon]:
|
|
|
if self._node is None:
|
|
|
return None
|
|
|
if self._node.callDecoration("isNonPrintingMesh"):
|
|
|
return None
|
|
|
- if self._global_stack:
|
|
|
- if self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" and not self.hasGroupAsParent(self._node):
|
|
|
- head_with_fans = self._compute2DConvexHeadMin()
|
|
|
- if head_with_fans is None:
|
|
|
- return None
|
|
|
- head_with_fans_with_adhesion_margin = self._add2DAdhesionMargin(head_with_fans)
|
|
|
- return head_with_fans_with_adhesion_margin
|
|
|
+ if self._isSingularOneAtATimeNode():
|
|
|
+ head_with_fans = self._compute2DConvexHeadMin()
|
|
|
+ if head_with_fans is None:
|
|
|
+ return None
|
|
|
+ head_with_fans_with_adhesion_margin = self._add2DAdhesionMargin(head_with_fans)
|
|
|
+ return head_with_fans_with_adhesion_margin
|
|
|
return None
|
|
|
|
|
|
## 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.
|
|
|
def getConvexHullBoundary(self) -> Optional[Polygon]:
|
|
|
if self._node is None:
|
|
|
return None
|
|
|
-
|
|
|
+
|
|
|
if self._node.callDecoration("isNonPrintingMesh"):
|
|
|
return None
|
|
|
|
|
|
- if self._global_stack:
|
|
|
- if self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" and not self.hasGroupAsParent(self._node):
|
|
|
- # Printing one at a time and it's not an object in a group
|
|
|
- return self._compute2DConvexHull()
|
|
|
+ if self._isSingularOneAtATimeNode():
|
|
|
+ # Printing one at a time and it's not an object in a group
|
|
|
+ return self._compute2DConvexHull()
|
|
|
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._isSingularOneAtATimeNode():
|
|
|
+ # 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.
|
|
|
def recomputeConvexHullDelayed(self) -> None:
|
|
|
if self._recompute_convex_hull_timer is not None:
|
|
@@ -172,10 +188,9 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
|
|
self._convex_hull_node = None
|
|
|
return
|
|
|
|
|
|
- convex_hull = self.getConvexHull()
|
|
|
if self._convex_hull_node:
|
|
|
self._convex_hull_node.setParent(None)
|
|
|
- hull_node = ConvexHullNode.ConvexHullNode(self._node, convex_hull, self._raft_thickness, root)
|
|
|
+ hull_node = ConvexHullNode.ConvexHullNode(self._node, self.getPrintingArea(), self._raft_thickness, root)
|
|
|
self._convex_hull_node = hull_node
|
|
|
|
|
|
def _onSettingValueChanged(self, key: str, property_name: str) -> None:
|
|
@@ -416,6 +431,14 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
|
|
return True
|
|
|
return self.__isDescendant(root, node.getParent())
|
|
|
|
|
|
+ ## True if print_sequence is one_at_a_time and _node is not part of a group
|
|
|
+ def _isSingularOneAtATimeNode(self) -> bool:
|
|
|
+ if self._node is None:
|
|
|
+ return False
|
|
|
+ return self._global_stack is not None \
|
|
|
+ and self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" \
|
|
|
+ and not self.hasGroupAsParent(self._node)
|
|
|
+
|
|
|
_affected_settings = [
|
|
|
"adhesion_type", "raft_margin", "print_sequence",
|
|
|
"skirt_gap", "skirt_line_count", "skirt_brim_line_width", "skirt_distance", "brim_line_count"]
|