|
@@ -88,27 +88,34 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
|
|
|
|
|
return self._add2DAdhesionMargin(hull)
|
|
return self._add2DAdhesionMargin(hull)
|
|
|
|
|
|
-
|
|
+
|
|
|
|
+
|
|
def getConvexHull(self) -> Optional[Polygon]:
|
|
def getConvexHull(self) -> Optional[Polygon]:
|
|
if self._node is None:
|
|
if self._node is None:
|
|
return None
|
|
return None
|
|
if self._node.callDecoration("isNonPrintingMesh"):
|
|
if self._node.callDecoration("isNonPrintingMesh"):
|
|
return None
|
|
return None
|
|
- hull = self._compute2DConvexHull()
|
|
|
|
|
|
|
|
- if self._global_stack and self._node is not None and hull is not None:
|
|
+
|
|
-
|
|
+ if self._isSingularOneAtATimeNode():
|
|
- if self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" and not self.hasGroupAsParent(self._node):
|
|
+ hull = self.getConvexHullHeadFull()
|
|
- hull = hull.getMinkowskiHull(Polygon(numpy.array(self._global_stack.getProperty("machine_head_polygon", "value"), numpy.float32)))
|
|
+ if hull is None:
|
|
- hull = self._add2DAdhesionMargin(hull)
|
|
+ return None
|
|
- return hull
|
|
+ hull = self._add2DAdhesionMargin(hull)
|
|
|
|
+ return hull
|
|
|
|
+
|
|
|
|
+ return self._compute2DConvexHull()
|
|
|
|
|
|
-
|
|
+
|
|
|
|
+
|
|
def getConvexHullHeadFull(self) -> Optional[Polygon]:
|
|
def getConvexHullHeadFull(self) -> Optional[Polygon]:
|
|
if self._node is None:
|
|
if self._node is None:
|
|
return None
|
|
return None
|
|
|
|
|
|
- return self._compute2DConvexHeadFull()
|
|
+ if self._isSingularOneAtATimeNode():
|
|
|
|
+ return self._compute2DConvexHeadFull()
|
|
|
|
+
|
|
|
|
+ return None
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
def hasGroupAsParent(node: "SceneNode") -> bool:
|
|
def hasGroupAsParent(node: "SceneNode") -> bool:
|
|
@@ -118,38 +125,47 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
|
return bool(parent.callDecoration("isGroup"))
|
|
return bool(parent.callDecoration("isGroup"))
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
|
|
|
|
def getConvexHullHead(self) -> Optional[Polygon]:
|
|
def getConvexHullHead(self) -> Optional[Polygon]:
|
|
if self._node is None:
|
|
if self._node is None:
|
|
return None
|
|
return None
|
|
if self._node.callDecoration("isNonPrintingMesh"):
|
|
if self._node.callDecoration("isNonPrintingMesh"):
|
|
return None
|
|
return None
|
|
- if self._global_stack:
|
|
+ if self._isSingularOneAtATimeNode():
|
|
- if self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" and not self.hasGroupAsParent(self._node):
|
|
+ head_with_fans = self._compute2DConvexHeadMin()
|
|
- head_with_fans = self._compute2DConvexHeadMin()
|
|
+ if head_with_fans is None:
|
|
- if head_with_fans is None:
|
|
+ return None
|
|
- return None
|
|
+ head_with_fans_with_adhesion_margin = self._add2DAdhesionMargin(head_with_fans)
|
|
- head_with_fans_with_adhesion_margin = self._add2DAdhesionMargin(head_with_fans)
|
|
+ return head_with_fans_with_adhesion_margin
|
|
- return head_with_fans_with_adhesion_margin
|
|
|
|
return None
|
|
return None
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
|
|
|
|
def getConvexHullBoundary(self) -> Optional[Polygon]:
|
|
def getConvexHullBoundary(self) -> Optional[Polygon]:
|
|
if self._node is None:
|
|
if self._node is None:
|
|
return None
|
|
return None
|
|
-
|
|
+
|
|
if self._node.callDecoration("isNonPrintingMesh"):
|
|
if self._node.callDecoration("isNonPrintingMesh"):
|
|
return None
|
|
return None
|
|
|
|
|
|
- if self._global_stack:
|
|
+ if self._isSingularOneAtATimeNode():
|
|
- if self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" and not self.hasGroupAsParent(self._node):
|
|
+
|
|
-
|
|
+ return self._compute2DConvexHull()
|
|
- return self._compute2DConvexHull()
|
|
|
|
return None
|
|
return None
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ def getPrintingArea(self) -> Optional[Polygon]:
|
|
|
|
+ if self._isSingularOneAtATimeNode():
|
|
|
|
+
|
|
|
|
+ printing_area = self.getAdhesionArea()
|
|
|
|
+ else:
|
|
|
|
+ printing_area = self.getConvexHull()
|
|
|
|
+ return printing_area
|
|
|
|
+
|
|
|
|
|
|
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:
|
|
@@ -172,10 +188,9 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
|
self._convex_hull_node = None
|
|
self._convex_hull_node = None
|
|
return
|
|
return
|
|
|
|
|
|
- convex_hull = 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, convex_hull, 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:
|
|
@@ -416,6 +431,14 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
|
return True
|
|
return True
|
|
return self.__isDescendant(root, node.getParent())
|
|
return self.__isDescendant(root, node.getParent())
|
|
|
|
|
|
|
|
+
|
|
|
|
+ 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 = [
|
|
_affected_settings = [
|
|
"adhesion_type", "raft_margin", "print_sequence",
|
|
"adhesion_type", "raft_margin", "print_sequence",
|
|
"skirt_gap", "skirt_line_count", "skirt_brim_line_width", "skirt_distance", "brim_line_count"]
|
|
"skirt_gap", "skirt_line_count", "skirt_brim_line_width", "skirt_distance", "brim_line_count"]
|