I change filament often, almost daily and I would like the option to automatically unload the filament in the toolhead at the end of the print (and keep the other toolheads unloaded until needed to print. I looked around here and searched online and only found one bit of info.
M600 seems to be the Gcode command for this though I expect you’d have to add another command to load the filament before printing. I don’t care about the tiny amount of lost purge at each loading nor the extra time to start a print as I’m usually headed to my day job. Unloading at the end would really save me a lot of time with swaps as I could do that at any time without waiting for each head to warm up and release the filament.
That bit seems simple enough – just add the relevant code to the print end configuration for the U1 in the slicer. That depends on the relevant GCode being implemented in the printer’s firmware of course, although it is perfectly feasible to do the same job with a combination of other commands.
If only I knew the code and syntax to do this. :).
I think M600 is one of the codes to unload but I’d also have to add a code to load the toolhead before starting printing, including all the heads needed. Is there a place to find all those codes and syntax to use? I’m pretty new to programming my Snapmaker. Thank you.
I would love to have the code info too, but I haven’t actually looked at gcode since my first printer 15 years ago and have no idea what the command would be for the U1, especially since there is 4 to address. It just happened to me today after I turned off the machine and realized I wanted to get ready for tomorrow by taking off the filament, only to have to turn it back on and go thru the manual procedure. Regards
It’s not difficult. First of all, have a dig around in the printer definitions in the slicer – every printer available in the choices for printer comes with its own set of settings, and in Cura you get to see them by clicking the “manage printer” button. There must be something similar in Orca. When the printer you want isn’t in the predefined list, that’s where you build a new printer definition.
Within the definition are preset G-Code scripts for things like start-of-print, end-of-print, toolhead-change etc. The scripts are generally commented, and are plain text. Adding a few commands is a breeze.
Last but not least is getting to know how G-Code works. It’s very simple, it was invented as a way to control CNC machines long before anybody thought of a 3D printer. It’s a letter-number code followed by any command parameters required (distance to move in x,y,z, amount of filament to extrude, temperature to set, whatever). The Klipper G-Code reference is here: G-Codes - Klipper documentation , but note that Klipper also uses “descriptive” codes as well as the letter-number codes (and makes the print file huge as a result).
So basically you need to add code to the end-of-print script which sets the temperature for the current toolhead to something suitable (eg 210ºC) and wait for that temperature to be reached (M108), then extrudes a negative length (G1). The complication is you will need to cycle that through all the toolheads.
What I suggest is you make a start and report what you find in this thread, then I’m sure the community will dive in to help you along.
@BowenTech How about updating the title of this thread to something more informative, eg “[Feature Request] Automatic Unload of Filaments After Print”?
Had AI write the code, then modified a little to unload all 4 nozzles. Will give it a try and repost how it works. Looking at the coding it appears the machine will load the filament before printing but in case it doesn’t I have another set of commands to load at the beginning of the print that I’ll add if needed.
; ====== UNLOAD ALL EXTRUDERS: T0–T3 ======
; ------ UNLOAD T0 ------
T0
M104 S200 ; Heat hotend (no wait)
M109 S200 ; Wait for temp
G92 E0 ; Reset extruder position
G1 E5 F200 ; Push slightly to release pressure
G1 E-40 F200 ; Retract 40 mm to unload filament
G92 E0 ; Reset extruder
M104 S0 ; Turn off hotend
; ------ UNLOAD T1 ------
T1
M104 S200 ; Heat hotend (no wait)
M109 S200 ; Wait for temp
G92 E0 ; Reset extruder position
G1 E5 F200 ; Push slightly to release pressure
G1 E-40 F200 ; Retract 40 mm to unload filament
G92 E0 ; Reset extruder
M104 S0 ; Turn off hotend
; ------ UNLOAD T2 ------
T2
M104 S200 ; Heat hotend (no wait)
M109 S200 ; Wait for temp
G92 E0 ; Reset extruder position
G1 E5 F200 ; Push slightly to release pressure
G1 E-40 F200 ; Retract 40 mm to unload filament
G92 E0 ; Reset extruder
M104 S0 ; Turn off hotend
; ------ UNLOAD T3 ------
T3
M104 S200 ; Heat hotend (no wait)
M109 S200 ; Wait for temp
G92 E0 ; Reset extruder position
G1 E5 F200 ; Push slightly to release pressure
G1 E-40 F200 ; Retract 40 mm to unload filament
G92 E0 ; Reset extruder
M104 S0 ; Turn off hotend
; ====== END: UNLOAD ALL EXTRUDERS ======
Tried to edit the original post but it doesn’t give me the option to update the title or post.
Thank you very much. Add I replied below I had AI help but you’re content, plain text and makes sense, especially with the comments added. I’ll check out those links you sent to increase my understanding of the code and see what other improvements we can all talk about.
Thanks again!
It wouldn’t make sense not to!
I’m not sure those M104 S200 commands are actually needed, but they won’t do any harm (M109 is supposed to set temperature and wait for temperature to stabilise), but at a quick glance the script looks OK. My reading of the documentation is that the T0 T1 (etc) commands might not be supported in Klipper, but I guess they are already in the existing scripts?
I see no harm in trying it, see whether it works.
@moderators How about it?
Thanks for checking the code. I’m a complete n00b at this software (last coding I did was Basic, I’m that old) but seems mostly straight forward.
Was thinking about it this morning and it might not work as well as I hoped as when it loads the filament at the next print command, it might hang waiting for input on the type. Could be more viable with RFID filament (Snapmaker brand in this case) so I’ll try that if this causes a snag.