Browse Source

Add machine_disallowed_areas and turn off nozzle offsetting for disallowed areas calculation

CURA-3663

We don't need to calculate the disallowed areas for certain machines
because they have taken into account the nozzle offsets. This commit
does the following:
- Add machine_disallowed_areas
- Add a flag in definition so that disallowed areas calculation with
  nozzle offsets becomes optional in Cura.

Update documentation for no offsetting for nozzles

Contributes to issue CURA-3663.
Lipu Fei 7 years ago
parent
commit
b958e30fe6
1 changed files with 16 additions and 8 deletions
  1. 16 8
      cura/BuildVolume.py

+ 16 - 8
cura/BuildVolume.py

@@ -716,6 +716,11 @@ class BuildVolume(SceneNode):
             polygon = polygon.getMinkowskiHull(Polygon.approximatedCircle(border_size))
             machine_disallowed_polygons.append(polygon)
 
+        # For certain machines we don't need to compute disallowed areas for each nozzle.
+        # So we check here and only do the nozzle offsetting if needed.
+        no_nozzle_offsetting_for_disallowed_areas = self._global_container_stack.getMetaDataEntry(
+            "no_nozzle_offsetting_for_disallowed_areas", False)
+
         result = {}
         for extruder in used_extruders:
             extruder_id = extruder.getId()
@@ -735,14 +740,17 @@ class BuildVolume(SceneNode):
             right_unreachable_border = 0
             top_unreachable_border = 0
             bottom_unreachable_border = 0
-            #The build volume is defined as the union of the area that all extruders can reach, so we need to know the relative offset to all extruders.
-            for other_extruder in ExtruderManager.getInstance().getActiveExtruderStacks():
-                other_offset_x = other_extruder.getProperty("machine_nozzle_offset_x", "value")
-                other_offset_y = other_extruder.getProperty("machine_nozzle_offset_y", "value")
-                left_unreachable_border = min(left_unreachable_border, other_offset_x - offset_x)
-                right_unreachable_border = max(right_unreachable_border, other_offset_x - offset_x)
-                top_unreachable_border = min(top_unreachable_border, other_offset_y - offset_y)
-                bottom_unreachable_border = max(bottom_unreachable_border, other_offset_y - offset_y)
+
+            # Only do nozzle offsetting if needed
+            if not no_nozzle_offsetting_for_disallowed_areas:
+                #The build volume is defined as the union of the area that all extruders can reach, so we need to know the relative offset to all extruders.
+                for other_extruder in ExtruderManager.getInstance().getActiveExtruderStacks():
+                    other_offset_x = other_extruder.getProperty("machine_nozzle_offset_x", "value")
+                    other_offset_y = other_extruder.getProperty("machine_nozzle_offset_y", "value")
+                    left_unreachable_border = min(left_unreachable_border, other_offset_x - offset_x)
+                    right_unreachable_border = max(right_unreachable_border, other_offset_x - offset_x)
+                    top_unreachable_border = min(top_unreachable_border, other_offset_y - offset_y)
+                    bottom_unreachable_border = max(bottom_unreachable_border, other_offset_y - offset_y)
             half_machine_width = self._global_container_stack.getProperty("machine_width", "value") / 2
             half_machine_depth = self._global_container_stack.getProperty("machine_depth", "value") / 2