diff --git a/cura/ConvexHullDecorator.py b/cura/ConvexHullDecorator.py old mode 100644 new mode 100755 index da72ffdbe3..404342fb78 --- a/cura/ConvexHullDecorator.py +++ b/cura/ConvexHullDecorator.py @@ -59,7 +59,8 @@ class ConvexHullDecorator(SceneNodeDecorator): hull = self._compute2DConvexHull() if self._global_stack and self._node: - if self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" and not self._node.getParent().callDecoration("isGroup"): + # Parent can be None if node is just loaded. + if self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" and (self._node.getParent() is None or not self._node.getParent().callDecoration("isGroup")): hull = hull.getMinkowskiHull(Polygon(numpy.array(self._global_stack.getProperty("machine_head_polygon", "value"), numpy.float32))) hull = self._add2DAdhesionMargin(hull) return hull @@ -79,7 +80,7 @@ class ConvexHullDecorator(SceneNodeDecorator): return None if self._global_stack: - if self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" and not self._node.getParent().callDecoration("isGroup"): + if self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" and (self._node.getParent() is None or not self._node.getParent().callDecoration("isGroup")): head_with_fans = self._compute2DConvexHeadMin() head_with_fans_with_adhesion_margin = self._add2DAdhesionMargin(head_with_fans) return head_with_fans_with_adhesion_margin @@ -93,8 +94,7 @@ class ConvexHullDecorator(SceneNodeDecorator): return None if self._global_stack: - if self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" and not self._node.getParent().callDecoration("isGroup"): - + if self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" and (self._node.getParent() is None or not self._node.getParent().callDecoration("isGroup")): # Printing one at a time and it's not an object in a group return self._compute2DConvexHull() return None @@ -335,4 +335,4 @@ class ConvexHullDecorator(SceneNodeDecorator): ## Settings that change the convex hull. # # If these settings change, the convex hull should be recalculated. - _influencing_settings = {"xy_offset", "mold_enabled", "mold_width"} \ No newline at end of file + _influencing_settings = {"xy_offset", "mold_enabled", "mold_width"} diff --git a/cura/ShapeArray.py b/cura/ShapeArray.py index 534fa78e4d..95d0201c38 100755 --- a/cura/ShapeArray.py +++ b/cura/ShapeArray.py @@ -43,8 +43,10 @@ class ShapeArray: transform_x = transform._data[0][3] transform_y = transform._data[2][3] hull_verts = node.callDecoration("getConvexHull") + # For one_at_a_time printing you need the convex hull head. + hull_head_verts = node.callDecoration("getConvexHullHead") or hull_verts - offset_verts = hull_verts.getMinkowskiHull(Polygon.approximatedCircle(min_offset)) + offset_verts = hull_head_verts.getMinkowskiHull(Polygon.approximatedCircle(min_offset)) offset_points = copy.deepcopy(offset_verts._points) # x, y offset_points[:, 0] = numpy.add(offset_points[:, 0], -transform_x) offset_points[:, 1] = numpy.add(offset_points[:, 1], -transform_y)