Check all limit_to_extruder features in getUsedExtruderStacks()

CURA-4069

getUsedExtruderStacks() doesn't take into account some new limit to
extruder features, The BuildVolume uses it to determine disallowed
areas, and this makes it give incorrect results.
This commit is contained in:
Lipu Fei 2017-07-21 13:26:46 +02:00
parent 75af56b1a1
commit 9a92b58ac3

View File

@ -426,6 +426,7 @@ class ExtruderManager(QObject):
support_enabled = False
support_bottom_enabled = False
support_roof_enabled = False
support_interface_enable = False
scene_root = Application.getInstance().getController().getScene().getRoot()
meshes = [node for node in DepthFirstIterator(scene_root) if type(node) is SceneNode and node.isSelectable()] #Only use the nodes that will be printed.
for mesh in meshes:
@ -434,19 +435,40 @@ class ExtruderManager(QObject):
extruder_stack_id = self.extruderIds["0"]
used_extruder_stack_ids.add(extruder_stack_id)
#Get whether any of them use support.
per_mesh_stack = mesh.callDecoration("getStack")
if per_mesh_stack:
support_enabled |= per_mesh_stack.getProperty("support_enable", "value")
support_bottom_enabled |= per_mesh_stack.getProperty("support_bottom_enable", "value")
support_roof_enabled |= per_mesh_stack.getProperty("support_roof_enable", "value")
else: #Take the setting from the build extruder stack.
extruder_stack = container_registry.findContainerStacks(id = extruder_stack_id)[0]
support_enabled |= extruder_stack.getProperty("support_enable", "value")
support_bottom_enabled |= extruder_stack.getProperty("support_bottom_enable", "value")
support_roof_enabled |= extruder_stack.getProperty("support_roof_enable", "value")
# Get whether any of them use support.
stack_to_use = mesh.callDecoration("getStack") # if there is a per-mesh stack, we use it
if not stack_to_use:
# if there is no per-mesh stack, we use the build extruder for this mesh
stack_to_use = container_registry.findContainerStacks(id = extruder_stack_id)[0]
#The support extruders.
support_enabled |= stack_to_use.getProperty("support_enable", "value")
support_bottom_enabled |= stack_to_use.getProperty("support_bottom_enable", "value")
support_roof_enabled |= stack_to_use.getProperty("support_roof_enable", "value")
support_interface_enable |= stack_to_use.getProperty("support_interface_enable", "value")
# Check limit to extruders
limit_to_extruder_feature_list = ["wall_extruder_nr",
"wall_0_extruder_nr",
"wall_x_extruder_nr",
"top_bottom_extruder_nr",
"infill_extruder_nr",
]
wall_extruder_nr = None
for extruder_nr_feature_name in limit_to_extruder_feature_list:
extruder_nr = global_stack.getProperty(extruder_nr_feature_name, "value")
if extruder_nr == -1:
# outer and inner wall extruder numbers should first inherit from the wall extruder number
if extruder_nr_feature_name in ["wall_0_extruder_nr", "wall_x_extruder_nr"]:
extruder_nr = wall_extruder_nr
else:
extruder_nr = 0
used_extruder_stack_ids.add(self.extruderIds[str(extruder_nr)])
if extruder_nr_feature_name == "wall_extruder_nr":
wall_extruder_nr = extruder_nr
# Check support extruders
if support_enabled:
used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_infill_extruder_nr", "value"))])
used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_extruder_nr_layer_0", "value"))])
@ -454,6 +476,8 @@ class ExtruderManager(QObject):
used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_bottom_extruder_nr", "value"))])
if support_roof_enabled:
used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_roof_extruder_nr", "value"))])
if support_interface_enable:
used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_interface_enable", "value"))])
#The platform adhesion extruder. Not used if using none.
if global_stack.getProperty("adhesion_type", "value") != "none":