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
 1; Last edited 20200215
 2G4 ; wait
 3; Raise nozzle and present bed
 4M117 Printing complete
 5G4 ; wait
 6G92 E0 ; prepare to retract
 7G1 E-0.8 F3000; retract to avoid stringing
 8; Anti-stringing end wiggle
 9G91 ; use relative coordinates
10G1 X-0.5 Y-0.5 F1200
11G1 X1 Y1 F1200
12G90 ; use absolute coordinates
13{if layer_z < max_print_height}G1 Z{z_offset+min(layer_z+60, max_print_height)}{endif} ; Move print head up
14G0 X0 Y210 F10200; present bed
15; Reset print setting overrides
16M200 D0 ; disable volumetric e
17M220 S100 ; reset speed factor to 100%
18M221 S100 ; reset extruder factor to 100%
19M900 K0 ; reset linear acceleration
20; Shut down printer
21M104 S0 ; turn off temperature
22M140 S0 ; turn off heatbed
23M107 ; turn off fan
24M84 ; disable motors
25M300 S40 P10 ; chirp

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 Mar 04, 2021. Last build on Oct 22, 2021.