mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -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,
|
||||
"settings":
|
||||
{
|
||||
"insert_loc":
|
||||
"insert_location":
|
||||
{
|
||||
"label": "When to insert",
|
||||
"description": "Whether to insert code before or after layer change.",
|
||||
|
@ -33,19 +33,13 @@ class InsertAtLayerChange(Script):
|
|||
}"""
|
||||
|
||||
def execute(self, data):
|
||||
in_layer = False
|
||||
gcode_to_add = self.getSettingValueByKey("gcode_to_add") + "\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)
|
||||
if self.getSettingValueByKey("insert_loc") == "before":
|
||||
if self.getSettingValueByKey("insert_location") == "before":
|
||||
layer = gcode_to_add + layer
|
||||
else:
|
||||
layer = layer + gcode_to_add
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue