Fixed wrong extrusion (issue #6730)

This commit is contained in:
Matt Jani 2020-01-28 15:26:43 +01:00
parent b25d6360ab
commit f62312449b

View file

@ -2,6 +2,7 @@
from ..Script import Script from ..Script import Script
class TimeLapse(Script): class TimeLapse(Script):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
@ -75,21 +76,30 @@ class TimeLapse(Script):
trigger_command = self.getSettingValueByKey("trigger_command") trigger_command = self.getSettingValueByKey("trigger_command")
pause_length = self.getSettingValueByKey("pause_length") pause_length = self.getSettingValueByKey("pause_length")
gcode_to_append = ";TimeLapse Begin\n" gcode_to_append = ";TimeLapse Begin\n"
last_x = 0
last_y = 0
if park_print_head: if park_print_head:
gcode_to_append += self.putValue(G = 1, F = feed_rate, X = x_park, Y = y_park) + " ;Park print head\n" gcode_to_append += self.putValue(G=1, F=feed_rate,
gcode_to_append += self.putValue(M = 400) + " ;Wait for moves to finish\n" X=x_park, Y=y_park) + " ;Park print head\n"
gcode_to_append += self.putValue(M=400) + " ;Wait for moves to finish\n"
gcode_to_append += trigger_command + " ;Snap Photo\n" gcode_to_append += trigger_command + " ;Snap Photo\n"
gcode_to_append += self.putValue(G = 4, P = pause_length) + " ;Wait for camera\n" gcode_to_append += self.putValue(G=4, P=pause_length) + " ;Wait for camera\n"
gcode_to_append += ";TimeLapse End\n" gcode_to_append += self.putValue()
for layer in data:
for idx, layer in enumerate(data):
for line in layer.split("\n"):
if self.getValue(line, "G") in {0, 1}: # Track X,Y location.
last_x = self.getValue(line, "X", last_x)
last_y = self.getValue(line, "Y", last_y)
# Check that a layer is being printed # Check that a layer is being printed
lines = layer.split("\n") lines = layer.split("\n")
for line in lines: for line in lines:
if ";LAYER:" in line: if ";LAYER:" in line:
index = data.index(layer)
layer += gcode_to_append layer += gcode_to_append
data[index] = layer layer += "G0 X" + str(last_x) + " Y" + str(last_y)+"\n"
data[idx] = layer
break break
return data return data