# G-code assistance needed

**URL:** <https://forum.makewithtech.com/t/g-code-assistance-needed/7686>\
**Category:** 3d Printing / Slicers / Setup / Problems\
**Created:** [August 10, 2023, 12:51pm UTC](https://forum.makewithtech.com/t/g-code-assistance-needed/7686 "2023-08-10T12:51:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![davecadieux](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.makewithtech.com/davecadieux/32/2475_2.png) [@davecadieux](https://forum.makewithtech.com/u/davecadieux)\
**Post date:** [August 10, 2023, 12:51pm UTC](https://forum.makewithtech.com/t/g-code-assistance-needed/7686/1 "2023-08-10T12:51:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Gramps](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.makewithtech.com/gramps/32/60_2.png) [@Gramps](https://forum.makewithtech.com/u/Gramps)\
**Post date:** [August 10, 2023, 2:58pm UTC](https://forum.makewithtech.com/t/g-code-assistance-needed/7686/2 "2023-08-10T14:58:55Z")

</div>

You can do that in Prusa Slicer after the time is sliced. This [video](https://www.youtube.com/watch?v=_NqVWVA7DW0) might help

---

<div class="post-metadata">

**Author:** ![davecadieux](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.makewithtech.com/davecadieux/32/2475_2.png) [@davecadieux](https://forum.makewithtech.com/u/davecadieux)\
**Post date:** [August 10, 2023, 3:24pm UTC](https://forum.makewithtech.com/t/g-code-assistance-needed/7686/3 "2023-08-10T15:24:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Alan](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.makewithtech.com/alan/32/26_2.png) [@Alan](https://forum.makewithtech.com/u/Alan)\
**Post date:** [August 10, 2023, 3:56pm UTC](https://forum.makewithtech.com/t/g-code-assistance-needed/7686/4 "2023-08-10T15:56:02Z")

</div>

“G90 G01 X20 Y20 Z30: absolute movement”

should be two lines:

```auto
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
```

---

<div class="post-metadata">

**Author:** ![davecadieux](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.makewithtech.com/davecadieux/32/2475_2.png) [@davecadieux](https://forum.makewithtech.com/u/davecadieux)\
**Post date:** [August 10, 2023, 4:29pm UTC](https://forum.makewithtech.com/t/g-code-assistance-needed/7686/5 "2023-08-10T16:29:57Z")

</div>

thank you appreciate the input 🙂

---

<div class="post-metadata">

**Author:** ![davecadieux](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.makewithtech.com/davecadieux/32/2475_2.png) [@davecadieux](https://forum.makewithtech.com/u/davecadieux)\
**Post date:** [August 11, 2023, 2:07pm UTC](https://forum.makewithtech.com/t/g-code-assistance-needed/7686/6 "2023-08-11T14:07:01Z")

</div>

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
