mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 03:09:04 +08:00
Merge pull request #3908 from Ultimaker/CURA-5444_pva_default_hardware_compatible
CURA-5444: These are merged, but the branches are not deleted, so that we can also open a new PR to merge into 3.4.
This commit is contained in:
commit
dc5a48fb7d
@ -632,35 +632,36 @@ class XmlMaterialProfile(InstanceContainer):
|
|||||||
|
|
||||||
machine_manufacturer = identifier.get("manufacturer", definition.get("manufacturer", "Unknown")) #If the XML material doesn't specify a manufacturer, use the one in the actual printer definition.
|
machine_manufacturer = identifier.get("manufacturer", definition.get("manufacturer", "Unknown")) #If the XML material doesn't specify a manufacturer, use the one in the actual printer definition.
|
||||||
|
|
||||||
if machine_compatibility:
|
# Always create the instance of the material even if it is not compatible, otherwise it will never
|
||||||
new_material_id = self.getId() + "_" + machine_id
|
# show as incompatible if the material profile doesn't define hotends in the machine - CURA-5444
|
||||||
|
new_material_id = self.getId() + "_" + machine_id
|
||||||
|
|
||||||
# The child or derived material container may already exist. This can happen when a material in a
|
# The child or derived material container may already exist. This can happen when a material in a
|
||||||
# project file and the a material in Cura have the same ID.
|
# project file and the a material in Cura have the same ID.
|
||||||
# In the case if a derived material already exists, override that material container because if
|
# In the case if a derived material already exists, override that material container because if
|
||||||
# the data in the parent material has been changed, the derived ones should be updated too.
|
# the data in the parent material has been changed, the derived ones should be updated too.
|
||||||
if ContainerRegistry.getInstance().isLoaded(new_material_id):
|
if ContainerRegistry.getInstance().isLoaded(new_material_id):
|
||||||
new_material = ContainerRegistry.getInstance().findContainers(id = new_material_id)[0]
|
new_material = ContainerRegistry.getInstance().findContainers(id = new_material_id)[0]
|
||||||
is_new_material = False
|
is_new_material = False
|
||||||
else:
|
else:
|
||||||
new_material = XmlMaterialProfile(new_material_id)
|
new_material = XmlMaterialProfile(new_material_id)
|
||||||
is_new_material = True
|
is_new_material = True
|
||||||
|
|
||||||
new_material.setMetaData(copy.deepcopy(self.getMetaData()))
|
new_material.setMetaData(copy.deepcopy(self.getMetaData()))
|
||||||
new_material.getMetaData()["id"] = new_material_id
|
new_material.getMetaData()["id"] = new_material_id
|
||||||
new_material.getMetaData()["name"] = self.getName()
|
new_material.getMetaData()["name"] = self.getName()
|
||||||
new_material.setDefinition(machine_id)
|
new_material.setDefinition(machine_id)
|
||||||
# Don't use setMetadata, as that overrides it for all materials with same base file
|
# Don't use setMetadata, as that overrides it for all materials with same base file
|
||||||
new_material.getMetaData()["compatible"] = machine_compatibility
|
new_material.getMetaData()["compatible"] = machine_compatibility
|
||||||
new_material.getMetaData()["machine_manufacturer"] = machine_manufacturer
|
new_material.getMetaData()["machine_manufacturer"] = machine_manufacturer
|
||||||
new_material.getMetaData()["definition"] = machine_id
|
new_material.getMetaData()["definition"] = machine_id
|
||||||
|
|
||||||
new_material.setCachedValues(cached_machine_setting_properties)
|
new_material.setCachedValues(cached_machine_setting_properties)
|
||||||
|
|
||||||
new_material._dirty = False
|
new_material._dirty = False
|
||||||
|
|
||||||
if is_new_material:
|
if is_new_material:
|
||||||
containers_to_add.append(new_material)
|
containers_to_add.append(new_material)
|
||||||
|
|
||||||
# Find the buildplates compatibility
|
# Find the buildplates compatibility
|
||||||
buildplates = machine.iterfind("./um:buildplate", self.__namespaces)
|
buildplates = machine.iterfind("./um:buildplate", self.__namespaces)
|
||||||
@ -871,22 +872,23 @@ class XmlMaterialProfile(InstanceContainer):
|
|||||||
|
|
||||||
machine_manufacturer = identifier.get("manufacturer", definition_metadata.get("manufacturer", "Unknown")) #If the XML material doesn't specify a manufacturer, use the one in the actual printer definition.
|
machine_manufacturer = identifier.get("manufacturer", definition_metadata.get("manufacturer", "Unknown")) #If the XML material doesn't specify a manufacturer, use the one in the actual printer definition.
|
||||||
|
|
||||||
if machine_compatibility:
|
# Always create the instance of the material even if it is not compatible, otherwise it will never
|
||||||
new_material_id = container_id + "_" + machine_id
|
# show as incompatible if the material profile doesn't define hotends in the machine - CURA-5444
|
||||||
|
new_material_id = container_id + "_" + machine_id
|
||||||
|
|
||||||
# Do not look for existing container/container metadata with the same ID although they may exist.
|
# Do not look for existing container/container metadata with the same ID although they may exist.
|
||||||
# In project loading and perhaps some other places, we only want to get information (metadata)
|
# In project loading and perhaps some other places, we only want to get information (metadata)
|
||||||
# from a file without changing the current state of the system. If we overwrite the existing
|
# from a file without changing the current state of the system. If we overwrite the existing
|
||||||
# metadata here, deserializeMetadata() will not be safe for retrieving information.
|
# metadata here, deserializeMetadata() will not be safe for retrieving information.
|
||||||
new_material_metadata = {}
|
new_material_metadata = {}
|
||||||
|
|
||||||
new_material_metadata.update(base_metadata)
|
new_material_metadata.update(base_metadata)
|
||||||
new_material_metadata["id"] = new_material_id
|
new_material_metadata["id"] = new_material_id
|
||||||
new_material_metadata["compatible"] = machine_compatibility
|
new_material_metadata["compatible"] = machine_compatibility
|
||||||
new_material_metadata["machine_manufacturer"] = machine_manufacturer
|
new_material_metadata["machine_manufacturer"] = machine_manufacturer
|
||||||
new_material_metadata["definition"] = machine_id
|
new_material_metadata["definition"] = machine_id
|
||||||
|
|
||||||
result_metadata.append(new_material_metadata)
|
result_metadata.append(new_material_metadata)
|
||||||
|
|
||||||
buildplates = machine.iterfind("./um:buildplate", cls.__namespaces)
|
buildplates = machine.iterfind("./um:buildplate", cls.__namespaces)
|
||||||
buildplate_map = {}
|
buildplate_map = {}
|
||||||
|
@ -8,5 +8,6 @@
|
|||||||
"Ultimaker 3 Extended": "ultimaker3_extended",
|
"Ultimaker 3 Extended": "ultimaker3_extended",
|
||||||
"Ultimaker Original": "ultimaker_original",
|
"Ultimaker Original": "ultimaker_original",
|
||||||
"Ultimaker Original+": "ultimaker_original_plus",
|
"Ultimaker Original+": "ultimaker_original_plus",
|
||||||
|
"Ultimaker Original Dual Extrusion": "ultimaker_original_dual",
|
||||||
"IMADE3D JellyBOX": "imade3d_jellybox"
|
"IMADE3D JellyBOX": "imade3d_jellybox"
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user