Add function to find preferred quality profile

Not for global yet, so it doesn't appear as if anything is loaded yet.

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-08-26 17:50:46 +02:00
parent 557c3d9515
commit fcab800a8d
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276
3 changed files with 33 additions and 4 deletions

View file

@ -71,12 +71,14 @@ class VariantNode(ContainerNode):
## Finds the preferred material for this printer with this nozzle in one of
# the extruders.
#
# If there is no material here (because the printer has no materials or
# because there are no matching material profiles), None is returned.
# If the preferred material is not available, an arbitrary material is
# returned. If there is a configuration mistake (like a typo in the
# preferred material) this returns a random available material. If there
# are no available materials, this will return the empty material node.
# \param approximate_diameter The desired approximate diameter of the
# material.
# \return The node for the preferred material, or None if there is no
# match.
# \return The node for the preferred material, or any arbitrary material
# if there is no match.
def preferredMaterial(self, approximate_diameter) -> MaterialNode:
for base_material, material_node in self.materials.items():
if self.machine.preferred_material in base_material and approximate_diameter == int(material_node.getMetaDataEntry("approximate_diameter")):