Did you know nozzle changes can be made even faster by making minor tweaks to your slicer start and end G-code? - This guide will take you through the process of getting it set up.
This guide cannot provide a universal start and end G-code as there are just too many variables between printers. Instead, this guide will show you the basics of how to add to your existing slicer setup.
Modifying G-code has the potential to cause damage to your printer. Read the guide carefully and make sure you understand what you are doing before making any changes to your G-code.
Why modify the start/end G-code?
Modifying the end Gcode of your Slicer with a long retract releases the filament from the nozzle when the print finishes. As a result, the nozzle can be unscrewed without heating up and removing the filament first.
Finding the G-code section of your slicer
Printer Settings > Custom G-code
Manage Printers > Machine Settings
Editing the end G-code
End G-code for a stock Ender 3 Profile on Cura: (Note: some of the G-code is off-screen)
Anything that comes after a semicolon ( ; ) is just a note.
Notice the line of G-code that has been added:
G1 E-18 F800 ;retract filament from meltzone
G1 signifies a linear movement.
You should make sure that you are in 'Relative positioning mode'. (Or 'Extruder relative mode' for Prusaslicer) for this line of G-code.
E-18 is a retraction of 18mm (The minus sign IS important!)
A retraction of 18mm should bring the filament clear of the melt zone. This is a high value which should work first time but feel free to test this at lower values for yourself.
Be aware that if you are using a direct drive extruder, retracting too far may cause the filament to retract all the way out of the gears.
F is feed rate in mm/min
A feed rate of 800 seems to give a consistent filament tip. Getting the filament tip right is super important as otherwise, it can get stuck on its way back in! - If you are struggling to get consistent tips, it can help to extrude slightly before retracting.
G1 E2 F800 ;Extrude slightly
Editing the start Gcode
As you have modified the end G-code to retract the filament, you may also need to tweak the start Gcode to ensure the filament still has plenty of time to reach the nozzle and purge before the print begins.
You could do this by adding: G1 E18 F400, following the same process as you did for the end G-code.
This is a little messy though as if your previous print failed, or if you changed filament etc. you'll end up with excess filament being pushed out onto your build plate.
A cleaner way is to account for the difference within your purge line:
On some slicer setups, the purge line may already be big enough to account for the difference. Try it for yourself to see if your purge line is long enough. If yours isn't, you can modify it like this:
Modifying the start G-code on a Prusa: (Note: some of the G-code is offscreen)
Notice the line that has been edited:
G1 X200.00 E30 F500.0 ; intro line
This increases the length of the purge from 100mm to 200mm.
A longer purge line means more time for the filament to reach the nozzle.
The extruded volume is higher moving from 21.5 to 30.
This creates a wider purge line which also means more time for the filament to reach the nozzle.
The feed rate (movement speed) is halved for the second part of the movement.
Reducing the movement speed can be used to offset the increase in flow rate.
The first half of the intro line (from 0X to 60X) is left the same in this example but this could also be edited in the same way if required.