2.2.15. End G-Code for the Prusa i3 Mk3

My end g-code is pretty standard. Any setting changes made from the front menu will persist between prints if not reset, so I like to ensure everything is set back to 100% when a print job completes. I’ve also added a couple of routines to minimize final stringing, though with mixed success.

  • Line 7 retracts 0.8mm of filament (E-0.8) to reduce final stringing.

  • Lines 8-11 do a little wiping motion with no extrusion to reduce final stringing.

  • Line 13 raises the nozzle 60mm or up to the maximum print area of 210mm, whichever is lower.

  • Line 14 moves the extruder to the far left (X0) and forward (Y210) to present the print for easy removal.

  • Line 16 disables volumetric e extrusion (an experimental setting).

  • Line 17 resets print speed over-rides made with the front knob.

  • Line 18 resets extruder factor adjustments made with the front knob.

  • Line 19 resets Linear Advance.

  • Lines 20-25 shut down the printer hardware.


Thanks to Steve_G for catching the error on that last line.

Here’s my current end g-code:

Listing 2.16 PrusaSlicer end g-code
; Last edited 20200215
G4 ; wait
; Raise nozzle and present bed
M117 Printing complete
G4 ; wait
G92 E0 ; prepare to retract
G1 E-0.8 F3000; retract to avoid stringing
; Anti-stringing end wiggle
G91 ; use relative coordinates
G1 X-0.5 Y-0.5 F1200
G1 X1 Y1 F1200
G90 ; use absolute coordinates
{if layer_z < max_print_height}G1 Z{z_offset+min(layer_z+60, max_print_height)}{endif} ; Move print head up
G0 X0 Y210 F10200; present bed
; Reset print setting overrides
M200 D0 ; disable volumetric e
M220 S100 ; reset speed factor to 100%
M221 S100 ; reset extruder factor to 100%
M900 K0 ; reset linear acceleration
; Shut down printer
M104 S0 ; turn off temperature
M140 S0 ; turn off heatbed
M107 ; turn off fan
M84 ; disable motors
M300 S40 P10 ; chirp

Download the raw gcode here

Contact and feedback

You can find me on the Prusa support forums or Reddit where I lurk in many of the 3D printing-related subreddits. I occasionally drop into the Official Prusa 3D discord server where I can be reached as bobstro (bobstro#9830). You can email me directly at projects@ttlexceeded.com.

Last edited on Dec 28, 2021. Last build on Apr 22, 2022.