G2 & G3: Circular Interpolation Explained – Mastering Arcs in CNC
In CNC programming, G2 and G3 are used to generate circular or arc movements in the currently active plane (set by G17, G18, or G19). These commands are essential for smooth contouring, circular pockets, threads, and more.
🌀 What Are G2 and G3?
| G-Code | Motion | Direction |
|---|---|---|
| G2 | Circular Move | Clockwise (CW) |
| G3 | Circular Move | Counterclockwise (CCW) |
🧭 Arc Movement Parameters
You can define arcs in two main formats:
🔸 R Format (Radius)
G2 X50 Y50 R25
- Simple and easy to use
- Radius (
R) defines the arc curvature - May cause ambiguity with arcs >180°
🔹 IJK Format (Center Offset)
G3 X50 Y50 I25 J0
- More precise and reliable
I,J,Kdefine distance from start point to arc centerIandJare used in G17 (XY plane)IandKare used in G18 (XZ plane)JandKin G19 (YZ plane)
🧪 Example: G17 Plane (XY)
G17 ; XY plane active
G0 X25 Y0
G2 X25 Y50 I0 J25 ; CW arc from Y0 to Y50 with center at Y25
This moves in a clockwise quarter-circle.
📐 Visual Explanation (IJK)
- Start point: (25, 0)
- End point: (25, 50)
- Center point: (25, 25)
So:
I = 0(center X – start X)J = 25(center Y – start Y)
⚠️ Arc Direction Depends on Plane
Make sure you select the correct plane (G17/G18/G19) before programming arcs.
| G-Code | Plane | Active Axes | IJK Components |
|---|---|---|---|
| G17 | XY | X/Y | I, J |
| G18 | XZ | X/Z | I, K |
| G19 | YZ | Y/Z | J, K |
🔧 Real-World Example: Milling a Circular Pocket
%
O3001 (Circular Pocket)
G21 G90 G17
T1 M6
G0 X0 Y0
G43 H1 Z100
S1200 M3
G0 Z5
G1 Z-5 F200
G2 X0 Y0 I10 J0 F300 ; Clockwise arc with 10mm radius
G1 Z100
M30
%
🔁 G2/G3 with Full Circles
To create a full circle using IJK:
G3 X0 Y0 I10 J0 ; Start and end at same point
Note: This must be supported by the controller. Some require splitting into two semicircles.
📊 G2/G3 Syntax Comparison
| Format | Syntax | Pros | Cons |
|---|---|---|---|
| R | G2 X.. Y.. R.. | Easy to write/read | Ambiguity in >180° arcs |
| IJK | G3 X.. Y.. I.. J.. | Precise control | Requires vector math |
🧠 Tips for CAM Integration
- CAM software often outputs IJK format, especially for 3D surfaces
- Post-processors allow choosing between R or IJK
- Always double-check the arc direction when editing CAM output manually
🛡️ Common Mistakes
| Issue | Likely Cause | Solution |
|---|---|---|
| Tool moves in wrong arc | Wrong G2/G3 or wrong IJK sign | Reverse G2 ↔ G3 or correct signs |
| Arc creates unexpected shape | Wrong plane selected (G17/G18/G19) | Set correct plane before arc |
| Arc goes straight or error | IJK values not matching arc radius | Check vector math or use R format |
| Full circle not accepted | Controller doesn’t support full arc | Split into 2 semi-circles |
🔧 Advanced: Helical Interpolation
You can combine G2/G3 with Z-axis motion for helical paths (e.g., thread milling):
G3 X0 Y0 Z-5 I10 J0
This moves in a descending spiral, excellent for boring or threading.
📐 How to Calculate IJK Values
Assume:
- Start: (X0 Y0)
- End: (X50 Y0)
- Arc center at (X25 Y25)
So:
- I = 25 (center X – start X)
- J = 25 (center Y – start Y)
G3 X50 Y0 I25 J25
🔚 Final Thoughts
Mastering G2 and G3 unlocks powerful contouring capabilities in CNC. Understanding the relationship between arc direction, plane selection, and IJK vs R formatting is essential.
Arcs may look simple, but precision demands clarity. Think like the controller.
Leave a comment