mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-17 11:47:50 -06:00
Get diameter from material container
CURA-6821
This commit is contained in:
parent
aaca4bb9a1
commit
ad7b58e460
2 changed files with 3 additions and 8 deletions
|
@ -18,7 +18,7 @@ if TYPE_CHECKING:
|
||||||
#
|
#
|
||||||
# Its subcontainers are quality profiles.
|
# Its subcontainers are quality profiles.
|
||||||
class MaterialNode(ContainerNode):
|
class MaterialNode(ContainerNode):
|
||||||
def __init__(self, container_id, variant: "VariantNode") -> None:
|
def __init__(self, container_id: str, variant: "VariantNode") -> None:
|
||||||
super().__init__(container_id)
|
super().__init__(container_id)
|
||||||
self.variant = variant
|
self.variant = variant
|
||||||
self.qualities = {} # type: Dict[str, QualityNode] # Mapping container IDs to quality profiles.
|
self.qualities = {} # type: Dict[str, QualityNode] # Mapping container IDs to quality profiles.
|
||||||
|
@ -29,10 +29,6 @@ class MaterialNode(ContainerNode):
|
||||||
self.base_file = my_metadata["base_file"]
|
self.base_file = my_metadata["base_file"]
|
||||||
self.material_type = my_metadata["material"]
|
self.material_type = my_metadata["material"]
|
||||||
self.guid = my_metadata["GUID"]
|
self.guid = my_metadata["GUID"]
|
||||||
# MaterialNode can represent an empty_material container, which has no diameter.
|
|
||||||
self.diameter = None # type: Optional[str]
|
|
||||||
if "properties" in my_metadata:
|
|
||||||
self.diameter = my_metadata["properties"]["diameter"]
|
|
||||||
self._loadAll()
|
self._loadAll()
|
||||||
container_registry.containerRemoved.connect(self._onRemoved)
|
container_registry.containerRemoved.connect(self._onRemoved)
|
||||||
container_registry.containerMetaDataChanged.connect(self._onMetadataChanged)
|
container_registry.containerMetaDataChanged.connect(self._onMetadataChanged)
|
||||||
|
@ -133,8 +129,6 @@ class MaterialNode(ContainerNode):
|
||||||
self.material_type = new_metadata["material"]
|
self.material_type = new_metadata["material"]
|
||||||
old_guid = self.guid
|
old_guid = self.guid
|
||||||
self.guid = new_metadata["GUID"]
|
self.guid = new_metadata["GUID"]
|
||||||
if "properties" in new_metadata:
|
|
||||||
self.diameter = new_metadata["properties"]["diameter"]
|
|
||||||
if self.base_file != old_base_file or self.material_type != old_material_type or self.guid != old_guid: # List of quality profiles could've changed.
|
if self.base_file != old_base_file or self.material_type != old_material_type or self.guid != old_guid: # List of quality profiles could've changed.
|
||||||
self.qualities = {}
|
self.qualities = {}
|
||||||
self._loadAll() # Re-load the quality profiles for this node.
|
self._loadAll() # Re-load the quality profiles for this node.
|
||||||
|
|
|
@ -1354,7 +1354,8 @@ class MachineManager(QObject):
|
||||||
old_approximate_material_diameter = None # type: Optional[float]
|
old_approximate_material_diameter = None # type: Optional[float]
|
||||||
if candidate_materials:
|
if candidate_materials:
|
||||||
candidate_material = list(candidate_materials.values())[0]
|
candidate_material = list(candidate_materials.values())[0]
|
||||||
old_approximate_material_diameter = int(round(float(candidate_material.diameter)))
|
default_material_diameter = "2.85"
|
||||||
|
old_approximate_material_diameter = int(round(float(candidate_material.container.getMetaDataEntry("properties/diameter", default_material_diameter))))
|
||||||
new_approximate_material_diameter = int(self._global_container_stack.extruderList[int(position_item)].getApproximateMaterialDiameter())
|
new_approximate_material_diameter = int(self._global_container_stack.extruderList[int(position_item)].getApproximateMaterialDiameter())
|
||||||
|
|
||||||
# Only switch to the old candidate material if the approximate material diameter of the extruder stays the
|
# Only switch to the old candidate material if the approximate material diameter of the extruder stays the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue