diff options
author | Ghostkeeper <rubend@tutanota.com> | 2019-09-17 10:23:33 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2019-09-17 10:23:33 +0300 |
commit | eaf649023a1e73533fc49a162a7af513c11ec603 (patch) | |
tree | 106dc2cf9339dd358edba3a8982889140c7039bd /plugins/MachineSettingsAction | |
parent | 977beb8dbb0aa92c7dc450a2cbfbbb65ab53faf9 (diff) |
Fix setting default material after g-code flavour changes has_materials
Don't use the material manager here any more.
Contributes to issue CURA-6600.
Diffstat (limited to 'plugins/MachineSettingsAction')
-rwxr-xr-x | plugins/MachineSettingsAction/MachineSettingsAction.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.py b/plugins/MachineSettingsAction/MachineSettingsAction.py index a0ce51df9b..25586ddeb0 100755 --- a/plugins/MachineSettingsAction/MachineSettingsAction.py +++ b/plugins/MachineSettingsAction/MachineSettingsAction.py @@ -113,11 +113,8 @@ class MachineSettingsAction(MachineAction): return machine_manager = self._application.getMachineManager() - material_manager = self._application.getMaterialManager() - extruder_positions = list(global_stack.extruders.keys()) has_materials = global_stack.getProperty("machine_gcode_flavor", "value") != "UltiGCode" - material_node = None if has_materials: global_stack.setMetaDataEntry("has_materials", True) else: @@ -129,10 +126,12 @@ class MachineSettingsAction(MachineAction): self._updateHasMaterialsInContainerTree() # set materials - for position in extruder_positions: - if has_materials: - material_node = material_manager.getDefaultMaterial(global_stack, position, None) - machine_manager.setMaterial(position, material_node) + machine_node = ContainerTree.getInstance().machines[global_stack.definition.getId()] + for position, extruder in enumerate(global_stack.extruderList): + #Find out what material we need to default to. + approximate_diameter = round(extruder.getProperty("material_diameter", "value")) + material_node = machine_node.variants[extruder.variant.getName()].preferredMaterial(approximate_diameter) + machine_manager.setMaterial(str(position), material_node) self._application.globalContainerStackChanged.emit() |