my printer use a lerdge 2 in 1-s1 hotend and i need to create the gcode routine to swtich material, im making a custom post processor to do that, im not done but my code wont appear on the list, here is the code
import re #To perform the search and replace.
from ..Script import Script
class switchMaterial(Script):
"""switch Material
"""
def getSettingDataString(self):
return """{
"name": "switch material",
"key": "switch_Material",
"metadata": {},
"version": 1,
"settings":
{
"retraction":
{
"label": "retraction",
"description": "Amount of retraction to get the previous filament out of the way",
"type": "float",
"default_value": "40.0"
}
"speed":
{
"label": "speed",
"description": "Speed of retraction",
"type": "integer",
"default_value": "200"
}
}
}"""
def execute(self, data):
retraction = self.getSettingDataString("retraction")
speed = self.getSettingDataString("speed")
pre_fix = "\nT"
firstTime = True
current_tool = 0
last_position = 0
text = ""
for layer_number, layer in enumerate(data):
for ocurrence in re.finditer(pre_fix,layer):
current_tool = int(layer[ocurrence.end()])
if firstTime:
firstTime = False
text = layer[:ocurrence.start()]
if current_tool == 1:
text += "T0\nM104 S{material_print_temperature, 0}\nM105\nM109 S{material_print_temperature, 0}\nM83\nG0 X0 Y0\nG0 E-%.2f F%i\nT1\n"%(retraction,speed)
last_position = ocurrence.end()
else:
if current_tool == 0:
text = layer[:ocurrence.start()]
else:
text = layer[:ocurrence.start()]
data[layer_number] = text #Replace all.
return data
i dont know why it isnt showing, i try put on ...\AppData\Roaming\cura\4.12\scripts and on C:\Program Files\Ultimaker Cura 4.12.1\plugins\PostProcessingPlugin\scripts, but nothing worka and yes i close and open cura to update the list, already try restarting the pc