Linear cuts (G01) are the foundation of machining, but parts are rarely made of just straight lines. To cut arcs, radii, and full circles, we use Circular Interpolation. In CNC programming, this is controlled by two of the most important G-codes: G02 and G03.
1. What Are They?
G02 and G03 command the machine to move two axes simultaneously in a circular motion at a specified feed rate.
G02
Clockwise (CW) Circular Interpolation. The tool will move in a clockwise direction from its starting point to its endpoint.
G03
Counter-Clockwise (CCW) Circular Interpolation. The tool will move in a counter-clockwise direction.
2. The Anatomy of an Arc Command
To cut an arc, the CNC controller needs three pieces of information to do the math:
- Start Point: Where the tool currently is (established by a previous G00 or G01 command).
- End Point: Where the arc finishes (the X, Y, or Z coordinates in the G02/G03 block).
- Arc Center: Where the center of the circle is located. This can be defined in two ways: the R (Radius) Method or the I, J, K Method.
3. The Axis Mapping Table: I, J, K vs. X, Y, Z
When you use the I,J,K method, these letters act as the "center point pointers" for your primary axes. Here is the golden rule for matching them up:
Axis Reference Guide
| Primary Axis (End Point) | Arc Center Offset Axis |
|---|---|
| X Axis | I (Offset along X) |
| Y Axis | J (Offset along Y) |
| Z Axis | K (Offset along Z) |
Example: If you are cutting a circle on the XY plane (G17), you will only use X, Y coordinates and I, J offsets.
4. Method 1: The 'R' (Radius) Method
This is the easiest method for manual programming. You simply tell the machine the endpoint and the radius (R) of the arc.
G01 X0.0 Y0.0 F15.0
(Cut a clockwise arc to X2.0 Y2.0 with a 1-inch radius)
G02 X2.0 Y2.0 R1.0 F10.0
The 'R' Method Limitation
You cannot cut a full 360-degree circle using the R method. If the start point and end point are exactly the same, the machine doesn't know which way around the circle to go. Also, if your arc is greater than 180 degrees, you must use a negative R value (e.g., R-1.0).
5. Method 2: The 'I, J, K' Method
This is the standard output for CAM software because it is mathematically precise and can cut a full 360-degree circle in a single line of code.
How it works: I, J, and K represent the incremental distance and direction from the Start Point to the Center of the Arc.
(Center of the circle is at X0.0 Y0.0)
G01 X1.0 Y0.0 F15.0
(Full CCW Circle. Endpoint omitted because it's the same as Start point)
G03 I-1.0 J0.0 F10.0
Breaking down the I, J, K math:
In the example above, the tool starts at X1.0. The center of the circle is at X0.0. To get from the start point to the center point, you have to move negative 1 inch along the X-axis. Therefore, I = -1.0.
The Y starting position is Y0.0, and the Y center is Y0.0. There is no change along the Y-axis to get to the center. Therefore, J = 0.0.
Visualize Your G-Code
Want to see G02 and G03 in action? Copy the code snippets above and paste them into our interactive G-Code Viewer to instantly see the toolpath drawn on your screen.
Open G-Code Viewer6. Common Errors: Radius Tolerance
When hand-coding with I, J, K, it is easy to make a math error. If the distance from the start point to the center (I,J) does not perfectly match the distance from the end point to the center, the CNC controller will throw a "Radius Tolerance Out of Range" alarm. The R method is more forgiving in this regard, as the controller forces the math to work.
Conclusion
Understanding G02 and G03 is a rite of passage for CNC machinists. While CAM software generates these codes automatically, being able to read an I, J, K line on your controller is essential for troubleshooting bad toolpaths, modifying lead-ins, and understanding machine alarms.