From 2fa4230d1c57dd6888012c192367d040109bf13e Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Tue, 24 Sep 2019 16:11:00 +0200 Subject: [PATCH] Only consider feedrates for extrusions (Pause At Height) CURA-6799 --- .../PostProcessingPlugin/scripts/PauseAtHeight.py | 12 ++++++------ .../scripts/PauseAtHeightforRepetier.py | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py index 80208d2150..655aee3a4f 100644 --- a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py +++ b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py @@ -154,7 +154,7 @@ class PauseAtHeight(Script): # use offset to calculate the current height: = - layer_0_z = 0 current_z = 0 - current_f = 0 + current_extrusion_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. @@ -188,9 +188,9 @@ 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") + # Look for the feed rate of an extrusion instruction + if self.getValue(line, "F") is not None and self.getValue(line, "E") is not None: + current_extrusion_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: @@ -328,8 +328,8 @@ class PauseAtHeight(Script): else: prepend_gcode += self.putValue(G = 1, E = retraction_amount, F = retraction_speed * 60) + "\n" - if current_f != 0: - prepend_gcode += self.putValue(G = 1, F = current_f) + "\n" + if current_extrusion_f != 0: + prepend_gcode += self.putValue(G = 1, F = current_extrusion_f) + " ; restore extrusion feedrate\n" else: Logger.log("w", "No previous feedrate found in gcode, feedrate for next layer(s) might be incorrect") diff --git a/plugins/PostProcessingPlugin/scripts/PauseAtHeightforRepetier.py b/plugins/PostProcessingPlugin/scripts/PauseAtHeightforRepetier.py index 685618a04e..0353574289 100644 --- a/plugins/PostProcessingPlugin/scripts/PauseAtHeightforRepetier.py +++ b/plugins/PostProcessingPlugin/scripts/PauseAtHeightforRepetier.py @@ -74,7 +74,7 @@ class PauseAtHeightforRepetier(Script): def execute(self, data): x = 0. y = 0. - current_f = 0 + current_extrusion_f = 0 current_z = 0. pause_z = self.getSettingValueByKey("pause_height") retraction_amount = self.getSettingValueByKey("retraction_amount") @@ -96,10 +96,11 @@ class PauseAtHeightforRepetier(Script): if self.getValue(line, 'G') == 1 or self.getValue(line, 'G') == 0: current_z = self.getValue(line, 'Z') - current_f = self.getValue(line, 'F', current_f) + if self.getValue(line, 'F') is not None and self.getValue(line, 'E') is not None: + current_extrusion_f = self.getValue(line, 'F', current_extrusion_f) x = self.getValue(line, 'X', x) y = self.getValue(line, 'Y', y) - if current_z != None: + if current_z is not None: if current_z >= pause_z: index = data.index(layer) @@ -154,8 +155,8 @@ class PauseAtHeightforRepetier(Script): if retraction_amount != 0: prepend_gcode +="G1 E%f F6000\n" % (retraction_amount) - if current_f != 0: - prepend_gcode += self.putValue(G=1, F=current_f) + "\n" + if current_extrusion_f != 0: + prepend_gcode += self.putValue(G=1, F=current_extrusion_f) + " ; restore extrusion feedrate\n" else: Logger.log("w", "No previous feedrate found in gcode, feedrate for next layer(s) might be incorrect")