CNC Mill Contour Pecking – Fanuc Subprogram Repeat Example

A very simple cnc programming example which shows
how a contour can be repeated multiple times with the added benefit of pecking.
So like peck drilling this time cnc machinists are pecking a specific contour of cnc mill.

What is Fanuc Sub programming read Fanuc Sub Programming

CNC Mill Contour Pecking

The subprogram is a simple mix of G-code instructions.
The main program O4000 calls subprogram O4001 to repeat 10 times

M98 P104001

Subprogram cuts contour by making 2mm depth of cut every time (in G91 Incremental Programming)

G1 G91 Z-2 (Incremental peck depth)

Then subprogram switches back to G90 Absolute Programming this makes contour programming easy.
So this program cuts a specific contour 20mm deep by taking 10 pecks of 2mm each.

Fanuc Subprogram Repeat Example

Contour Pecking - Fanuc Mill Subprogram Repeat Example

Contour Pecking – Fanuc Mill Subprogram Repeat Example

O4000
T1 M6
G0 G90 G40 G21 G17 G94 G80
G54 X-75 Y-75 S? M3 (Start Point)
G43 Z100 H1
Z5
G1 Z0 F?
M98 P104001 (Call sub-program & repeat 10 times)
G0 G90 Z100
M30

Subprogram
The sub program below takes cut in G91 Incremental Programming Mode
Then switches back to G90 Absolute Programming Mode for the contour machining.

O4001
G1 G91 Z-2 (Incremental peck depth)
G90 G41 X-40 D? M8 (Absolute Move to position 1 with comp. - Switch on coolant)
Y40 (Move to position 2.)
X40 (Move to position 3.)
Y-40 (Move to position 4.)
X-75 (Move to position 5 - Clear of material - cutter diameter)
G40 Y-75 (Cancel compensation)
M99