Make suggested changes to post processing scripts

Contributes to CURA-5713.
This commit is contained in:
Diego Prado Gesto 2019-03-08 15:46:21 +01:00
parent b913dd9702
commit 9396628170
2 changed files with 5 additions and 17 deletions

View file

@ -14,7 +14,7 @@ class TimeLapse(Script):
"version": 2,
"settings":
{
"trigger_cmd":
"trigger_command":
{
"label": "Trigger camera command",
"description": "Gcode command used to trigger camera.",
@ -68,30 +68,24 @@ class TimeLapse(Script):
}"""
def execute(self, data):
in_layer = False
feed_rate = self.getSettingValueByKey("park_feed_rate")
park_print_head = self.getSettingValueByKey("park_print_head")
x_park = self.getSettingValueByKey("head_park_x")
y_park = self.getSettingValueByKey("head_park_y")
trigger_cmd = self.getSettingValueByKey("trigger_cmd")
trigger_command = self.getSettingValueByKey("trigger_command")
pause_length = self.getSettingValueByKey("pause_length")
gcode_to_append = ";TimeLapse Begin\n"
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(M = 400) + ";Wait for moves to finish\n"
gcode_to_append += trigger_cmd + ";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 += ";TimeLapse End\n"
for layer in data:
# Check that a layer is being printed
lines = layer.split("\n")
if ";LAYER:" in lines[0]:
in_layer = True
else:
in_layer = False
if in_layer:
index = data.index(layer)
layer += gcode_to_append