diff options
author | Jaime van Kessel <nallath@gmail.com> | 2019-11-05 15:11:49 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2019-11-05 15:11:49 +0300 |
commit | 870db0641bdb89c3efd06f58c761454d1c31419d (patch) | |
tree | bf5154ca3dc0592b1153dc97c40002367c40157b | |
parent | 366dd4bd00e4af362360a81a2b78d9e9b5295372 (diff) |
Ensure that machines with 1.75mm filament select the right preferred material
CURA-6950
-rw-r--r-- | cura/Machines/VariantNode.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cura/Machines/VariantNode.py b/cura/Machines/VariantNode.py index 8275c70e62..b2115ca099 100644 --- a/cura/Machines/VariantNode.py +++ b/cura/Machines/VariantNode.py @@ -85,11 +85,20 @@ class VariantNode(ContainerNode): for base_material, material_node in self.materials.items(): if self.machine.preferred_material == base_material and approximate_diameter == int(material_node.getMetaDataEntry("approximate_diameter")): return material_node - # First fallback: Choose any material with matching diameter. + + # First fallback: Check if we should be checking for the 175 variant. + if approximate_diameter == 2: + preferred_material = self.machine.preferred_material + "_175" + for base_material, material_node in self.materials.items(): + if preferred_material == base_material and approximate_diameter == int(material_node.getMetaDataEntry("approximate_diameter")): + return material_node + + # Second fallback: Choose any material with matching diameter. for material_node in self.materials.values(): if material_node.getMetaDataEntry("approximate_diameter") and approximate_diameter == int(material_node.getMetaDataEntry("approximate_diameter")): Logger.log("w", "Could not find preferred material %s, falling back to whatever works", self.machine.preferred_material) return material_node + fallback = next(iter(self.materials.values())) # Should only happen with empty material node. Logger.log("w", "Could not find preferred material {preferred_material} with diameter {diameter} for variant {variant_id}, falling back to {fallback}.".format( preferred_material = self.machine.preferred_material, |