From 6934c3f88101da6c5e13603d3bd40c652c198564 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 26 Feb 2018 09:54:42 +0100 Subject: [PATCH] Use self.putValue to write g-code Mostly as a test of this function. Seems to work. --- .../scripts/PauseAtHeight.py | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py index 3367f85a77..a1159f8051 100644 --- a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py +++ b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py @@ -204,51 +204,51 @@ class PauseAtHeight(Script): prepend_gcode += ";current layer: {layer}\n".format(layer = current_layer) # Retraction - prepend_gcode += "M83\n" + prepend_gcode += self.putValue(M = 83) + "\n" if retraction_amount != 0: - prepend_gcode += "G1 E-%f F%f\n" % (retraction_amount, retraction_speed * 60) + prepend_gcode += self.putValue(G = 1, E = -retraction_amount, F = retraction_speed * 60) + "\n" # Move the head away - prepend_gcode += "G1 Z%f F300\n" % (current_z + 1) - prepend_gcode += "G1 X%f Y%f F9000\n" % (park_x, park_y) + prepend_gcode += self.putValue(G = 1, Z = current_z + 1, F = 300) + "\n" + prepend_gcode += self.putValue(G = 1, X = park_x, Y = park_y, F = 9000) + "\n" if current_z < 15: - prepend_gcode += "G1 Z15 F300\n" + prepend_gcode += self.putValue(G = 1, Z = 15, F = 300) + "\n" # Disable the E steppers - prepend_gcode += "M84 E0\n" + prepend_gcode += self.putValue(M = 84, E = 0) + "\n" # Set extruder standby temperature - prepend_gcode += "M104 S%i; standby temperature\n" % (standby_temperature) + prepend_gcode += self.putValue(M = 104, S = standby_temperature) + "; standby temperature\n" # Wait till the user continues printing - prepend_gcode += "M0 ;Do the actual pause\n" + prepend_gcode += self.putValue(M = 0) + ";Do the actual pause\n" # Set extruder resume temperature - prepend_gcode += "M109 S%i; resume temperature\n" % (resume_temperature) + prepend_gcode += self.putValue(M = 109, S = resume_temperature) + "; resume temperature\n" # Push the filament back, if retraction_amount != 0: - prepend_gcode += "G1 E%f F%f\n" % (retraction_amount, retraction_speed * 60) + prepend_gcode += self.putValue(G = 1, E = retraction_amount, F = retraction_speed * 60) + "\n" # Optionally extrude material if extrude_amount != 0: - prepend_gcode += "G1 E%f F%f\n" % (extrude_amount, extrude_speed * 60) + prepend_gcode += self.putValue(G = 1, E = extrude_amount, F = extrude_speed * 60) + "\n" # and retract again, the properly primes the nozzle # when changing filament. if retraction_amount != 0: - prepend_gcode += "G1 E-%f F%f\n" % (retraction_amount, retraction_speed * 60) + prepend_gcode += self.putValue(G = 1, E = -retraction_amount, F = retraction_speed * 60) + "\n" # Move the head back - prepend_gcode += "G1 Z%f F300\n" % (current_z + 1) - prepend_gcode += "G1 X%f Y%f F9000\n" % (x, y) + prepend_gcode += self.putValue(G = 1, Z = current_z + 1, F = 300) + "\n" + prepend_gcode += self.putValue(G = 1, X = x, Y = y, F = 9000) + "\n" if retraction_amount != 0: - prepend_gcode += "G1 E%f F%f\n" % (retraction_amount, retraction_speed * 60) - prepend_gcode += "G1 F9000\n" - prepend_gcode += "M82\n" + prepend_gcode += self.putValue(G = 1, E = retraction_amount, F = retraction_speed * 60) + "\n" + prepend_gcode += self.putValue(G = 1, F = 9000) + "\n" + prepend_gcode += self.putValue(M = 82) + "\n" # reset extrude value to pre pause value - prepend_gcode += "G92 E%f\n" % (current_e) + prepend_gcode += self.putValue(G = 92, E = current_e) + "\n" layer = prepend_gcode + layer