Example program · 3D printing
Klipper PRINT_START Macro with Adaptive Mesh and Purge — G-Code Example
A PRINT_START macro for printer.cfg that takes the temperatures from the slicer, heats in the right order, probes only the print area and purges. One slicer line calls it.
A PRINT_START macro for printer.cfg that takes the temperatures from the slicer, heats in the right order, probes only the print area and purges. One slicer line calls it.
| Item | Value |
|---|---|
| Machine | 3D printer (Klipper) |
| Units | Metric |
| Lines | 22 |
Macro for printer.cfg
[gcode_macro PRINT_START]
description: Heat, home, mesh and purge
gcode:
{% set BED = params.BED|default(60)|float %}
{% set EXTRUDER = params.EXTRUDER|default(210)|float %}
M140 S{BED} ; bed: start heating
M104 S150 ; nozzle: warm, no ooze
G28
M190 S{BED} ; wait for bed
BED_MESH_CALIBRATE ADAPTIVE=1 ; mesh only where the part is
M109 S{EXTRUDER} ; wait for nozzle
G92 E0
G90
M83
G1 X5 Y20 Z0.3 F6000
G1 Y120 E12 F1200 ; purge
G1 X5.4 F3000
G1 Y20 E12 F1200
G1 Z1 F600
; slicer start G-code (PrusaSlicer):
; PRINT_START BED=[first_layer_bed_temperature] EXTRUDER=[first_layer_temperature]▶ Check it in the 3D printer simulator
How it works
- ADAPTIVE=1 needs [exclude_object] in printer.cfg and "label objects" in the slicer.
- Printers with Z_TILT_ADJUST or QUAD_GANTRY_LEVEL run it after G28 and home Z again.
- Adjust the purge position to your bed.
Codes used in this program
- PRINT_START — Start macro (convention)
- BED_MESH_CALIBRATE — Probe the bed mesh (Klipper)
- M109 — Set hotend temperature and wait
- M190 — Set bed temperature and wait
- G28 — Home axes
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
- Marlin End G-code: Retract, Park and Cool Down
- Klipper PRINT_END Macro That Parks Safely at Any Height
- Klipper M600 Filament Change Macro
- E-steps Calibration Sequence (Marlin)
Was this page helpful?