Understanding G17, G18, G19: Plane Selection in CNC Programming
In CNC machining, G17, G18, and G19 are essential commands for selecting the active machining plane. This setting directly affects how circular interpolation (G2/G3) is interpreted — and a wrong plane selection can cause costly crashes.
This guide covers:
- What each plane does
- When and why to switch planes
- How plane selection affects arc movements
- Real-world examples with G2/G3 in different planes
🧭 What Are CNC Planes?
CNC machines operate in 3D space, but many operations like arcs and holes are 2D in nature. The machine needs to know which plane you’re working in for circular moves.
| Plane | G-Code | Axes Used | Typical Use |
|---|---|---|---|
| XY | G17 | X and Y | Face milling, pockets |
| ZX | G18 | Z and X | End milling, turning |
| YZ | G19 | Y and Z | Side pockets, grooving |
🔧 G17 – XY Plane (Default for Milling)
Most milling operations (e.g., facing, contouring) happen in the XY plane.
📘 Example:
G17 ; Select XY plane
G2 X50 Y50 I25 J0 ; CW arc in XY
This draws a clockwise arc from current position to X50 Y50.
🟢 G17 is active by default on most mills.
🔧 G18 – ZX Plane (Common for Lathes)
Used for operations in the Z-X plane, such as turning or face profiling.
📘 Example:
G18 ; Select ZX plane
G3 X50 Z-10 I25 K0 ; CCW arc in ZX
Essential in lathe programming, especially when defining arcs in profile cuts.
🔧 G19 – YZ Plane
Used less often, but valuable when machining on the side of the part or doing Y-Z oriented features.
📘 Example:
G19 ; Select YZ plane
G2 Y25 Z-10 J10 K0 ; CW arc in YZ
🔁 Interaction with G2 and G3
| G-Code | Motion Type | Affected by Plane |
|---|---|---|
| G2 | Clockwise Arc | ✅ |
| G3 | Counter-Clockwise Arc | ✅ |
Depending on the active plane, the I, J, K values (arc center offsets) change meaning:
| Plane | Center Axes Used |
|---|---|
| G17 | I (X), J (Y) |
| G18 | I (X), K (Z) |
| G19 | J (Y), K (Z) |
📌 Real-World Example: Using All 3 Planes
G17 ; XY plane
G2 X40 Y40 I20 J0 F200
G18 ; ZX plane
G3 X60 Z-20 I10 K0
G19 ; YZ plane
G2 Y60 Z-10 J10 K0
This code moves in 3 different planes using arcs.
⚠️ Plane Selection Pitfalls
| Mistake | Risk |
|---|---|
| Using wrong plane for arc | Machine moves unexpectedly |
| Forgetting to reset plane | Misinterpreted G2/G3 commands |
| Not simulating multi-plane code | Crashes or scrap parts |
🔒 Best Practices
- Always explicitly set the plane before using G2/G3
- Include plane selection in your safe start block
- Simulate arcs in CAM or on controller before live cut
- Reset to G17 at program start and end
✅ Safe Start Block Example
%
O0100
G90 G40 G21 G17 G94 G80
T1 M6
G0 G54 X0 Y0
...
M30
%
💡 Pro Tips
- Use G18 and G19 for complex features like undercuts or turned profiles.
- Mastering plane switching is crucial for 5-axis machining.
- Combine with G68 rotation for angled feature generation.
🧩 Conclusion
Understanding and correctly using G17, G18, and G19 is essential for any serious CNC programmer. These plane selection commands give you control over where and how arcs and curves are machined.
“The right plane is the difference between a perfect arc and a ruined part.”
✅ Next Suggested Topic:
“Understanding G68 & G69: Rotating Coordinate Systems in CNC”
Leave a comment