Browse Source

One at a time mode now adds platform adhesion to convex hulls

CURA-403
Jaime van Kessel 8 years ago
parent
commit
3f5d7b0f53
2 changed files with 11 additions and 7 deletions
  1. 5 1
      cura/BuildVolume.py
  2. 6 6
      cura/ConvexHullDecorator.py

+ 5 - 1
cura/BuildVolume.py

@@ -280,7 +280,7 @@ class BuildVolume(SceneNode):
                 self._height = self._global_container_stack.getProperty("machine_height", "value")
             rebuild_me = True
 
-        if setting_key in self._skirt_settings or setting_key in self._prime_settings or setting_key in self._tower_settings:
+        if setting_key in self._skirt_settings or setting_key in self._prime_settings or setting_key in self._tower_settings or setting_key == "print_sequence":
             self._updateDisallowedAreas()
             rebuild_me = True
 
@@ -383,6 +383,10 @@ class BuildVolume(SceneNode):
     def _getBedAdhesionSize(self, container_stack):
         skirt_size = 0.0
 
+        # If we are printing one at a time, we need to add the bed adhesion size to the disallowed areas of the objects
+        if container_stack.getProperty("print_sequence", "value") == "one_at_a_time":
+            return 0.1  # Return a very small value, so we do draw disallowed area's near the edges.
+
         adhesion_type = container_stack.getProperty("adhesion_type", "value")
         if adhesion_type == "skirt":
             skirt_distance = container_stack.getProperty("skirt_gap", "value")

+ 6 - 6
cura/ConvexHullDecorator.py

@@ -56,6 +56,7 @@ class ConvexHullDecorator(SceneNodeDecorator):
         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"):
                 hull = hull.getMinkowskiHull(Polygon(numpy.array(self._global_stack.getProperty("machine_head_polygon", "value"), numpy.float32)))
+                hull = self._add2DAdhesionMargin(hull)
         return hull
 
     ##  Get the convex hull of the node with the full head size
@@ -229,17 +230,16 @@ class ConvexHullDecorator(SceneNodeDecorator):
         machine_head_coords = numpy.array(
             self._global_stack.getProperty("machine_head_with_fans_polygon", "value"),
             numpy.float32)
-        head_y_size = abs(machine_head_coords).min()  # safe margin to take off in all directions
 
         if adhesion_type == "raft":
-            extra_margin = max(0, self._global_stack.getProperty("raft_margin", "value") - head_y_size)
+            extra_margin = max(0, self._global_stack.getProperty("raft_margin", "value"))
         elif adhesion_type == "brim":
-            extra_margin = max(0, self._global_stack.getProperty("brim_width", "value") - head_y_size)
+            extra_margin = max(0, self._global_stack.getProperty("brim_line_count", "value") * self._global_stack.getProperty("skirt_brim_line_width", "value"))
         elif adhesion_type == "skirt":
             extra_margin = max(
                 0, self._global_stack.getProperty("skirt_gap", "value") +
-                   self._global_stack.getProperty("skirt_line_count", "value") * self._global_stack.getProperty("skirt_brim_line_width", "value") -
-                   head_y_size)
+                   self._global_stack.getProperty("skirt_line_count", "value") * self._global_stack.getProperty("skirt_brim_line_width", "value"))
+
         # adjust head_and_fans with extra margin
         if extra_margin > 0:
             # In Cura 2.2+, there is a function to create this circle-like polygon.
@@ -288,4 +288,4 @@ class ConvexHullDecorator(SceneNodeDecorator):
     _affected_settings = [
         "adhesion_type", "raft_base_thickness", "raft_interface_thickness", "raft_surface_layers",
         "raft_surface_thickness", "raft_airgap", "raft_margin", "print_sequence",
-        "skirt_gap", "skirt_line_count", "skirt_brim_line_width", "skirt_distance"]
+        "skirt_gap", "skirt_line_count", "skirt_brim_line_width", "skirt_distance", "brim_line_count"]