Fanuc Peck Drilling Macro – CNC Lathe Programming
Introduction
In CNC turning, deep hole drilling often requires careful control to avoid tool breakage, overheating, and chip clogging. A common solution is peck drilling, where the drill advances in small steps (“pecks”), retracts slightly to break and evacuate chips, and then continues deeper until the full depth is reached.
Fanuc CNC systems allow this process to be automated using custom macros or built-in cycles like G74 (peck drilling cycle). For more flexibility, a Fanuc macro program can be written to handle varying depths, peck sizes, and feed rates.
Why Use Peck Drilling?
-
Prevents chip packing in deep holes
-
Reduces heat buildup on the drill tip
-
Improves tool life and hole quality
-
Safer than conventional single-pass drilling
Fanuc Peck Drilling Macro Example
O9001 (Peck Drilling Macro) #100 = 50.0 (Hole depth Z-50 mm) #101 = 5.0 (Peck depth 5 mm) #102 = 2.0 (Retract distance 2 mm) #103 = 0.2 (Feedrate) G00 X0 Z2 (Rapid to safe start point) WHILE [#100 GT 0] DO1 G01 Z[#100 * -1 + #101] F#103 (Drill forward peck depth) G00 Z[#102] (Retract for chip break) G00 Z0 (Return near surface) #100 = [#100 - #101] (Reduce remaining depth) END1 M99
Step-by-Step Logic
-
Drill advances by #101 (5 mm peck).
-
Drill retracts by #102 (2 mm) to clear chips.
-
Tool returns close to the last depth and repeats.
Reviewed by www.cncknowledge.in
on
August 22, 2025
Rating: 5

