Example program · Mill

GRBL / LinuxCNC Touch Plate Z Probe (G38.2) — G-Code Example

Probes down onto a 15 mm touch plate, sets work Z0 on the top of the stock with G10 L20, and retracts.

By cnccode · Updated

Probes down onto a 15 mm touch plate, sets work Z0 on the top of the stock with G10 L20, and retracts.

ItemValue
MachineCNC mill / machining centre (Fanuc-style)
UnitsMetric (G21)
Lines10

Program

G-code
(Z TOUCH PLATE - PLATE THICKNESS 15.0 MM)
G21 G90
G91
G38.2 Z-30 F100 (fast find)
G0 Z2
G38.2 Z-5 F25 (slow, accurate)
G10 L20 P1 Z15.0 (current position = Z15 in G54)
G0 Z10
G90
M30

▶ Simulate in the G-code viewer

How it works

  • Clip the plate wire on the bit and test the probe input before running.
  • G38.2 stops with an error if no contact is found — protecting the bit.
  • L20 P1 writes G54 so the current position becomes Z = plate thickness.

Codes used in this program

Always check feeds, speeds, offsets and clearances for your own machine and tooling, and prove new programs with single block and reduced rapid.

More milling programs