mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Merge branch 'TIme-Lapse' of https://github.com/GregValiant/Cura into TIme-Lapse
This commit is contained in:
commit
35775ce3c8
152 changed files with 17737 additions and 127 deletions
|
@ -26,27 +26,40 @@ class InsertAtLayerChange(Script):
|
|||
},
|
||||
"gcode_to_add":
|
||||
{
|
||||
"label": "G-code to insert.",
|
||||
"label": "G-code to insert",
|
||||
"description": "G-code to add before or after layer change.",
|
||||
"type": "str",
|
||||
"default_value": ""
|
||||
},
|
||||
"skip_layers":
|
||||
{
|
||||
"label": "Skip layers",
|
||||
"description": "Number of layers to skip between insertions (0 for every layer).",
|
||||
"type": "int",
|
||||
"default_value": 0,
|
||||
"minimum_value": 0
|
||||
}
|
||||
}
|
||||
}"""
|
||||
|
||||
def execute(self, data):
|
||||
gcode_to_add = self.getSettingValueByKey("gcode_to_add") + "\n"
|
||||
skip_layers = self.getSettingValueByKey("skip_layers")
|
||||
count = 0
|
||||
for layer in data:
|
||||
# Check that a layer is being printed
|
||||
lines = layer.split("\n")
|
||||
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
|
||||
if count == 0:
|
||||
if self.getSettingValueByKey("insert_location") == "before":
|
||||
layer = gcode_to_add + layer
|
||||
else:
|
||||
layer = layer + gcode_to_add
|
||||
|
||||
data[index] = layer
|
||||
data[index] = layer
|
||||
|
||||
count = (count + 1) % (skip_layers + 1)
|
||||
break
|
||||
return data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue