mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-05 13:03:59 -06:00
Make suggested changes to post processing scripts
Contributes to CURA-5713.
This commit is contained in:
parent
b913dd9702
commit
9396628170
2 changed files with 5 additions and 17 deletions
|
@ -14,7 +14,7 @@ class InsertAtLayerChange(Script):
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"settings":
|
"settings":
|
||||||
{
|
{
|
||||||
"insert_loc":
|
"insert_location":
|
||||||
{
|
{
|
||||||
"label": "When to insert",
|
"label": "When to insert",
|
||||||
"description": "Whether to insert code before or after layer change.",
|
"description": "Whether to insert code before or after layer change.",
|
||||||
|
@ -33,19 +33,13 @@ class InsertAtLayerChange(Script):
|
||||||
}"""
|
}"""
|
||||||
|
|
||||||
def execute(self, data):
|
def execute(self, data):
|
||||||
in_layer = False
|
|
||||||
gcode_to_add = self.getSettingValueByKey("gcode_to_add") + "\n"
|
gcode_to_add = self.getSettingValueByKey("gcode_to_add") + "\n"
|
||||||
for layer in data:
|
for layer in data:
|
||||||
# Check that a layer is being printed
|
# Check that a layer is being printed
|
||||||
lines = layer.split("\n")
|
lines = layer.split("\n")
|
||||||
if ";LAYER:" in lines[0]:
|
if ";LAYER:" in lines[0]:
|
||||||
in_layer = True
|
|
||||||
else:
|
|
||||||
in_layer = False
|
|
||||||
|
|
||||||
if in_layer:
|
|
||||||
index = data.index(layer)
|
index = data.index(layer)
|
||||||
if self.getSettingValueByKey("insert_loc") == "before":
|
if self.getSettingValueByKey("insert_location") == "before":
|
||||||
layer = gcode_to_add + layer
|
layer = gcode_to_add + layer
|
||||||
else:
|
else:
|
||||||
layer = layer + gcode_to_add
|
layer = layer + gcode_to_add
|
||||||
|
|
|
@ -14,7 +14,7 @@ class TimeLapse(Script):
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"settings":
|
"settings":
|
||||||
{
|
{
|
||||||
"trigger_cmd":
|
"trigger_command":
|
||||||
{
|
{
|
||||||
"label": "Trigger camera command",
|
"label": "Trigger camera command",
|
||||||
"description": "Gcode command used to trigger camera.",
|
"description": "Gcode command used to trigger camera.",
|
||||||
|
@ -68,30 +68,24 @@ class TimeLapse(Script):
|
||||||
}"""
|
}"""
|
||||||
|
|
||||||
def execute(self, data):
|
def execute(self, data):
|
||||||
in_layer = False
|
|
||||||
feed_rate = self.getSettingValueByKey("park_feed_rate")
|
feed_rate = self.getSettingValueByKey("park_feed_rate")
|
||||||
park_print_head = self.getSettingValueByKey("park_print_head")
|
park_print_head = self.getSettingValueByKey("park_print_head")
|
||||||
x_park = self.getSettingValueByKey("head_park_x")
|
x_park = self.getSettingValueByKey("head_park_x")
|
||||||
y_park = self.getSettingValueByKey("head_park_y")
|
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")
|
pause_length = self.getSettingValueByKey("pause_length")
|
||||||
gcode_to_append = ";TimeLapse Begin\n"
|
gcode_to_append = ";TimeLapse Begin\n"
|
||||||
|
|
||||||
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, 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 += 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 += self.putValue(G = 4, P = pause_length) + ";Wait for camera\n"
|
||||||
gcode_to_append += ";TimeLapse End\n"
|
gcode_to_append += ";TimeLapse End\n"
|
||||||
for layer in data:
|
for layer in data:
|
||||||
# Check that a layer is being printed
|
# Check that a layer is being printed
|
||||||
lines = layer.split("\n")
|
lines = layer.split("\n")
|
||||||
if ";LAYER:" in lines[0]:
|
if ";LAYER:" in lines[0]:
|
||||||
in_layer = True
|
|
||||||
else:
|
|
||||||
in_layer = False
|
|
||||||
|
|
||||||
if in_layer:
|
|
||||||
index = data.index(layer)
|
index = data.index(layer)
|
||||||
layer += gcode_to_append
|
layer += gcode_to_append
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue