FANUC Macro Programming
Write custom macros that count parts, adjust offsets and run whole part families on the Oi.
| Drill | Inch | mm | Type |
|---|
Tim Blakely has run FANUC-controlled CNC machines since 2009, working his way from operator to the programmer other machinists bring their hardest jobs to. He's self-taught in macros and parameters, and everything he writes comes off a real control on a real shop floor in North Carolina.
Visit workingmachinist.comFree from The Working Machinist. The Tool Box is the quick answer; the books are the full story. Tap a button, or scan a QR code with your phone, to open the book on Amazon.
Write custom macros that count parts, adjust offsets and run whole part families on the Oi.
Fix alarms, recover lost home position and build your own M-codes on the Oi.
Both guides in one book for CNC operators: Macro Programming and Parameters. The best value in the series.
CNC Mill Edition. 90 setup sheets with work offsets, tool lists and first-article records, so the next run starts faster.
Tim Blakely has run FANUC-controlled CNC machines since 2009, working his way from operator to the programmer other machinists bring their hardest jobs to. He's self-taught in macros and parameters, and everything he writes comes off a real control on a real shop floor in North Carolina.
Visit workingmachinist.com| Example | Angle | Long side | Short side |
|---|
short = long − (width × tan(90° − angle))| Hole | Angle | X | Y |
|---|
X = r × cos(angle), Y = r × sin(angle)| Material | SFM | Chip load/tooth |
|---|
| Thread | Cut tap | Form tap |
|---|
Drill to size — general shop capability holds roughly ±0.003–0.005" with a Rough or Standard finish. If your tolerance and finish both fit that, a standard drill at (or near) final size is enough.
Drill + Ream — reaming typically holds ±0.0005–0.001" with a Ra 32-63 finish, and needs a pilot hole that leaves 0.01–0.03" of stock for the reamer to remove cleanly.
Drill + Bore — for tolerances tighter than about ±0.0005", boring is recommended, also needing a pilot hole leaving 0.01–0.03" of stock for the boring bar.
Mill to size — if no standard drill (inch or metric) lands within that 0.01–0.03" window below the finished size, there's no good pilot hole for a reamer or boring bar. Milling the hole to size (roughed with an end mill, finished by circular interpolation) sidesteps the problem entirely.
These are general shop guidelines, not a substitute for your own process capability data — adjust for material, hole depth-to-diameter ratio, and the tooling you actually have on hand.
| Fraction | Decimal (in) | Millimeters |
|---|
| Screw | Head dia. (sharp) | Close clearance |
|---|
Z = (D − tip) ÷ 2 ÷ tan(angle ÷ 2)| Fit | Type | Hole | Shaft | Clearance |
|---|
Ø = 2 × √(ΔX² + ΔY²). At MMC, bonus = how far the actual size has moved from MMC (hole: actual − low limit; pin: high limit − actual). Allowed = position tolerance + bonus. Datums are assumed to be the X/Y zero your measurements came from.