From 0fca136fa825c70e1cab941640d56d0d73552cfa Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 6 Oct 2015 14:53:32 +0200 Subject: [PATCH 1/4] Fix dual extrusion printer profile to confirm to updated JSON api --- .../machines/dual_extrusion_printer.json | 292 ++++++++++-------- 1 file changed, 165 insertions(+), 127 deletions(-) diff --git a/resources/machines/dual_extrusion_printer.json b/resources/machines/dual_extrusion_printer.json index 04b59757c7..d5d410161b 100644 --- a/resources/machines/dual_extrusion_printer.json +++ b/resources/machines/dual_extrusion_printer.json @@ -8,16 +8,6 @@ "visible": false, "machine_settings": { - "extruder_nr": { - "label": "Extruder", - "description": "The extruder train used for printing. This is used in multi-extrusion.", - "type": "int", - "default": 0, - "min_value": 0, - "max_value": 16, - "inherit_function": "extruder_nr" - }, - "machine_use_extruder_offset_to_offset_coords": { "default": false }, "machine_nozzle_offset_x": { "default": 0, "SEE_machine_extruder_trains": true }, @@ -32,6 +22,96 @@ "machine_extruder_end_code": { "default": "", "SEE_machine_extruder_trains": true } }, "overrides": { + "material_print_temperature": { + "children": { + "extruder_0_print_temperature": { + "label": "Extruder 0 Print Temperature", + "description": "The temperature to use when printing with extruder 0", + "unit": "°C", + "type": "int", + "type": "float", + "default": 190, + "min_value": "0", + "max_value_warning": "260" + }, + "extruder_1_print_temperature": { + "label": "Extruder 1 Print Temperature", + "description": "The temperature to use when printing with extruder 1", + "unit": "°C", + "type": "int", + "type": "float", + "default": 190, + "min_value": "0", + "max_value_warning": "260" + }, + "extruder_2_print_temperature": { + "label": "Extruder 2 Print Temperature", + "description": "The temperature to use when printing with extruder 2", + "unit": "°C", + "type": "int", + "type": "float", + "default": 190, + "min_value": "0", + "max_value_warning": "260", + "visible": false + }, + "extruder_3_print_temperature": { + "label": "Extruder 0 Print Temperature", + "description": "The temperature to use when printing with extruder 3", + "unit": "°C", + "type": "int", + "type": "float", + "default": 190, + "min_value": "0", + "max_value_warning": "260", + "visible": false + }, + "extruder_4_print_temperature": { + "label": "Extruder 4 Print Temperature", + "description": "The temperature to use when printing with extruder 4", + "unit": "°C", + "type": "int", + "type": "float", + "default": 190, + "min_value": "0", + "max_value_warning": "260", + "visible": false + }, + "extruder_5_print_temperature": { + "label": "Extruder 5 Print Temperature", + "description": "The temperature to use when printing with extruder 5", + "unit": "°C", + "type": "int", + "type": "float", + "default": 190, + "min_value": "0", + "max_value_warning": "260", + "visible": false + }, + "extruder_6_print_temperature": { + "label": "Extruder 6 Print Temperature", + "description": "The temperature to use when printing with extruder 6", + "unit": "°C", + "type": "int", + "type": "float", + "default": 190, + "min_value": "0", + "max_value_warning": "260", + "visible": false + }, + "extruder_7_print_temperature": { + "label": "Extruder 7 Print Temperature", + "description": "The temperature to use when printing with extruder 7", + "unit": "°C", + "type": "int", + "type": "float", + "default": 190, + "min_value": "0", + "max_value_warning": "260", + "visible": false + } + } + }, "speed_print": { "children": { "speed_prime_tower": { @@ -39,14 +119,11 @@ "description": "The speed at which the prime tower is printed. Printing the prime tower slower can make it more stable when the adhesion between the different filaments is suboptimal.", "unit": "mm/s", "type": "float", - "min_value": 0.1, - "max_value_warning": 150, + "min_value": "0.1", + "max_value_warning": "150", "default": 50, "visible": false, - "active_if": { - "setting": "prime_tower_enable", - "value": true - } + "enabled": "prime_tower_enable" } } }, @@ -56,16 +133,13 @@ "label": "Prime Tower Line Width", "description": "Width of a single prime tower line.", "unit": "mm", - "min_value": 0.0001, - "min_value_warning": 0.2, - "max_value_warning": 5, + "min_value": "0.0001", + "min_value_warning": "0.2", + "max_value_warning": "5", "default": 0.4, "type": "float", "visible": false, - "active_if": { - "setting": "prime_tower_enable", - "value": true - } + "enabled": "prime_tower_enable" } } } @@ -73,9 +147,56 @@ "categories": { "dual": { "label": "Dual Extrusion", - "visible": false, + "visible": true, "icon": "category_dual", "settings": { + "extruder_nr": { + "label": "Extruder", + "description": "The extruder train used for printing. This is used in multi-extrusion.", + "type": "int", + "default": 0, + "min_value": "0", + "max_value": "16", + "always_visible": true, + + "children": { + "adhesion_extruder_nr": { + "label": "Platform Adhesion Extruder", + "description": "The extruder train to use for printing the skirt/brim/raft. This is used in multi-extrusion.", + "type": "int", + "default": 0, + "min_value": "0", + "max_value": "16" + }, + "support_extruder_nr": { + "label": "Support Extruder", + "description": "The extruder train to use for printing the support. This is used in multi-extrusion.", + "type": "int", + "default": 0, + "min_value": "0", + "max_value": "16", + "children": { + "support_extruder_nr_layer_0": { + "label": "First Layer Support Extruder", + "description": "The extruder train to use for printing the first layer of support. This is used in multi-extrusion.", + "type": "int", + "default": 0, + "min_value": "0", + "max_value": "16" + }, + "support_roof_extruder_nr": { + "label": "Hammock Extruder", + "description": "The extruder train to use for printing the hammock. This is used in multi-extrusion.", + "type": "int", + "default": 0, + "min_value": "0", + "max_value": "16", + "enabled": "support_roof_enable" + } + } + } + } + }, "prime_tower_enable": { "label": "Enable Prime Tower", "description": "Print a tower next to the print which serves to prime the material after each nozzle switch.", @@ -89,13 +210,10 @@ "type": "float", "unit": "mm", "default": 15, - "min_value": 0, - "max_value_warning": 20, + "min_value": "0", + "max_value_warning": "20", "inherit_function": "0 if prime_tower_enable else 15", - "active_if": { - "setting": "prime_tower_enable", - "value": true - } + "enabled": "prime_tower_enable" }, "prime_tower_position_x": { "label": "Prime Tower X Position", @@ -104,10 +222,7 @@ "type": "float", "unit": "mm", "default": 200, - "active_if": { - "setting": "prime_tower_enable", - "value": true - } + "enabled": "prime_tower_enable" }, "prime_tower_position_y": { "label": "Prime Tower Y Position", @@ -116,10 +231,7 @@ "type": "float", "unit": "mm", "default": 200, - "active_if": { - "setting": "prime_tower_enable", - "value": true - } + "enabled": "prime_tower_enable" }, "prime_tower_flow": { "label": "Prime Tower Flow", @@ -128,23 +240,17 @@ "unit": "%", "default": 100, "type": "float", - "min_value": 5, - "min_value_warning": 50, - "max_value_warning": 150, - "active_if": { - "setting": "prime_tower_enable", - "value": true - } + "min_value": "5", + "min_value_warning": "50", + "max_value_warning": "150", + "enabled": "prime_tower_enable" }, "prime_tower_wipe_enabled": { "label": "Wipe Nozzle on Prime tower", "description": "After printing the prime tower with the one nozzle, wipe the oozed material from the other nozzle off on the prime tower.", "type": "boolean", "default": false, - "active_if": { - "setting": "prime_tower_enable", - "value": true - } + "enabled": "prime_tower_enable" }, "ooze_shield_enabled": { "label": "Enable Ooze Shield", @@ -157,41 +263,22 @@ "description": "The maximum angle a part in the ooze shield will have. With 0 degrees being vertical, and 90 degrees being horizontal. A smaller angle leads to less failed ooze shields, but more material.", "unit": "°", "type": "float", - "min_value": 0, - "max_value": 90, + "min_value": "0", + "max_value": "90", "default": 60, "visible": false, - "active_if": { - "setting": "ooze_shield_enabled", - "value": true - } + "enabled": "ooze_shield_enabled" }, "ooze_shield_dist": { "label": "Ooze Shields Distance", "description": "Distance of the ooze shield from the print, in the X/Y directions.", "unit": "mm", "type": "float", - "min_value": 0, - "max_value_warning": 30, + "min_value": "0", + "max_value_warning": "30", "default": 2, "visible": false, - "active_if": { - "setting": "ooze_shield_enabled", - "value": true - } - } - } - }, - "platform_adhesion": { - "settings": { - "adhesion_extruder_nr": { - "label": "Platform Adhesion Extruder", - "description": "The extruder train to use for printing the skirt/brim/raft. This is used in multi-extrusion.", - "type": "int", - "default": 0, - "min_value": 0, - "max_value": 16, - "inherit_function": "extruder_nr" + "enabled": "ooze_shield_enabled" } } }, @@ -205,10 +292,7 @@ "default": 16, "visible": false, "inherit_function": "machine_heat_zone_length", - "active_if": { - "setting": "retraction_enable", - "value": true - } + "enabled": "retraction_enable" }, "switch_extruder_retraction_speeds": { "label": "Nozzle Switch Retraction Speed", @@ -218,10 +302,7 @@ "default": 20, "visible": false, "inherit": false, - "active_if": { - "setting": "retraction_enable", - "value": true - }, + "enabled": "retraction_enable", "children": { "switch_extruder_retraction_speed": { "label": "Nozzle Switch Retract Speed", @@ -230,10 +311,7 @@ "type": "float", "default": 20, "visible": false, - "active_if": { - "setting": "retraction_enable", - "value": true - } + "enabled": "retraction_enable" }, "switch_extruder_prime_speed": { "label": "Nozzle Switch Prime Speed", @@ -242,47 +320,7 @@ "type": "float", "default": 20, "visible": false, - "active_if": { - "setting": "retraction_enable", - "value": true - } - } - } - } - } - }, - "support": { - "settings": { - "support_extruder_nr": { - "label": "Support Extruder", - "description": "The extruder train to use for printing the support. This is used in multi-extrusion.", - "type": "int", - "default": 0, - "min_value": 0, - "max_value": 16, - "inherit_function": "extruder_nr", - "children": { - "support_extruder_nr_layer_0": { - "label": "First Layer Support Extruder", - "description": "The extruder train to use for printing the first layer of support. This is used in multi-extrusion.", - "type": "int", - "default": 0, - "min_value": 0, - "max_value": 16, - "inherit": true - }, - "support_roof_extruder_nr": { - "label": "Hammock Extruder", - "description": "The extruder train to use for printing the hammock. This is used in multi-extrusion.", - "type": "int", - "default": 0, - "min_value": 0, - "max_value": 16, - "inherit": true, - "active_if": { - "setting": "support_roof_enable", - "value": true - } + "enabled": "retraction_enable" } } } From b23bbe02fd786f273c96ba2b9da0368650dc2004 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 6 Oct 2015 14:54:24 +0200 Subject: [PATCH 2/4] Send the dual extrusion file as base JSON to the engine --- plugins/CuraEngineBackend/CuraEngineBackend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index c612a6656c..85776d9dd6 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -84,7 +84,7 @@ class CuraEngineBackend(Backend): # This is usefull for debugging and used to actually start the engine # \return list of commands and args / parameters. def getEngineCommand(self): - return [Preferences.getInstance().getValue("backend/location"), "connect", "127.0.0.1:{0}".format(self._port), "-j", Resources.getPath(Resources.MachineDefinitions, "fdmprinter.json"), "-vv"] + return [Preferences.getInstance().getValue("backend/location"), "connect", "127.0.0.1:{0}".format(self._port), "-j", Resources.getPath(Resources.MachineDefinitions, "dual_extrusion_printer.json"), "-vv"] ## Emitted when we get a message containing print duration and material amount. This also implies the slicing has finished. # \param time The amount of time the print will take. From 50e6455875648197064c3824859c87831c030085 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 6 Oct 2015 16:54:57 +0200 Subject: [PATCH 3/4] Send the actual machine JSON to the engine --- plugins/CuraEngineBackend/CuraEngineBackend.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 85776d9dd6..25dd04030e 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -80,11 +80,13 @@ class CuraEngineBackend(Backend): Application.getInstance().getController().toolOperationStarted.connect(self._onToolOperationStarted) Application.getInstance().getController().toolOperationStopped.connect(self._onToolOperationStopped) + Application.getInstance().getMachineManager().activeMachineInstanceChanged.connect(self._onInstanceChanged) + ## Get the command that is used to call the engine. # This is usefull for debugging and used to actually start the engine # \return list of commands and args / parameters. def getEngineCommand(self): - return [Preferences.getInstance().getValue("backend/location"), "connect", "127.0.0.1:{0}".format(self._port), "-j", Resources.getPath(Resources.MachineDefinitions, "dual_extrusion_printer.json"), "-vv"] + return [Preferences.getInstance().getValue("backend/location"), "connect", "127.0.0.1:{0}".format(self._port), "-j", Application.getInstance().getMachineManager().getActiveMachineInstance().getMachineDefinition().getPath(), "-vv"] ## Emitted when we get a message containing print duration and material amount. This also implies the slicing has finished. # \param time The amount of time the print will take. @@ -125,6 +127,7 @@ class CuraEngineBackend(Backend): pass self.slicingCancelled.emit() return + Logger.log("d", "Preparing to send slice data to engine.") object_groups = [] if self._profile.getSettingValue("print_sequence") == "one_at_a_time": @@ -355,3 +358,14 @@ class CuraEngineBackend(Backend): setting = message.settings.add() setting.name = key setting.value = str(value).encode() + + def _onInstanceChanged(self): + self._slicing = False + self._restart = True + if self._process is not None: + Logger.log("d", "Killing engine process") + try: + self._process.terminate() + except: # terminating a process that is already terminating causes an exception, silently ignore this. + pass + self.slicingCancelled.emit() From 0dee306c7fc72db011e789871cd175bb5f193c6e Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 6 Oct 2015 16:55:31 +0200 Subject: [PATCH 4/4] Remove extruder_x_temperature options --- .../machines/dual_extrusion_printer.json | 90 ------------------- 1 file changed, 90 deletions(-) diff --git a/resources/machines/dual_extrusion_printer.json b/resources/machines/dual_extrusion_printer.json index d5d410161b..84d2dde40e 100644 --- a/resources/machines/dual_extrusion_printer.json +++ b/resources/machines/dual_extrusion_printer.json @@ -22,96 +22,6 @@ "machine_extruder_end_code": { "default": "", "SEE_machine_extruder_trains": true } }, "overrides": { - "material_print_temperature": { - "children": { - "extruder_0_print_temperature": { - "label": "Extruder 0 Print Temperature", - "description": "The temperature to use when printing with extruder 0", - "unit": "°C", - "type": "int", - "type": "float", - "default": 190, - "min_value": "0", - "max_value_warning": "260" - }, - "extruder_1_print_temperature": { - "label": "Extruder 1 Print Temperature", - "description": "The temperature to use when printing with extruder 1", - "unit": "°C", - "type": "int", - "type": "float", - "default": 190, - "min_value": "0", - "max_value_warning": "260" - }, - "extruder_2_print_temperature": { - "label": "Extruder 2 Print Temperature", - "description": "The temperature to use when printing with extruder 2", - "unit": "°C", - "type": "int", - "type": "float", - "default": 190, - "min_value": "0", - "max_value_warning": "260", - "visible": false - }, - "extruder_3_print_temperature": { - "label": "Extruder 0 Print Temperature", - "description": "The temperature to use when printing with extruder 3", - "unit": "°C", - "type": "int", - "type": "float", - "default": 190, - "min_value": "0", - "max_value_warning": "260", - "visible": false - }, - "extruder_4_print_temperature": { - "label": "Extruder 4 Print Temperature", - "description": "The temperature to use when printing with extruder 4", - "unit": "°C", - "type": "int", - "type": "float", - "default": 190, - "min_value": "0", - "max_value_warning": "260", - "visible": false - }, - "extruder_5_print_temperature": { - "label": "Extruder 5 Print Temperature", - "description": "The temperature to use when printing with extruder 5", - "unit": "°C", - "type": "int", - "type": "float", - "default": 190, - "min_value": "0", - "max_value_warning": "260", - "visible": false - }, - "extruder_6_print_temperature": { - "label": "Extruder 6 Print Temperature", - "description": "The temperature to use when printing with extruder 6", - "unit": "°C", - "type": "int", - "type": "float", - "default": 190, - "min_value": "0", - "max_value_warning": "260", - "visible": false - }, - "extruder_7_print_temperature": { - "label": "Extruder 7 Print Temperature", - "description": "The temperature to use when printing with extruder 7", - "unit": "°C", - "type": "int", - "type": "float", - "default": 190, - "min_value": "0", - "max_value_warning": "260", - "visible": false - } - } - }, "speed_print": { "children": { "speed_prime_tower": {