Closed RedPetroleum closed 5 years ago
This solves it.
`def getSettingDataString(self):
return """{
"name":"Sloped Z hop",
"key": "SlopedZhop",
"metadata": {},
"version": 2,
"settings":
{
"my_retraction_speed":
{
"label": "Retraction speed",
"description": "Must be different to prime speed!",
"unit": "mm",
"type": "float",
"default_value": 42.0
}
}
}"""
def execute(self, data: list):
speed = self.getSettingValueByKey("my_retraction_speed")
myspeed = speed * 60
for index, layer in enumerate(data):
mylayer = ""
retract = 0
lines = layer.split("\n")
# Scroll each line of each layer in the G-code
for line in lines:
if mylayer is not "": #first line of layer
mylayer += "\n"
if retract == 1 and self.getValue(line, "G") == 1:
mylayer += ";Z LIFT DELETED"
retract = 0
elif self.getValue(line, "F") == myspeed:
retract = 1 #Z lift will be deleted next line
mylayer += line
else:
mylayer += line
data[index] = mylayer
return data`
Application Version 3.4.1
Platform MacOS 10.13.6
I would like to make my own post processing script to implement the suggested Sloped Z Hop: #2761
My approach was to just delete the gcode line (line 2) after a retraction. Since the next line already has the z hight (line 3):
G1 F2940 E43.94278
G1 F300 Z0.4
G0 F3600 X100.763 Y104.582 Z0.4
To filter a retraction I set the retraction speed to the specific value of 49 mm/s which translates to F2940 (line 1) while the prime speed is 50mm/s.Here is the function that I replaced in the preinstalled FilamentChange script:
def execute(self, data):
Unfortunately this doesn't do anything. I don't know much about coding and I would be really happy if someone could help my out with that.