Example program · 3D printing

Marlin Start G-code with Mesh, Prime Line and Safe Heating — G-Code Example

A clean start code for Marlin printers with a probe: bed first, nozzle warm but not oozing while probing, then a double prime line. Replace the temperatures with your slicer placeholders.

By cnccode · Updated
On this page
  1. Program
  2. How it works
  3. Codes used in this program
  4. More 3D printing programs

A clean start code for Marlin printers with a probe: bed first, nozzle warm but not oozing while probing, then a double prime line. Replace the temperatures with your slicer placeholders.

ItemValue
Machine3D printer (Marlin)
UnitsMetric
Lines19

Program

G-code
; --- start (Marlin) ---
G21                 ; mm
G90                 ; absolute positions
M83                 ; relative extrusion
M140 S60            ; bed: start heating
M104 S150           ; nozzle: warm, no ooze
G28                 ; home
M190 S60            ; wait for bed
G29                 ; probe mesh (or M420 S1 to load a saved mesh)
M109 S210           ; wait for nozzle
G1 Z2 F600
G1 X5 Y20 F6000
G1 Z0.3 F600
;TYPE:Skirt
G1 Y120 E12 F1200   ; prime line 1
G1 X5.4 F3000
G1 Y20 E12 F1200    ; prime line 2
G1 Z1 F600
G92 E0

▶ Check it in the 3D printer simulator

How it works

  • The nozzle stays at 150 °C until the mesh is probed, so no blob falls under the probe.
  • M83 makes every E value the length of that move, which is easier to check and safer to edit.
  • In PrusaSlicer use [first_layer_bed_temperature] and [first_layer_temperature] instead of 60 and 210.

Codes used in this program

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

Was this page helpful?