From 6139f90bcadf44bab3e04ea04976d73e1f319f91 Mon Sep 17 00:00:00 2001 From: daid303 Date: Fri, 8 Mar 2013 10:49:40 +0100 Subject: [PATCH] Fix for the pauze at Z plugin, when using multiple pauses below 15mm it was seeing the up-move as the pause point for the next pause. --- Cura/plugins/pauseAtZ.py | 11 ++++++++++- Cura/util/gcodeInterpreter.py | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Cura/plugins/pauseAtZ.py b/Cura/plugins/pauseAtZ.py index 1771e03f..745ec6e6 100644 --- a/Cura/plugins/pauseAtZ.py +++ b/Cura/plugins/pauseAtZ.py @@ -30,16 +30,22 @@ y = 0 pauseState = 0 with open(filename, "w") as f: for line in lines: + if line.startswith(';'): + if line.startswith(';TYPE:'): + currentSectionType = line[6:].strip() + f.write(line) + continue if getValue(line, 'G', None) == 1: newZ = getValue(line, 'Z', z) x = getValue(line, 'X', x) y = getValue(line, 'Y', y) - if newZ != z: + if newZ != z and currentSectionType != 'CUSTOM': z = newZ if z < pauseLevel and pauseState == 0: pauseState = 1 if z >= pauseLevel and pauseState == 1: pauseState = 2 + f.write(";TYPE:CUSTOM\n") #Retract f.write("M83\n") f.write("G1 E-%f F6000\n" % (retractAmount)) @@ -49,6 +55,9 @@ with open(filename, "w") as f: f.write("G1 Z15 F300\n") #Wait till the user continues printing f.write("M0\n") + #Push the filament back, and retract again, the properly primes the nozzle when changing filament. + f.write("G1 E%f F6000\n" % (retractAmount)) + f.write("G1 E-%f F6000\n" % (retractAmount)) #Move the head back f.write("G1 X%f Y%f F9000\n" % (x, y)) f.write("G1 E%f F6000\n" % (retractAmount)) diff --git a/Cura/util/gcodeInterpreter.py b/Cura/util/gcodeInterpreter.py index c9a2b3ea..eee6758b 100644 --- a/Cura/util/gcodeInterpreter.py +++ b/Cura/util/gcodeInterpreter.py @@ -214,7 +214,9 @@ class gcode(object): else: M = self.getCodeInt(line, 'M') if M is not None: - if M == 1: #Message with possible wait (ignored) + if M == 0: #Message with possible wait (ignored) + pass + elif M == 1: #Message with possible wait (ignored) pass elif M == 80: #Enable power supply pass -- 2.30.2