mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Return empty material model for empty material
CURA-5982
This commit is contained in:
parent
f91dbd356d
commit
edf8460619
1 changed files with 9 additions and 0 deletions
|
@ -593,6 +593,15 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||||
def _createMaterialOutputModel(self, material_data: Dict[str, Any]) -> "MaterialOutputModel":
|
def _createMaterialOutputModel(self, material_data: Dict[str, Any]) -> "MaterialOutputModel":
|
||||||
material_manager = CuraApplication.getInstance().getMaterialManager()
|
material_manager = CuraApplication.getInstance().getMaterialManager()
|
||||||
material_group_list = material_manager.getMaterialGroupListByGUID(material_data["guid"])
|
material_group_list = material_manager.getMaterialGroupListByGUID(material_data["guid"])
|
||||||
|
# This can happen if the connected machine has no material in one or more extruders, so we should return an
|
||||||
|
# "empty" material model.
|
||||||
|
if material_group_list is None:
|
||||||
|
return MaterialOutputModel(guid = material_data["guid"],
|
||||||
|
type = material_data.get("type", ""),
|
||||||
|
color = material_data.get("color", ""),
|
||||||
|
brand = material_data.get("brand", ""),
|
||||||
|
name = material_data.get("name", "Empty")
|
||||||
|
)
|
||||||
|
|
||||||
# Sort the material groups by "is_read_only = True" first, and then the name alphabetically.
|
# Sort the material groups by "is_read_only = True" first, and then the name alphabetically.
|
||||||
read_only_material_group_list = list(filter(lambda x: x.is_read_only, material_group_list))
|
read_only_material_group_list = list(filter(lambda x: x.is_read_only, material_group_list))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue