From f11869034b24f506093503e04429bc2848e962f4 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 16 Aug 2021 14:28:40 +0200 Subject: [PATCH 1/2] Add {material_type} and {material_name} as replacement patterns --- plugins/CuraEngineBackend/StartSliceJob.py | 4 +++- resources/definitions/fdmprinter.def.json | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/plugins/CuraEngineBackend/StartSliceJob.py b/plugins/CuraEngineBackend/StartSliceJob.py index 453907ffc0..8729bdf7be 100644 --- a/plugins/CuraEngineBackend/StartSliceJob.py +++ b/plugins/CuraEngineBackend/StartSliceJob.py @@ -411,8 +411,10 @@ class StartSliceJob(Job): extruder_nr = stack.getProperty("extruder_nr", "value") settings = self._all_extruders_settings[str(extruder_nr)].copy() - # Also send the material GUID. This is a setting in fdmprinter, but we have no interface for it. + # Also send the material GUID, type and name. These are settings in fdmprinter, but we have no interface for it. settings["material_guid"] = stack.material.getMetaDataEntry("GUID", "") + settings["material_type"] = stack.material.getMetaDataEntry("material", "") + settings["material_name"] = stack.material.getMetaDataEntry("name", "") # Replace the setting tokens in start and end g-code. extruder_nr = stack.getProperty("extruder_nr", "value") diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index a38cfc8852..dab3260388 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -79,6 +79,22 @@ "type": "str", "enabled": false }, + "material_type": + { + "label": "Material Type", + "description": "Type of material. This is set automatically.", + "default_value": "", + "type": "str", + "enabled": false + }, + "material_name": + { + "label": "Material Name", + "description": "Name of the material. This is set automatically.", + "default_value": "", + "type": "str", + "enabled": false + }, "material_diameter": { "label": "Diameter", From 2238234741769bcb8c967741e45d844ead1f70a4 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 24 Aug 2021 09:57:30 +0200 Subject: [PATCH 2/2] Add id & brand and don't send material properties to CuraEngine --- plugins/CuraEngineBackend/StartSliceJob.py | 17 ++++++++++++----- resources/definitions/fdmprinter.def.json | 16 ---------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/plugins/CuraEngineBackend/StartSliceJob.py b/plugins/CuraEngineBackend/StartSliceJob.py index 8729bdf7be..d186a1bfd9 100644 --- a/plugins/CuraEngineBackend/StartSliceJob.py +++ b/plugins/CuraEngineBackend/StartSliceJob.py @@ -353,10 +353,19 @@ class StartSliceJob(Job): result[key] = stack.getProperty(key, "value") Job.yieldThread() - result["print_bed_temperature"] = result["material_bed_temperature"] # Renamed settings. + # Material identification in addition to non-human-readable GUID + result["material_id"] = stack.material.getMetaDataEntry("base_file", "") + result["material_type"] = stack.material.getMetaDataEntry("material", "") + result["material_name"] = stack.material.getMetaDataEntry("name", "") + result["material_brand"] = stack.material.getMetaDataEntry("brand", "") + + # Renamed settings. + result["print_bed_temperature"] = result["material_bed_temperature"] result["print_temperature"] = result["material_print_temperature"] result["travel_speed"] = result["speed_travel"] - result["time"] = time.strftime("%H:%M:%S") #Some extra settings. + + #Some extra settings. + result["time"] = time.strftime("%H:%M:%S") result["date"] = time.strftime("%d-%m-%Y") result["day"] = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"][int(time.strftime("%w"))] result["initial_extruder_nr"] = CuraApplication.getInstance().getExtruderManager().getInitialExtruderNr() @@ -411,10 +420,8 @@ class StartSliceJob(Job): extruder_nr = stack.getProperty("extruder_nr", "value") settings = self._all_extruders_settings[str(extruder_nr)].copy() - # Also send the material GUID, type and name. These are settings in fdmprinter, but we have no interface for it. + # Also send the material GUID. This is a setting in fdmprinter, but we have no interface for it. settings["material_guid"] = stack.material.getMetaDataEntry("GUID", "") - settings["material_type"] = stack.material.getMetaDataEntry("material", "") - settings["material_name"] = stack.material.getMetaDataEntry("name", "") # Replace the setting tokens in start and end g-code. extruder_nr = stack.getProperty("extruder_nr", "value") diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index dab3260388..a38cfc8852 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -79,22 +79,6 @@ "type": "str", "enabled": false }, - "material_type": - { - "label": "Material Type", - "description": "Type of material. This is set automatically.", - "default_value": "", - "type": "str", - "enabled": false - }, - "material_name": - { - "label": "Material Name", - "description": "Name of the material. This is set automatically.", - "default_value": "", - "type": "str", - "enabled": false - }, "material_diameter": { "label": "Diameter",