Example program · 3D printing
Marlin End G-code: Retract, Park and Cool Down — G-Code Example
An end code that lifts away from the part without leaving a blob, presents the bed and turns everything off.
An end code that lifts away from the part without leaving a blob, presents the bed and turns everything off.
| Item | Value |
|---|---|
| Machine | 3D printer (Marlin) |
| Units | Metric |
| Lines | 11 |
Program
; --- end (Marlin) ---
G91 ; relative
G1 E-2 F2700 ; retract
G1 Z5 F600 ; lift
G90 ; absolute
G1 X0 Y200 F6000 ; present the bed (check your bed size)
M106 S0 ; fan off
M104 S0 ; nozzle off
M140 S0 ; bed off
M84 X Y E ; motors off, keep Z
M300 S880 P200 ; beep▶ Check it in the 3D printer simulator
How it works
- G91 makes the lift relative, so it works at any print height.
- Z stays powered so a heavy gantry does not drop onto the part.
Codes used in this program
- G91 — Incremental Programming
- G90 — Absolute positioning (G90 / G91)
- M106 — Fan on (part cooling)
- M104 — Set hotend temperature (no wait)
- M140 — Set bed temperature (no wait)
- M84 — Disable motors (M84 / M18)
- M300 — Beep
Check bed size, temperatures, probe and macro names against your own printer before you use this code, and stay at the printer for the first run.
More 3D printing programs
- Marlin Start G-code with Mesh, Prime Line and Safe Heating
- Klipper PRINT_START Macro with Adaptive Mesh and Purge
- Klipper PRINT_END Macro That Parks Safely at Any Height
- Klipper M600 Filament Change Macro
- E-steps Calibration Sequence (Marlin)
Was this page helpful?