Browse Source

Merge branch 'fix_add_machine_material_diameter' of https://github.com/fieldOfView/Cura

Jaime van Kessel 7 years ago
parent
commit
ca1f7430c1
1 changed files with 4 additions and 0 deletions
  1. 4 0
      cura/Settings/CuraContainerStack.py

+ 4 - 0
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)