From 7a3aa87232cb2ca332dd0886ddabce858cfa8515 Mon Sep 17 00:00:00 2001 From: Michael Sims Date: Fri, 9 Sep 2022 15:44:48 -0700 Subject: [PATCH] Added ability to have multiple gcode commands before and after pausing print job --- .gitignore | 1 + plugins/PostProcessingPlugin/scripts/PauseAtHeight.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 26fe1ccf4a..4c3dd810e8 100644 --- a/.gitignore +++ b/.gitignore @@ -99,3 +99,4 @@ conanbuildinfo.txt graph_info.json Ultimaker-Cura.spec .run/ +/cmake-build-debug/ diff --git a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py index 5923a53adf..916eaa2865 100644 --- a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py +++ b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py @@ -2,7 +2,7 @@ # Cura is released under the terms of the LGPLv3 or higher. from ..Script import Script - +import re from UM.Application import Application #To get the current printer's settings. from UM.Logger import Logger @@ -195,14 +195,14 @@ class PauseAtHeight(Script): "custom_gcode_before_pause": { "label": "G-code Before Pause", - "description": "Any custom g-code to run before the pause, for example, M300 S440 P200 to beep.", + "description": "Any custom g-code to run before the pause, for example, M300 S440 P200 to beep. Separate multiple commands with a comma.", "type": "str", "default_value": "" }, "custom_gcode_after_pause": { "label": "G-code After Pause", - "description": "Any custom g-code to run after the pause, for example, M300 S440 P200 to beep.", + "description": "Any custom g-code to run after the pause, for example, M300 S440 P200 to beep. Separate multiple commands with a comma.", "type": "str", "default_value": "" } @@ -258,8 +258,8 @@ class PauseAtHeight(Script): 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") - gcode_before = self.getSettingValueByKey("custom_gcode_before_pause") - gcode_after = self.getSettingValueByKey("custom_gcode_after_pause") + gcode_before = re.sub("\\s*,\\s*", "\n", self.getSettingValueByKey("custom_gcode_before_pause")) + gcode_after = re.sub("\\s*,\\s*", "\n", self.getSettingValueByKey("custom_gcode_after_pause")) pause_method = self.getSettingValueByKey("pause_method") pause_command = {