Use getApproximateMaterialDiameter instead of rounded getCompatibleMaterialDiameter

So we don't need to round it again.
Also convert both to float to be robust against the ambiguous serialisation of floats getting in the way (e.g. '3' vs. '3.0'). Python does that sometimes.

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-09-17 15:50:38 +02:00
parent eaf649023a
commit 614c2970ea
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276

View file

@ -131,8 +131,8 @@ class MaterialManager(QObject):
# Fetch the available materials (ContainerNode) for the current active machine and extruder setup.
materials = self.getAvailableMaterials(machine.definition.getId(), nozzle_name)
compatible_material_diameter = str(round(extruder_stack.getCompatibleMaterialDiameter()))
result = {key: material for key, material in materials.items() if material.container and material.container.getMetaDataEntry("approximate_diameter") == compatible_material_diameter}
compatible_material_diameter = extruder_stack.getApproximateMaterialDiameter()
result = {key: material for key, material in materials.items() if material.container and float(material.container.getMetaDataEntry("approximate_diameter")) == compatible_material_diameter}
return result
#