G-code assistance needed

rookie here…

looking for g-code to insert at specific height within prusa slicing program to make hot end move to x-20 y20 and pause.

so that I can switch filament color on ender 3 pro.

without having filament leaking out onto project while pushing the filament down the bowden tube.
(the x20 y 20 is the safe location where the PLA can leak out with no issue)

actually, having it extract the filament at this time so it’s only in the bowden tube would be great, then I could tell it to cool the hot end down to 0 until I can load the different filaments and heat up the hot end again.

right now I am ready to test this (unless improvements can be suggested)

G01 Z10 F100: lift z by 10, speed of 100mms

G90 G01 X20 Y20 Z30: absolute movement

M702 U80: retract 80mm

S0: set hot end temp to 0 degrees

M0 change filament: pause and message

You can do that in Prusa Slicer after the time is sliced. This video might help

I am attempting to clarify the code used (I know where to insert it)

“G90 G01 X20 Y20 Z30: absolute movement”

should be two lines:

G90 ; Set all axes to absolute
G01 X20 Y20 Z30; move to (20mm,20mm,30mm)

Also,
S0 should be:

M104 S0; set hotend temp to 0 degrees (Could set to a standby temperature for faster warm up?)

FWIW, Marlin gcode reference: [https://marlinfw.org/meta/gcode/](https://marlinfw.org/meta/gcode/)

Cheers

thank you appreciate the input :slight_smile:

update:

G90 ; Set all axes to absolute

G10 S5; retract 5mm

G01 X20 Y20; move to (x20mm,y20mm)

G10 S100; retract 100mm

M104 S0; turn hot end heating off

M0 change filament; pause and message

M104 S210; turn hot end on

M191 S210; wait for chamber temp of 210

M0 waiting for nozzle temp; pause and message

G1 E10; load filament 10mm

M0; pause to manually confirm old filament is out

1 Like