Fix the insert & timelapse script so that you can use both at the same time

CURA-5713
This commit is contained in:
Jaime van Kessel 2019-03-13 13:28:10 +01:00
parent 4756e8b7bc
commit 72eb90c7c1
2 changed files with 15 additions and 13 deletions

View file

@ -37,13 +37,14 @@ class InsertAtLayerChange(Script):
for layer in data:
# Check that a layer is being printed
lines = layer.split("\n")
if ";LAYER:" in lines[0]:
index = data.index(layer)
if self.getSettingValueByKey("insert_location") == "before":
layer = gcode_to_add + layer
else:
layer = layer + gcode_to_add
data[index] = layer
for line in lines:
if ";LAYER:" in line:
index = data.index(layer)
if self.getSettingValueByKey("insert_location") == "before":
layer = gcode_to_add + layer
else:
layer = layer + gcode_to_add
data[index] = layer
break
return data