From ab3f6271774548d1258264e94d5bcb6f771ef7a1 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Thu, 5 Sep 2019 18:01:04 +0200 Subject: [PATCH 01/11] Check if printerConfiguration is actually set before trying to access it --- .../src/Models/Http/ClusterPrinterStatus.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrinterStatus.py b/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrinterStatus.py index 2d2806050a..90d52a3eae 100644 --- a/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrinterStatus.py +++ b/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrinterStatus.py @@ -80,6 +80,11 @@ class ClusterPrinterStatus(BaseModel): model.updateBuildplate(self.build_plate.type if self.build_plate else "glass") model.setCameraUrl(QUrl("http://{}:8080/?action=stream".format(self.ip_address))) + if not model.printerConfiguration: + # Prevent accessing printer configuration when not available. + # This sometimes happens when a printer was just added to a group and Cura is connected to that group. + return + # Set the possible configurations based on whether a Material Station is present or not. if self.material_station and self.material_station.material_slots: self._updateAvailableConfigurations(model) From 549b724a4f6f490b05fb85b94bbe31d9eb7a4c36 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Fri, 6 Sep 2019 09:37:43 +0200 Subject: [PATCH 02/11] Use 2 extruders at all times for now --- .../UM3NetworkPrinting/src/Models/Http/ClusterPrinterStatus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrinterStatus.py b/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrinterStatus.py index 90d52a3eae..df2365011a 100644 --- a/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrinterStatus.py +++ b/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrinterStatus.py @@ -66,7 +66,7 @@ class ClusterPrinterStatus(BaseModel): ## Creates a new output model. # \param controller - The controller of the model. def createOutputModel(self, controller: PrinterOutputController) -> PrinterOutputModel: - model = PrinterOutputModel(controller, len(self.configuration), firmware_version = self.firmware_version) + model = PrinterOutputModel(controller, 2, firmware_version = self.firmware_version) self.updateOutputModel(model) return model From 5f480f753caa081ac0604585b7e70a4132ca9175 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Fri, 6 Sep 2019 09:50:15 +0200 Subject: [PATCH 03/11] Add fixme note to hardcoded extruder count --- .../src/Models/Http/ClusterPrinterStatus.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrinterStatus.py b/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrinterStatus.py index df2365011a..69daa1f08b 100644 --- a/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrinterStatus.py +++ b/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrinterStatus.py @@ -66,6 +66,10 @@ class ClusterPrinterStatus(BaseModel): ## Creates a new output model. # \param controller - The controller of the model. def createOutputModel(self, controller: PrinterOutputController) -> PrinterOutputModel: + # FIXME + # Note that we're using '2' here as extruder count. We have hardcoded this for now to prevent issues where the + # amount of extruders coming back from the API is actually lower (which it can be if a printer was just added + # to a cluster). This should be fixed in the future, probably also on the cluster API side. model = PrinterOutputModel(controller, 2, firmware_version = self.firmware_version) self.updateOutputModel(model) return model From 0235ad69305096c4d842c42cacb891cd1dcf852b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 6 Sep 2019 09:51:26 +0200 Subject: [PATCH 04/11] Check gltf extension against lower() filename CURA-6739 --- plugins/TrimeshReader/TrimeshReader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/TrimeshReader/TrimeshReader.py b/plugins/TrimeshReader/TrimeshReader.py index 7d1f182720..91f8423579 100644 --- a/plugins/TrimeshReader/TrimeshReader.py +++ b/plugins/TrimeshReader/TrimeshReader.py @@ -89,7 +89,7 @@ class TrimeshReader(MeshReader): # try to figure out the format, but for GLTF, it loads it as a binary file with flags "rb", and the json.load() # doesn't like it. For some reason, this seems to happen with 3.5.7, but not 3.7.1. Below is a workaround to # pass a file object that has been opened with "r" instead "rb" to load a GLTF file. - if file_name.endswith(".gltf"): + if file_name.lower().endswith(".gltf"): mesh_or_scene = trimesh.load(open(file_name, "r", encoding = "utf-8"), file_type = "gltf") else: mesh_or_scene = trimesh.load(file_name) From b7cc48131c606cadd0718cfce452c33f9126821f Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Fri, 6 Sep 2019 11:23:02 +0200 Subject: [PATCH 05/11] Add bom_numbers field to definitions CS-171 --- resources/definitions/ultimaker3.def.json | 5 ++++- resources/definitions/ultimaker3_extended.def.json | 5 ++++- resources/definitions/ultimaker_s3.def.json | 5 ++++- resources/definitions/ultimaker_s5.def.json | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/resources/definitions/ultimaker3.def.json b/resources/definitions/ultimaker3.def.json index bd7e96448a..b34ff3bdba 100644 --- a/resources/definitions/ultimaker3.def.json +++ b/resources/definitions/ultimaker3.def.json @@ -33,7 +33,10 @@ "https://software.ultimaker.com/releases/firmware/9066/stable/um-update.swu.version" ], "update_url": "https://ultimaker.com/firmware" - } + }, + "bom_numbers": [ + 9066 + ] }, diff --git a/resources/definitions/ultimaker3_extended.def.json b/resources/definitions/ultimaker3_extended.def.json index c0d099366d..ba9824896f 100644 --- a/resources/definitions/ultimaker3_extended.def.json +++ b/resources/definitions/ultimaker3_extended.def.json @@ -30,7 +30,10 @@ "https://software.ultimaker.com/releases/firmware/9066/stable/um-update.swu.version" ], "update_url": "https://ultimaker.com/firmware" - } + }, + "bom_numbers": [ + 9511 + ] }, "overrides": { diff --git a/resources/definitions/ultimaker_s3.def.json b/resources/definitions/ultimaker_s3.def.json index 0fbf4acd77..f7f3a038fe 100644 --- a/resources/definitions/ultimaker_s3.def.json +++ b/resources/definitions/ultimaker_s3.def.json @@ -34,7 +34,10 @@ "id": 213482, "check_urls": ["https://software.ultimaker.com/releases/firmware/213482/stable/um-update.swu.version"], "update_url": "https://ultimaker.com/firmware" - } + }, + "bom_numbers": [ + 213482 + ] }, "overrides": { diff --git a/resources/definitions/ultimaker_s5.def.json b/resources/definitions/ultimaker_s5.def.json index 81b3a704ff..fef8c87c27 100644 --- a/resources/definitions/ultimaker_s5.def.json +++ b/resources/definitions/ultimaker_s5.def.json @@ -35,7 +35,10 @@ "id": 9051, "check_urls": ["https://software.ultimaker.com/releases/firmware/9051/stable/um-update.swu.version"], "update_url": "https://ultimaker.com/firmware" - } + }, + "bom_numbers": [ + 9051, 214475 + ] }, "overrides": { From 7674905f1c4c0e5750a6ea0afc127f3bd30c4075 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Fri, 6 Sep 2019 11:23:28 +0200 Subject: [PATCH 06/11] Extend found_machine_type_identifiers to include R2 CS-171 --- .../src/Network/LocalClusterOutputDeviceManager.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py b/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py index e55eb12fed..bfeb2f0be4 100644 --- a/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py +++ b/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py @@ -135,10 +135,13 @@ class LocalClusterOutputDeviceManager: ultimaker_machines = container_registry.findContainersMetadata(type="machine", manufacturer="Ultimaker B.V.") found_machine_type_identifiers = {} # type: Dict[str, str] for machine in ultimaker_machines: - machine_bom_number = machine.get("firmware_update_info", {}).get("id", None) machine_type = machine.get("id", None) - if machine_bom_number and machine_type: - found_machine_type_identifiers[str(machine_bom_number)] = machine_type + machine_bom_numbers = machine.get("bom_numbers", []) + if machine_type and machine_bom_numbers: + for bom_number in machine_bom_numbers: + # This produces a n:1 mapping of bom numberss to machine types + # allowing the S5R1 and S5R2 hardware to use a single S5 definition. + found_machine_type_identifiers[str(bom_number)] = machine_type return found_machine_type_identifiers ## Add a new device. From f49cf8dfd57ee23aa8f60535016b7d65519fa109 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Fri, 6 Sep 2019 11:30:42 +0200 Subject: [PATCH 07/11] Fix typo CS-171 --- .../src/Network/LocalClusterOutputDeviceManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py b/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py index bfeb2f0be4..89fd71d03c 100644 --- a/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py +++ b/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py @@ -139,7 +139,7 @@ class LocalClusterOutputDeviceManager: machine_bom_numbers = machine.get("bom_numbers", []) if machine_type and machine_bom_numbers: for bom_number in machine_bom_numbers: - # This produces a n:1 mapping of bom numberss to machine types + # This produces a n:1 mapping of bom numbers to machine types # allowing the S5R1 and S5R2 hardware to use a single S5 definition. found_machine_type_identifiers[str(bom_number)] = machine_type return found_machine_type_identifiers From c1b4bcebec0d1de587f121266d8793a9a5b00b77 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 6 Sep 2019 12:41:09 +0200 Subject: [PATCH 08/11] Add message while pausing This way you can display instructions during the print. Implements issue CURA-6759. --- .../scripts/DisplayFilenameAndLayerOnLCD.py | 2 +- .../PostProcessingPlugin/scripts/PauseAtHeight.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/PostProcessingPlugin/scripts/DisplayFilenameAndLayerOnLCD.py b/plugins/PostProcessingPlugin/scripts/DisplayFilenameAndLayerOnLCD.py index 25194568e7..001beecd3b 100644 --- a/plugins/PostProcessingPlugin/scripts/DisplayFilenameAndLayerOnLCD.py +++ b/plugins/PostProcessingPlugin/scripts/DisplayFilenameAndLayerOnLCD.py @@ -69,7 +69,7 @@ class DisplayFilenameAndLayerOnLCD(Script): else: lcd_text = "M117 Printing Layer " else: - lcd_text = "M117 Printing " + name + " - Layer " + lcd_text = "M117 Printing " + name + " - Layer " i = self.getSettingValueByKey("startNum") for layer in data: display_text = lcd_text + str(i) + " " + name diff --git a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py index 50d365da0b..cc83b7b76c 100644 --- a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py +++ b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py @@ -106,10 +106,17 @@ class PauseAtHeight(Script): "standby_temperature": { "label": "Standby Temperature", - "description": "Change the temperature during the pause", + "description": "Change the temperature during the pause.", "unit": "°C", "type": "int", "default_value": 0 + }, + "display_text": + { + "label": "Display Text", + "description": "Text that should appear on the display while paused.", + "type": "str", + "default_value": "Print paused." } } }""" @@ -144,6 +151,7 @@ class PauseAtHeight(Script): firmware_retract = Application.getInstance().getGlobalContainerStack().getProperty("machine_firmware_retract", "value") control_temperatures = Application.getInstance().getGlobalContainerStack().getProperty("machine_nozzle_temp_enabled", "value") initial_layer_height = Application.getInstance().getGlobalContainerStack().getProperty("layer_height_0", "value") + display_text = self.getSettingValueByKey("display_text") is_griffin = False @@ -287,6 +295,8 @@ class PauseAtHeight(Script): # Set extruder standby temperature prepend_gcode += self.putValue(M = 104, S = standby_temperature) + " ; standby temperature\n" + prepend_gcode += "M117 " + display_text + "\n" + # Wait till the user continues printing prepend_gcode += self.putValue(M = 0) + " ; Do the actual pause\n" From b20e5bfd989d579853e5f29c0d703bc9beed0a26 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 6 Sep 2019 12:42:15 +0200 Subject: [PATCH 09/11] Don't display any message if setting is empty Contributes to issue CURA-6759. --- plugins/PostProcessingPlugin/scripts/PauseAtHeight.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py index cc83b7b76c..913be4e966 100644 --- a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py +++ b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py @@ -114,9 +114,9 @@ class PauseAtHeight(Script): "display_text": { "label": "Display Text", - "description": "Text that should appear on the display while paused.", + "description": "Text that should appear on the display while paused. If left empty, there will not be any message.", "type": "str", - "default_value": "Print paused." + "default_value": "" } } }""" @@ -295,7 +295,8 @@ class PauseAtHeight(Script): # Set extruder standby temperature prepend_gcode += self.putValue(M = 104, S = standby_temperature) + " ; standby temperature\n" - prepend_gcode += "M117 " + display_text + "\n" + if display_text: + prepend_gcode += "M117 " + display_text + "\n" # Wait till the user continues printing prepend_gcode += self.putValue(M = 0) + " ; Do the actual pause\n" From f5aa2921ffdced69bb30ad48cfd504e61c7d73fa Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 6 Sep 2019 14:34:40 +0200 Subject: [PATCH 10/11] Add space before comments Some pause commands on some printers (looking at you, Repetier) seem to require a space after it, which is not obvious to the user. So we'll put a space there for them. Fixes #6295. --- plugins/PostProcessingPlugin/scripts/TimeLapse.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/PostProcessingPlugin/scripts/TimeLapse.py b/plugins/PostProcessingPlugin/scripts/TimeLapse.py index 36d0f6a058..53e55a9454 100644 --- a/plugins/PostProcessingPlugin/scripts/TimeLapse.py +++ b/plugins/PostProcessingPlugin/scripts/TimeLapse.py @@ -77,10 +77,10 @@ class TimeLapse(Script): gcode_to_append = ";TimeLapse Begin\n" if park_print_head: - gcode_to_append += self.putValue(G = 1, F = feed_rate, X = x_park, Y = y_park) + ";Park print head\n" - gcode_to_append += self.putValue(M = 400) + ";Wait for moves to finish\n" - gcode_to_append += trigger_command + ";Snap Photo\n" - gcode_to_append += self.putValue(G = 4, P = pause_length) + ";Wait for camera\n" + gcode_to_append += self.putValue(G = 1, F = feed_rate, X = x_park, Y = y_park) + " ;Park print head\n" + gcode_to_append += self.putValue(M = 400) + " ;Wait for moves to finish\n" + gcode_to_append += trigger_command + " ;Snap Photo\n" + gcode_to_append += self.putValue(G = 4, P = pause_length) + " ;Wait for camera\n" gcode_to_append += ";TimeLapse End\n" for layer in data: # Check that a layer is being printed From c3f9d65de140cbad7e40ade1d77b6ce331ebd9b6 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 6 Sep 2019 14:35:00 +0200 Subject: [PATCH 11/11] Ignore SettingsGuide plug-in --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a66c1086a7..eed686fda7 100644 --- a/.gitignore +++ b/.gitignore @@ -35,7 +35,7 @@ cura.desktop .pydevproject .settings -#Externally located plug-ins. +#Externally located plug-ins commonly installed by our devs. plugins/cura-big-flame-graph plugins/cura-god-mode-plugin plugins/cura-siemensnx-plugin @@ -52,6 +52,7 @@ plugins/FlatProfileExporter plugins/GodMode plugins/OctoPrintPlugin plugins/ProfileFlattener +plugins/SettingsGuide plugins/X3GWriter #Build stuff