From 725d1026ddeee535c4b19abd983228378fb88181 Mon Sep 17 00:00:00 2001 From: Greg Valiant <> Date: Thu, 26 Jan 2023 13:15:09 +0100 Subject: [PATCH] Revised PauseAtHeight.py. The changes are: For non-Repetier and non-Ultimaker printers - Move the prime extrusion so it occurs while the print head is still in the parked position so the blob doesn't happen over the print (GitHub #13584 and #11471 for reference). Add a user option to use M104 or M109 for the resume temperature to avoid an unnecessary delay if the resume temperature is the same as the standby temperature. committed as part of CURA-9822 --- .../scripts/PauseAtHeight.py | 45 ++++++++++++------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py index 82b7ba1359..7f8d1d118a 100644 --- a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py +++ b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py @@ -1,6 +1,10 @@ -# Copyright (c) 2021 Ultimaker B.V. +# Copyright (c) 2023 UltiMaker # Cura is released under the terms of the LGPLv3 or higher. +# Revised by GregValiant 10-17-2022 +# Changed "extrude" line to before the nozzle moves back to the print (if not Repetier or Griffin). +# Add M104 option for Resume temperature + from ..Script import Script import re from UM.Application import Application #To get the current printer's settings. @@ -42,7 +46,7 @@ class PauseAtHeight(Script): "pause_layer": { "label": "Pause Layer", - "description": "At what layer should the pause occur?", + "description": "Enter the Number of the LAST layer you want to finish prior to the pause (from the Cura preview).", "type": "int", "value": "math.floor((pause_height - 0.27) / 0.1) + 1", "minimum_value": "0", @@ -156,6 +160,14 @@ class PauseAtHeight(Script): "type": "bool", "default_value": false }, + "standby_wait_for_temperature_enabled": + { + "label": "Use M109 for standby temperature? (M104 when false)", + "description": "Wait for hot end after Resume? (If your standby temperature is lower than the Printing temperature CHECK and use M109", + "type": "bool", + "default_value": true, + "enabled": "pause_method not in [\\\"griffin\\\", \\\"repetier\\\"]" + }, "standby_temperature": { "label": "Standby Temperature", @@ -220,14 +232,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. Separate multiple commands with a comma.", + "description": "Custom g-code to run before the pause. EX: M300 to beep. Use a comma to separate multiple commands. EX: M400,M300,M117 Pause", "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. Separate multiple commands with a comma.", + "description": "Custom g-code to run after the pause. Use a comma to separate multiple commands. EX: M204 X8 Y8,M106 S0,M117 Resume", "type": "str", "default_value": "" } @@ -279,6 +291,7 @@ class PauseAtHeight(Script): move_z = self.getSettingValueByKey("head_move_z") layers_started = False redo_layer = self.getSettingValueByKey("redo_layer") + standby_wait_for_temperature_enabled = self.getSettingValueByKey("standby_wait_for_temperature_enabled") standby_temperature = self.getSettingValueByKey("standby_temperature") firmware_retract = Application.getInstance().getGlobalContainerStack().getProperty("machine_firmware_retract", "value") control_temperatures = Application.getInstance().getGlobalContainerStack().getProperty("machine_nozzle_temp_enabled", "value") @@ -530,19 +543,23 @@ class PauseAtHeight(Script): elif pause_method != "griffin": if control_temperatures: # Set extruder resume temperature - prepend_gcode += self.putValue(M = 109, S = int(target_temperature.get(current_t, 0))) + " ; resume temperature\n" + if standby_wait_for_temperature_enabled: + WFT_numeric = 109 + Temp_resume_Text = " ; WAIT for resume temperature\n" + else: + WFT_numeric = 104 + Temp_resume_Text = " ; resume temperature\n" + + prepend_gcode += self.putValue(M=WFT_numeric, + S=int(target_temperature.get(current_t, 0))) + Temp_resume_Text if extrude_amount != 0: # Need to prime after the pause. # Push the filament back. - if retraction_amount != 0: - prepend_gcode += self.putValue(G = 1, E = retraction_amount, F = retraction_speed * 60) + "\n" + if extrude_speed == 0: + extrude_speed = 25 - # Prime the material. - prepend_gcode += self.putValue(G = 1, E = extrude_amount, F = extrude_speed * 60) + "; Extra extrude after the unpause\n" - - # And retract again to make the movements back to the starting position. - if retraction_amount != 0: - prepend_gcode += self.putValue(G = 1, E = -retraction_amount, F = retraction_speed * 60) + "\n" + if extrude_amount != 0: + prepend_gcode += self.putValue(G=1, E=extrude_amount, F=extrude_speed * 60) + "\n" # Move the head back if park_enabled: @@ -556,8 +573,6 @@ class PauseAtHeight(Script): retraction_count = 1 if control_temperatures else 3 #Retract more if we don't control the temperature. for i in range(retraction_count): prepend_gcode += self.putValue(G = 11) + "\n" - else: - prepend_gcode += self.putValue(G = 1, E = retraction_amount, F = retraction_speed * 60) + "\n" if current_extrusion_f != 0: prepend_gcode += self.putValue(G = 1, F = current_extrusion_f) + " ; restore extrusion feedrate\n"