I’ve decided to go back to Cura as my main slicer since they have fixed the (not)random z.seam function, wich was the reason I abbandoned Cura years ago.
Anyways. I would like cura to print 1 or 2 purge lines depending on if both extruders are used in the gcode or only 1.
I can figure out how to make a small gcode for extruder 1 and another for extruder 2, but where do I put them and how can I make it so I don’t have to purge both extruders extruders if only 1 is being used?
I don’t know how to specifically achieve what you described but… I used to use a skirt for that. Just be aware that if both extruders are set somewhere in the settings, even if not used, both will be primed. E.g. Print only with T0, support is enabled and set to T1 but there is no support needed. A skirt will be printed with T1 (and T0 as expected).
@obertini Thanks for the information. I would really like the purge lines though
I asked chat gpt for a suggestion and got the code bellow. I’ll try it out tomorrow…
Filename: ToolDetection.py
from typing import List
from …Script import Script
class ToolDetection(Script):
def __init__(self):
super().__init__()
def getSettingDataString(self):
return """{
"name": "Tool Detection",
"key": "ToolDetection",
"metadata": {},
"version": 2,
"settings": {}
}"""
def execute(self, data: List[str]) -> List[str]:
has_T0 = False
has_T1 = False
# Check each line of G-code for tool commands
for layer_number, layer in enumerate(data):
if "T0" in layer:
has_T0 = True
if "T1" in layer:
has_T1 = True
# Determine replacement string based on tool presence
if has_T0 and has_T1:
replacement = "Purge lines for T0 and T1"
elif has_T0:
replacement = "Purge line for T0"
elif has_T1:
replacement = "Purge line for T1"
else:
return data # Return data unchanged if neither T0 nor T1 is found
# Perform the replacement in each line of G-code
for layer_number, layer in enumerate(data):
data[layer_number] = layer.replace("Purgelines", replacement)
return data
I can’t make it work.
If i add 2 objects and asign 1 extruder to each of them and activate the skirt function, everything works fine. But when i deactivate all skirts and brims, the temperatures for the extruders gets mixed up, so it seems hopeless at this point…
Not sure if the problem is Cura or Snapmaker firmware…
What START G-CODE do you have?
If I remember correctly, I had to remove all set temperature commands from it to let Cura deal with that correctly.
Here is my code:
;--- Start G-code Begin ---
G28 ;Home
G1 Z0.8 F6000
M201 X10000 Y10000 Z500 E5000
M205 V5
G92 E0
G1 F200 E2
G92 E0
;--- Start G-code End ---
@obertini I tried that while fiddeling around with the script… It seems I put the temp commands back in, shortly after giving up and documenting the weird behaviour (with the temp commands in place)…
I’ll see if I can reproduce the error while not having the temperature commands present in the start gcode. Thanks!
I suggest the obvious, use a own profile for different things:
1- left extruder only
2- right extruder only
3- both, right support
I don’t use cura much so please apologies if it’s not usefull.
In simplify 3d I have this settings to do exactly like described above.
This contains also own start gcodes and end gcodes…
Thanks for the help. I do like those purge lines but it seems I can’t get it to work the way I want atm. I’ll just keep using the skirts for now…
@obertini Yes that is good information. Thanks. I did stumble upon that one while trying to get the script to work.
The funny thing is that I got all parts of the proccess working but never simultaneously. When temps were working than the if/else/search and replace function wouldnt work. I’m sure its possible but I don’t have much coding experience so its not so easy for me…
Hello ,
As per my knowledge you can create separate GCODE scripts for each extruder in Cura. To avoid purging both if only one extruder is used, Cura allows you to conditionally include these scripts based on the number of active extruders in your print job settings.
@lumisanders i’m talking about purge lines being printed on the build plate before the printjob starts. Adding those to every tool change would not be a great idea imo. Is that what you are suggesting?