# G code help

**URL:** <https://forum.snapmaker.com/t/g-code-help/42499>\
**Category:** Snapmaker 2.0 (3-in-1)\
**Created:** [July 13, 2026, 3:40pm UTC](https://forum.snapmaker.com/t/g-code-help/42499 "2026-07-13T15:40:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarkJ](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/markj/32/29732_2.png) [@MarkJ](https://forum.snapmaker.com/u/MarkJ)\
**Post date:** [July 13, 2026, 3:40pm UTC](https://forum.snapmaker.com/t/g-code-help/42499/1 "2026-07-13T15:40:42Z")

</div>

Need some g-code support please.

I load the filament on the right side of the SM2 with enclosure. I would like a quick g-code project that moves the head to the right and heats up the nozzle for loading. I can move the head easily but as soon as the project is done it goes back home. I’ve tried the M600, M412 commands to no avail. With CNC or laser gcode the head can be moved and NOT go home after the project completes. In the 3DP, it always wants to go home. Any suggestions?

Thanks

---

<div class="post-metadata">

**Author:** ![xchrisd](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/xchrisd/32/1503_2.png) [@xchrisd](https://forum.snapmaker.com/u/xchrisd)\
**Post date:** [July 13, 2026, 6:14pm UTC](https://forum.snapmaker.com/t/g-code-help/42499/2 "2026-07-13T18:14:13Z")

</div>

Simply wait? For example 10minutes and abort the “job” when you finished loading? G4 S600

> **[Dwell](https://marlinfw.org/docs/gcode/G004.html)**
>
> Dwell pauses the command queue and waits for a period of time.

Or use the “go to swap position” button in the settings?

---

<div class="post-metadata">

**Author:** ![Skreelink](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/skreelink/32/16398_2.png) [@Skreelink](https://forum.snapmaker.com/u/Skreelink)\
**Post date:** [July 13, 2026, 11:13pm UTC](https://forum.snapmaker.com/t/g-code-help/42499/3 "2026-07-13T23:13:19Z")

</div>

To do this, you’ll have to use some form of direct control system, such as Octoprint. Using Luban or the touchscreen will always have some form of start/end you cannot control. You need to send code directly to the controller, bypassing the touchscreen.

A Pi Zero 2W is a great option here, and is what I use. It can even be powered by the USB A port on the Snapmaker itself, making it a self-contained system.

---

<div class="post-metadata">

**Author:** ![Cadae](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/cadae/32/31718_2.png) [@Cadae](https://forum.snapmaker.com/u/Cadae)\
**Post date:** [July 14, 2026, 5:02am UTC](https://forum.snapmaker.com/t/g-code-help/42499/4 "2026-07-14T05:02:31Z")

</div>

You can find a list of Marlin gcode commands here,

> **[Gcode](https://marlinfw.org/meta/gcode/)**
>
> Printing the planet, one layer at a time.

and a list of commands supported on Snapmaker 2.0 printers here

[https://wiki.snapmaker.com/en/Snapmaker\_Luban/manual/2\_supported\_gcode\_references](https://wiki.snapmaker.com/en/Snapmaker_Luban/manual/2_supported_gcode_references)

If I understand your questions correctly, you can modify the end gcode in your slicer. At the very end, add move (G0) and heat (M109) commands, or replace the G28; home at the end with the commands.

---

<div class="post-metadata">

**Author:** ![MarkJ](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/markj/32/29732_2.png) [@MarkJ](https://forum.snapmaker.com/u/MarkJ)\
**Post date:** [July 25, 2026, 7:09pm UTC](https://forum.snapmaker.com/t/g-code-help/42499/5 "2026-07-25T19:09:01Z")

</div>

@Skreelink is essentially correct from what I can tell. There is no native way to do gcode and get what I want. I did finally get a work around to do what I want, but it was painful to get to the solution; lots of playing with code.

I tried playing with M412 - filament run out detection but there is no way (I could see anyway) to use the M412 in a file. If I sent M412 S0 from the Luban Workspace, I could get the code to work by forcing a run out. But I couldn’t turn off run out in a file, only from the workspace.

So I ended up going back to M600 and setting that up. The only problem is, I need to leave the print head loaded. So I’m leaving a small filament in the head then using code to move the head, heat the nozzle, expel the old filament, and put in new filament from my right side.

I think M412 might have worked the same if I left the head loaded with old filament and then purged some.

Anyway, got it to work. Thanks all

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex022/uploads/snapmaker/original/2X/b/b273b784eae4c71f032d76f1e010f09bf1d8adc8.png) [@system](https://forum.snapmaker.com/u/system)\
**Post date:** [July 27, 2026, 7:09pm UTC](https://forum.snapmaker.com/t/g-code-help/42499/6 "2026-07-27T19:09:19Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
