From f903a7b0448b464553c212d855297cabf62071f4 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Thu, 26 Oct 2023 17:01:26 +0200 Subject: [PATCH] Add material map CURA-10561 --- plugins/MakerbotWriter/MakerbotWriter.py | 25 ++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/plugins/MakerbotWriter/MakerbotWriter.py b/plugins/MakerbotWriter/MakerbotWriter.py index db4a8b7797f..2467f07bcc7 100644 --- a/plugins/MakerbotWriter/MakerbotWriter.py +++ b/plugins/MakerbotWriter/MakerbotWriter.py @@ -30,7 +30,7 @@ class MakerbotWriter(MeshWriter): def __init__(self) -> None: super().__init__(add_to_recent_files=False) - Logger.info(f"Using PyDulcificum: {du.__version__}") + # Logger.info(f"Using PyDulcificum: {du.__version__}") _PNG_FORMATS = [ {"prefix": "isometric_thumbnail", "width": 120, "height": 120}, @@ -54,6 +54,21 @@ def __init__(self) -> None: "1A": "mk14", "2A": "mk14_s", } + _MATERIAL_MAP = { + '2780b345-577b-4a24-a2c5-12e6aad3e690': 'abs', + '88c8919c-6a09-471a-b7b6-e801263d862d': 'abs-wss1', + '416eead4-0d8e-4f0b-8bfc-a91a519befa5': 'asa', + '85bbae0e-938d-46fb-989f-c9b3689dc4f0': 'nylon-cf', + '283d439a-3490-4481-920c-c51d8cdecf9c': 'nylon', + '62414577-94d1-490d-b1e4-7ef3ec40db02': 'pc', + '69386c85-5b6c-421a-bec5-aeb1fb33f060': 'pet', # PETG + '0ff92885-617b-4144-a03c-9989872454bc': 'pla', + 'a4255da2-cb2a-4042-be49-4a83957a2f9a': 'pva', + 'a140ef8f-4f26-4e73-abe0-cfc29d6d1024': 'wss1', + '77873465-83a9-4283-bc44-4e542b8eb3eb': 'sr30', + '96fca5d9-0371-4516-9e96-8e8182677f3c': 'im-pla', + '19baa6a9-94ff-478b-b4a1-8157b74358d2': 'tpu', + } # must be called from the main thread because of OpenGL @staticmethod @@ -188,7 +203,13 @@ def _getMeta(self, root_nodes: List[SceneNode]) -> Dict[str, any]: meta["uuid"] = print_information.slice_uuid - materials = [extruder.material.getMetaData().get("material") for extruder in extruders] + materials = [] + for extruder in extruders: + guid = extruder.material.getMetaData().get("GUID") + material_name = extruder.material.getMetaData().get("material") + material = self._MATERIAL_MAP.get(guid, material_name) + materials.append(material) + meta["material"] = materials[0] meta["materials"] = materials