Milling a bore or a boss with an end mill instead of a boring bar or a turning op is everyday work on a machining centre. The tool runs round in a circle with G02 or G03 and steps down until it reaches depth. The ID / OD Circular Interpolation Generator in the Shader7 CNC Machinist hub writes that program for you as a parametric macro, so you can tweak a diameter or depth at the control without regenerating the code.

The ID / OD Circular Interpolation Generator with the toolpath preview and generated macro program
The ID / OD Circular Interpolation Generator with the toolpath preview and generated macro program.

G02, G03 and the arc centre in 60 seconds

  • G02 moves clockwise, G03 counter-clockwise, looking at the active plane from the positive side of the third axis.
  • The arc centre is given either as a radius R or as incremental distances I, J, K from the start point to the centre (I along X, J along Y, K along Z).
  • G17 selects the XY plane (the normal case on a vertical mill), G18 the XZ plane and G19 the YZ plane.

The generator uses I/J/K centre programming, which is required for a full 360° circle: an R value cannot describe a complete circle because the start and end points are the same.

Using the generator

The form has four groups.

1. Operation & Plane

  • Milling Mode: ID (Inside Diameter) for bores and pockets, or OD (Outside Diameter) for bosses and spigots.
  • Active Plane: G17 (XY, depth along Z), G18 (XZ, depth along Y) or G19 (YZ, depth along X). The field labels update to match, for example Center X (#16) becomes Center Z (#16) in G19.

2. Coordinates & Geometry

Field Variable Meaning
Center X / Y #16, #17 Centre of the circle in the work coordinate system
Dia to Make #30 Finished diameter of the bore or boss
Cutter Radius #5 Radius of the end mill
Safety Engage (OD only) #8 Extra clearance outside the boss before the tool feeds in

3. Depths & Pass settings

  • Start Depth (#1): depth of the first pass.
  • Final Depth (#2): finished depth.
  • DOC (#3): depth of cut per revolution.

4. Program Preferences

  • Prog No., the O-number.
  • Feedrate F.
  • Spindle Gear: M141 S550 + M103 for gear-head machines or M03 S550 for a standard spindle.
  • End Code: M01 (optional stop), M0, M00 or M30.

Press Generate Program, then Copy to Clipboard or Download .txt.

How the program works

The program first shifts the coordinate system to the circle centre with G52 X#16 Y#17, so all moves are relative to the centre. It then calculates the tool-centre radius:

  • ID: #6 = #4 − #5, the finished radius minus the cutter radius.
  • OD: #7 = #4 + #5, the finished radius plus the cutter radius, and the tool starts at #5 + #4 + #8 so it enters from clear air.

The cutter offset is built into these values, so the program does not use G41/G42 cutter compensation. Enter the actual cutter radius in #5; if the bore comes out small, increase #30 or reduce #5 slightly at the control.

Each loop runs one full G03 circle in incremental mode while moving down by the DOC, which gives a helical step-down instead of a plunge:

G91 G01 Y#6 F...
N29 G03 X0 Y0 Z-#3 I0 J-#6 ;
#15=[#15-#3] ;
IF[#15 GT #2] GOTO 29 ;

When the loop reaches final depth, the program can take a flat circle at depth to clean up the helix, moves back to the centre, retracts, cancels the G52 shift and runs your end code.

Tool-centre path for internal and external circle milling: the centre runs at the finished radius minus or plus the cutter radius
Tool-centre path for internal and external circle milling: the centre runs at the finished radius minus or plus the cutter radius.

Setting the feed for a circle

The F you enter in the generator is the feed of the tool centre. On a circle, the cutting edge does not travel at the same speed as the centre:

  • Inside a bore the edge travels further than the centre, so the edge feed is higher than F.
  • Around a boss the edge travels a shorter distance than the centre, so the edge feed is lower than F.

To keep the chip load you would use on a straight cut, adjust the linear feed before you enter it:

ID:  F_centre = F_linear × (D_hole − D_cutter) / D_hole
OD:  F_centre = F_linear × (D_boss + D_cutter) / D_boss

Example: a 16 mm cutter at 800 mm/min on a straight cut, milling a 24 mm bore: 800 × (24 − 16) / 24 = 267 mm/min. Without that correction the edge would cut at three times the intended feed, which is a common cause of chipped cutters in small bores. Use the Milling Speeds & Feeds planner to get the linear feed first.

Practical tips

  • Cutter size for ID. Choose a cutter between about 50% and 80% of the bore diameter. Too small wastes time; too big leaves no room for chips and makes the feed correction extreme.
  • Pre-drill solid bores. The helix needs room to enter. Use a drill or ramp entry before the circle program on solid material.
  • DOC per revolution. Keep it moderate (a fraction of the cutter diameter in steel). A smaller DOC gives a smoother helix and less deflection.
  • Check the plane. In G18 and G19 the depth axis is not Z. The safe-approach and retract blocks change accordingly; make sure the clearance distances suit your setup.
  • Simulate first. Run the program in your control's graphics or on single block with reduced rapid before the first part.

Worked example: a 40 mm bore with a 20 mm end mill

  1. Milling Mode: ID. Active Plane: G17.
  2. Center X / Y: the bore centre, for example 50 and 30.
  3. Dia to Make (#30): 40. Cutter Radius (#5): 10.
  4. Start Depth (#1): 0. Final Depth (#2): −15. DOC (#3): 1.5.
  5. Feedrate F: start from your straight-line feed and apply the ID correction. With 600 mm/min linear, 600 × (40 − 20) ÷ 40 = 300 mm/min.
  6. Press Generate Program.

The tool centre runs on a 10 mm radius (#4 − #5 = 20 − 10). Each helical revolution goes 1.5 mm deeper, so the program makes ten turns to reach −15. The preview shows the 40 mm target circle, the cutter radius offset in amber and the helical tool-centre path in green.

Troubleshooting circle milling

Problem Likely cause Fix
Bore undersize Tool deflection or worn cutter Add a light finishing pass; increase #30 slightly
Bore oversize Cutter radius entered too small Measure the cutter and correct #5
Bore out of round Backlash or poor tuning on older machines Use climb milling (G03 inside), reduce feed, finish with a light pass
Chipped cutter on entry Too much DOC per revolution Reduce #3, check the hole was pre-drilled
Witness line on the wall Tool stops at the same point every pass Normal for a helix; take a final flat circle at depth

Arc programming rules worth remembering

  • I, J and K are incremental from the arc start point to the centre on most controls, even when the program is in G90.
  • A full circle needs I/J/K, not R.
  • The plane decides which words apply: G17 uses I and J, G18 uses I and K, G19 uses J and K.
  • If the endpoint does not lie on the circle, the control raises an alarm when using I/J/K, which is a useful safety check.

Frequently asked questions

Does the program use cutter compensation (G41/G42)?

No. The cutter radius (#5) is built into the toolpath radius. To adjust size, change #30 (diameter to make) or #5 at the control.

Why does it use G03 only?

G03 with a bore is climb milling, which usually gives a better finish and longer tool life on modern machines. For OD work it is conventional milling, which some shops prefer on rigid setups. Change G03 to G02 in the output if your process needs the other direction.

Can I use it on a horizontal machine or for side features?

Yes. Choose G18 or G19 as the active plane; the program uses the right axes and arc centre words for that plane.

What does Safety Engage do?

For OD milling, it adds clearance between the tool and the boss before the tool feeds onto the circle, so it never plunges onto the part.

Is the code specific to Fanuc?

It uses Fanuc Custom Macro B syntax (# variables, IF/GOTO) and G52. It also suits controls with Macro B compatible options. Verify on your control before cutting.

Generate your circle-milling program

Choose ID or OD, enter the centre, diameter, cutter radius and depths, and get a helical G03 macro program with a live toolpath preview. Copy it or download it as a .txt file.