G2 & G3 Explained: Circular Interpolation with R and IJK in CNC Programming
Circular interpolation allows the CNC machine to create arc movements instead of straight lines. This is essential for profiles like circles, fillets, or complex contours.
- G2 = Clockwise arc
- G3 = Counterclockwise arc
These codes define arcs in a selected plane using either:
- R method (arc radius)
- IJK method (center offset)
📘 G2 and G3 Basic Syntax
🔹 Using R (Radius)
G17 ; XY plane
G2 X50 Y50 R25 F100
- Starts from current X/Y position
- Moves in an arc to X50 Y50
- Radius of arc = 25mm
🔸 Using IJK (Center Offsets)
G17 ; XY plane
G3 X50 Y50 I10 J0 F100
- I = X distance from current position to arc center
- J = Y distance to arc center
- More precise than R
🎯 G-Code Motion Planes
| G-Code | Plane | Axes Used |
|---|---|---|
| G17 | XY Plane | X and Y |
| G18 | XZ Plane | X and Z |
| G19 | YZ Plane | Y and Z |
📌 Example: Arc in XZ Plane
G18 ; XZ plane
G2 X40 Z-10 R10
🔄 G2 vs G3
| Code | Direction | Typical Use |
|---|---|---|
| G2 | Clockwise | Circular pockets |
| G3 | Counterclockwise | Outside profiles |
Direction is always relative to the selected plane and tool motion.
🔧 Full Example with R
G17 G90 G21
G0 X0 Y0
G1 Z-5 F100
G2 X50 Y0 R25 F200
- Creates a 180° clockwise arc from (0,0) to (50,0)
- Radius = 25mm
- Center is automatically inferred
🛠️ Full Example with IJK
G17 G90 G21
G0 X0 Y0
G1 Z-5 F100
G2 X50 Y0 I25 J0 F200
- From (0,0) to (50,0), center at (25,0)
- Creates perfect semicircle
- Allows more control than R
📏 R vs IJK – Key Differences
| Feature | R Parameter | IJK Parameters |
|---|---|---|
| Simplicity | Easier to write | Requires more detail |
| Control | Less precise | Full control over arc |
| Arc > 180° | Ambiguous | Always accurate |
| Compatibility | Widely supported | Recommended for CAM |
⚠️ R Method Limitations
- Ambiguous when arc > 180°
- Control may choose either shorter or longer path
- May not work well on high-precision parts
🔥 Tip: Use IJK for complex geometries and >180° arcs.
🔄 Clockwise vs Counterclockwise Arcs
Imagine a circle. If tool moves clockwise around it, that’s G2.
If it moves counterclockwise, that’s G3.
The direction is always from the start point to the end point relative to the current plane.
📘 Using G91 (Incremental) with Arcs
You can use arcs in incremental mode too:
G91
G2 X50 Y0 I25 J0
- Movement from current location
- I and J are still relative to start point
🎓 Best Practices for Arc Programming
- ✅ Use G17/G18/G19 to clearly set plane
- ✅ Use IJK for precision-critical parts
- ✅ Add feedrate (F) to arc commands
- ❌ Avoid arcs without Z height set (for safety)
- ❌ Don’t mix R and IJK in same block
🧠 Common Mistakes
- ❌ Omitting I, J or R → no arc generated
- ❌ Wrong sign on I/J → arc moves wrong direction
- ❌ Using G2 when G3 is intended (or vice versa)
- ❌ Skipping G17/18/19 → arc on wrong plane
✅ Final Summary
| G-Code | Action | Notes |
|---|---|---|
| G2 | Clockwise arc | Requires end point + R or IJK |
| G3 | Counterclockwise arc | Same as above |
| G17 | XY plane | Default in most machines |
| G18 | XZ plane | Use for front-face arcs |
| G19 | YZ plane | Side-facing arcs |
🔚 Final Thoughts
Understanding circular interpolation is essential for producing accurate curved geometry and smooth transitions between linear and circular toolpaths.
- Use R for simplicity
- Use IJK for control
- Always test with simulation before actual run
Whether you’re pocketing, profiling, or threading — mastering G2 and G3 will elevate your CNC programming from basic to professional.
Leave a comment