diff options
Diffstat (limited to 'cura/Settings/ExtruderManager.py')
-rwxr-xr-x | cura/Settings/ExtruderManager.py | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index 34ba96e280..07c074254f 100755 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -259,11 +259,21 @@ class ExtruderManager(QObject): if support_roof_enabled: used_extruder_stack_ids.add(self.extruderIds[self.extruderValueWithDefault(str(global_stack.getProperty("support_roof_extruder_nr", "value")))]) - # The platform adhesion extruder. Not used if using none. - if global_stack.getProperty("adhesion_type", "value") != "none" or ( - global_stack.getProperty("prime_tower_brim_enable", "value") and - global_stack.getProperty("adhesion_type", "value") != 'raft'): - extruder_str_nr = str(global_stack.getProperty("adhesion_extruder_nr", "value")) + # The platform adhesion extruders. + used_adhesion_extruders = set() + adhesion_type = global_stack.getProperty("adhesion_type", "value") + if adhesion_type == "skirt" and (global_stack.getProperty("skirt_line_count", "value") > 0 or global_stack.getProperty("skirt_brim_minimal_length", "value") > 0): + used_adhesion_extruders.add("skirt_brim_extruder_nr") # There's a skirt. + if (adhesion_type == "brim" or global_stack.getProperty("prime_tower_brim_enable", "value")) and (global_stack.getProperty("brim_line_count", "value") > 0 or global_stack.getProperty("skirt_brim_minimal_length", "value") > 0): + used_adhesion_extruders.add("skirt_brim_extruder_nr") # There's a brim or prime tower brim. + if adhesion_type == "raft": + used_adhesion_extruders.add("raft_base_extruder_nr") + if global_stack.getProperty("raft_interface_layers", "value") > 0: + used_adhesion_extruders.add("raft_interface_extruder_nr") + if global_stack.getProperty("raft_surface_layers", "value") > 0: + used_adhesion_extruders.add("raft_surface_extruder_nr") + for extruder_setting in used_adhesion_extruders: + extruder_str_nr = str(global_stack.getProperty(extruder_setting, "value")) if extruder_str_nr == "-1": extruder_str_nr = self._application.getMachineManager().defaultExtruderPosition if extruder_str_nr in self.extruderIds: @@ -286,8 +296,11 @@ class ExtruderManager(QObject): global_stack = application.getGlobalContainerStack() # Starts with the adhesion extruder. - if global_stack.getProperty("adhesion_type", "value") != "none": - return global_stack.getProperty("adhesion_extruder_nr", "value") + adhesion_type = global_stack.getProperty("adhesion_type", "value") + if adhesion_type in {"skirt", "brim"}: + return global_stack.getProperty("skirt_brim_extruder_nr", "value") + if adhesion_type == "raft": + return global_stack.getProperty("raft_base_extruder_nr", "value") # No adhesion? Well maybe there is still support brim. if (global_stack.getProperty("support_enable", "value") or global_stack.getProperty("support_structure", "value") == "tree") and global_stack.getProperty("support_brim_enable", "value"): @@ -422,7 +435,10 @@ class ExtruderManager(QObject): Logger.log("w", "Could not find the variant %s", active_variant_name) return True active_variant_node = machine_node.variants[active_variant_name] - active_material_node = active_variant_node.materials[extruder_stack.material.getMetaDataEntry("base_file")] + try: + active_material_node = active_variant_node.materials[extruder_stack.material.getMetaDataEntry("base_file")] + except KeyError: # The material in this stack is not a supported material (e.g. wrong filament diameter, as loaded from a project file). + return False active_material_node_qualities = active_material_node.qualities if not active_material_node_qualities: |