From cd0846fad25be6af91736c1e3032365f44c4f60c Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Mon, 26 Feb 2018 11:49:51 +0100 Subject: [PATCH] PostProcessing plugi, script Pause at Height redo layers gives incorrect E-values CURA-4670 --- .../PostProcessingPlugin/scripts/PauseAtHeight.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py index 1414593040..10de2fa318 100644 --- a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py +++ b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py @@ -187,6 +187,9 @@ class PauseAtHeight(Script): prevLayer = data[index - 1] prevLines = prevLayer.split("\n") current_e = 0. + + # Access last layer, browse it backwards to find + # last extruder absolute position for prevLine in reversed(prevLines): current_e = self.getValue(prevLine, "E", -1) if current_e >= 0: @@ -197,6 +200,18 @@ class PauseAtHeight(Script): prevLayer = data[index - i] layer = prevLayer + layer + # Get extruder's absolute position at the + # begining of the first layer redone + # see https://github.com/nallath/PostProcessingPlugin/issues/55 + if i == redo_layers: + prevLines = prevLayer.split("\n") + for line in prevLines: + new_e = self.getValue(line, 'E', current_e) + + if new_e != current_e: + current_e = new_e + break + prepend_gcode = ";TYPE:CUSTOM\n" prepend_gcode += ";added code by post processing\n" prepend_gcode += ";script: PauseAtHeight.py\n"