diff --git a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py index 50d365da0b..80208d2150 100644 --- a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py +++ b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py @@ -4,6 +4,8 @@ from ..Script import Script from UM.Application import Application #To get the current printer's settings. +from UM.Logger import Logger + from typing import List, Tuple class PauseAtHeight(Script): @@ -152,6 +154,7 @@ class PauseAtHeight(Script): # use offset to calculate the current height: = - layer_0_z = 0 current_z = 0 + current_f = 0 got_first_g_cmd_on_layer_0 = False current_t = 0 #Tracks the current extruder for tracking the target temperature. target_temperature = {} #Tracks the current target temperature for each extruder. @@ -185,6 +188,10 @@ class PauseAtHeight(Script): if not layers_started: continue + # If a F instruction is in the line, read the current F + if self.getValue(line, "F") is not None: + current_f = self.getValue(line, "F") + # If a Z instruction is in the line, read the current Z if self.getValue(line, "Z") is not None: current_z = self.getValue(line, "Z") @@ -320,7 +327,12 @@ class PauseAtHeight(Script): prepend_gcode += self.putValue(G = 11) + "\n" else: prepend_gcode += self.putValue(G = 1, E = retraction_amount, F = retraction_speed * 60) + "\n" - prepend_gcode += self.putValue(G = 1, F = 9000) + "\n" + + if current_f != 0: + prepend_gcode += self.putValue(G = 1, F = current_f) + "\n" + else: + Logger.log("w", "No previous feedrate found in gcode, feedrate for next layer(s) might be incorrect") + prepend_gcode += self.putValue(M = 82) + " ; switch back to absolute E values\n" # reset extrude value to pre pause value