From 4f6d53b0097b998ab24ff108532434fbd86d52b3 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 31 Jan 2019 08:30:35 +0100 Subject: [PATCH] Do not disable all extruders when syncing CURA-5693 When syncing with a machine with no material/nozzle, do not disable all extruders. leave the first one enabled. --- cura/Settings/MachineManager.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index b0192ce9c0..be40f420fc 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1369,19 +1369,29 @@ class MachineManager(QObject): used_extruder_stack_list = ExtruderManager.getInstance().getUsedExtruderStacks() used_extruder_position_set = {es.getMetaDataEntry("position") for es in used_extruder_stack_list} disabled_used_extruder_position_set = set() + extruders_to_disable = set() # If an extruder that's currently used to print a model gets disabled due to the syncing, we need to show # a message explaining why. need_to_show_message = False for extruder_configuration in configuration.extruderConfigurations: - position = str(extruder_configuration.position) - extruder_has_hotend = extruder_configuration.hotendID != "" extruder_has_material = extruder_configuration.material.guid != "" # If the machine doesn't have a hotend or material, disable this extruder if not extruder_has_hotend or not extruder_has_material: + extruders_to_disable.add(extruder_configuration.position) + + # If there's no material and/or nozzle on the printer, enable the first extruder and disable the rest. + if len(extruders_to_disable) == len(self._global_container_stack.extruders): + extruders_to_disable.remove(min(extruders_to_disable)) + + for extruder_configuration in configuration.extruderConfigurations: + position = str(extruder_configuration.position) + + # If the machine doesn't have a hotend or material, disable this extruder + if int(position) in extruders_to_disable: self._global_container_stack.extruders[position].setEnabled(False) if position in used_extruder_position_set: need_to_show_message = True