From 81a33af3aaba5c05fe71fa38b5f64cd287029a82 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 22 Aug 2019 15:46:29 +0200 Subject: [PATCH] Use variant node's preferredMaterial function from MaterialManager too We can reuse that code. Contributes to issue CURA-6600. --- cura/Machines/MaterialManager.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cura/Machines/MaterialManager.py b/cura/Machines/MaterialManager.py index 85cdc17b61..97209cb0f4 100644 --- a/cura/Machines/MaterialManager.py +++ b/cura/Machines/MaterialManager.py @@ -242,11 +242,7 @@ class MaterialManager(QObject): if nozzle_name not in machine_node.variants: Logger.log("w", "Could not find variant {nozzle_name} for machine with definition {definition_id} in the container tree".format(nozzle_name = nozzle_name, definition_id = definition_id)) return None - available_materials = machine_node.variants[nozzle_name].materials - for base_material, material_node in available_materials.items(): - if machine_node.preferred_material in base_material and approximate_material_diameter == int(material_node.getMetaDataEntry("approximate_diameter")): - return material_node - return None + return machine_node.variants[nozzle_name].preferredMaterial(approximate_material_diameter) def removeMaterialByRootId(self, root_material_id: str): container_registry = CuraContainerRegistry.getInstance()