CNC Path Analyzer

G02/G03 circular interpolation: determining direction, and R versus I/J/K

Explains how to tell G02 (clockwise) from G03 (counterclockwise) together with plane selection, the 180-degree problem of R commands, I/J/K center commands and full circles, using a milling example and its path drawing.

Three pieces of information an arc block needs

A straight line can be drawn from its end point alone, but an arc cannot, because countless circles pass through the same start and end points. An arc block therefore needs the direction of rotation (G02 or G03), the end point and either the radius or the center position.

Clockwise as seen from which side?

G02 is clockwise (CW) and G03 is counterclockwise (CCW). However, "clockwise" is defined as seen looking from the plus side toward the minus side of the axis perpendicular to the selected plane. In the default machining center plane G17 (XY), that is looking down at the table from above, so it matches intuition.

In G18 (ZX) or G19 (YZ), the viewing direction changes, and the direction may feel reversed compared with a drawing on screen. Lathes use G18 by default, and the direction of rotation seen on a drawing flips depending on whether the turret is above (rear) or below (front) the spindle center line. Notation of the lathe X axis is covered separately in Lathe diameter programming and G18.

PlaneCommandViewing directionTypical use
XYG17From +Z toward -ZMachining center default
ZXG18From +Y toward -YLathe default, side milling
YZG19From +X toward -XSide milling

What to watch for with R commands

Giving the radius directly, as in G03 X40. Y10. R10., needs almost no calculation and is widely used in hand-written programs. However, even with the same start point, end point and radius, two circles are possible: the short one (180° or less) and the long one (more than 180°).

Most controllers interpret a positive R as an arc of 180° or less and a negative R as an arc of more than 180°. If you forget the R sign when you mean a 270° arc, a 90° arc is produced and the tool cuts in the wrong place. Also, a full circle whose start and end points are the same cannot be defined with R, because R gives only the size of the circle and nothing to fix its position.

I/J/K commands: stating the center directly

I, J and K are the distances from the arc start point to the center in X, Y and Z respectively. On most controllers, I/J/K are read as incremental values from the start point even in G90 absolute mode. The example's G02 X50. Y40. I10. J0. is an arc of radius 10 centered at (50,30), 10 away in X from the start point (40,30).

Because the center is explicit, the I/J/K method suits full circles, arcs larger than 180° and cases where precision matters, such as CAM output. On the other hand, if the end point is not actually on that circle, the start and end radii differ, and an alarm is raised when the difference exceeds the tolerance.

Example path

The first arc is counterclockwise with R, the second is clockwise with I/J, and the last block is a full circle whose start and end points are the same. The drawing shows how the three connect in one path.

A path joining a counterclockwise arc with R, a clockwise arc with I/J and a full circle with I/J

O2002
T2 M6
G21 G90 G17 G94
G54
S2500 M03
G00 X0. Y-5. Z5.
G01 Z-1. F80
Y0. F250
X30.
G03 X40. Y10. R10.
G01 Y30.
G02 X50. Y40. I10. J0.
G01 X70.
G02 X70. Y40. I0. J-15.
G00 Z50.
M30
A path joining a counterclockwise arc with R, a clockwise arc with I/J and a full circle with I/J — XY pathXY
Dashed light blue is G00 rapid traverse; solid orange is cutting motion. Arcs are expanded into calculated static curves.

The figure above is the CNC Path Analyzer result for this program (rapid 2 segments, linear cutting 5 segments, arc 3 segments).

Checklist for finding arc errors

  • Plane: is the intended plane selected among G17/G18/G19? With a different plane, the same G02 becomes a circle in a different direction.
  • R sign: is R written as positive for an arc larger than 180°?
  • End-point agreement: does the radius calculated from I/J equal the distance from the center to the end point? Even rounding differences in the third decimal place can trigger an alarm when they accumulate.
  • Cutter radius compensation: with G41/G42 active, a compensated path cannot be made if an inside arc radius is smaller than the tool radius.
  • Feed rate: when cutting the inside of an arc, the speed of the tool center and the speed at the cutting edge differ. It is common to lower F for small-radius inside arcs.

Practice: converting an R command to I/J

The example's G03 X40. Y10. R10. is a 90° counterclockwise arc of radius 10 from start point (30, 0) to end point (40, 10). The short counterclockwise arc of radius 10 through these two points has its center at (30, 10). The distance from the start point to the center is X 0, Y +10, so the same arc can also be written as G03 X40. Y10. I0. J10..

The final full circle G02 X70. Y40. I0. J-15. has its center at (70, 25) and a radius of 15. Its circumference is 2 × π × 15 ≈ 94.2 mm, so one revolution at F250 takes about 22.6 seconds.

How the tool displays arcs

CNC Path Analyzer approximates arcs with short straight segments, and for arc blocks whose direction or radius does not add up, it reports a warning with the cause line instead of inventing a path. The start point of the warned line is the end point of the previous block, so quite often the coordinates of the linear block just above are wrong rather than the arc block itself.

Frequently asked questions

What happens if R and I/J are written in the same block?
The FANUC family generally gives priority to R and ignores I/J/K. Since this can vary by controller, the rule is to use only one method per block.
Is helical machining also done with G02/G03?
Yes. If you command the axis outside the arc plane (Z for G17) in the same block, that axis moves linearly at the same time as the arc, producing a helical path. This is widely used for thread milling and for entering when enlarging holes.

Next steps

Check the path in CNC Path Analyzer