diff --git a/cura/Settings/CuraContainerStack.py b/cura/Settings/CuraContainerStack.py index cdda14ee18..eeb170c489 100755 --- a/cura/Settings/CuraContainerStack.py +++ b/cura/Settings/CuraContainerStack.py @@ -432,6 +432,7 @@ class CuraContainerStack(ContainerStack): # - If the machine definition has a metadata entry "has_machine_materials", the definition of the material should # be the same as the machine definition for this stack. Otherwise, the definition should be "fdmprinter". # - The container should have a metadata entry "type" with value "material". + # - The material should have an approximate diameter that matches the machine # - If the machine definition has a metadata entry "has_variants" and set to True, the "variant" metadata entry of # the material should be the same as the ID of the variant in the stack. Only applies if "has_machine_materials" is also True. # - If the stack currently has a material set, try to find a material that matches the current material by name. @@ -460,6 +461,9 @@ class CuraContainerStack(ContainerStack): if preferred_material: search_criteria["id"] = preferred_material + approximate_material_diameter = str(round(self.getProperty("material_diameter", "value"))) + search_criteria["approximate_diameter"] = approximate_material_diameter + materials = ContainerRegistry.getInstance().findInstanceContainers(**search_criteria) if not materials: Logger.log("w", "The preferred material \"{material}\" could not be found for stack {stack}", material = preferred_material, stack = self.id)