G10 in CNC Programming: Set Work Offsets and Tool Lengths Like a Pro
In modern CNC programming, G10 is the most precise and safest way to programmatically set:
- Work offsets (G54–G59)
- Tool length offsets (H1–H99)
- Fixture coordinates
- Rotations (if supported)
It allows you to create fully automated programs where you never manually touch the machine’s offset table.
🔹 Basic Syntax: G10 L2 vs G10 L20
There are two commonly used modes:
| Mode | Use |
|---|---|
G10 L2 | Set work coordinate offsets |
G10 L20 | Set tool length or wear offsets |
🔧 Setting Work Offsets with G10 L2
🔹 Set G54 to X100 Y50 Z-25:
G10 L2 P1 X100 Y50 Z-25
| Parameter | Meaning |
|---|---|
L2 | Set WCS (G54–G59) |
P1 | Work offset number (G54) |
X/Y/Z | Offset values from machine zero |
🔹 Set G55 (P2):
G10 L2 P2 X200 Y100 Z-30
🛠 Offset Table Reference
| P Number | Offset | G-Code |
|---|---|---|
| P1 | G54 | G10 L2 P1 |
| P2 | G55 | G10 L2 P2 |
| P3 | G56 | G10 L2 P3 |
| P4 | G57 | G10 L2 P4 |
| P5 | G58 | G10 L2 P5 |
| P6 | G59 | G10 L2 P6 |
🔧 Setting Tool Length Offsets with G10 L20
🔹 Set H1 to 150.0 mm:
G10 L20 P1 Z150.0
P1corresponds toH1- This sets tool length for tool using
H1
🔹 Set H3 to 123.456 mm:
G10 L20 P3 Z123.456
🚀 Real-World Use Example
🔹 Full Setup with Work and Tool Offsets:
G90 G17 G21
(G10: Set G54 to fixture 1)
G10 L2 P1 X0 Y0 Z-25
(G10: Set tool H1 to 150.0 mm)
G10 L20 P1 Z150.0
T1 M6
G54
G43 H1 Z100
G0 X0 Y0
...
No manual offset setup needed — everything is in the program!
⚠️ Safety Notes
- Always verify signs (positive/negative Z) — incorrect Z values can cause crashes
- Don’t mix
G92andG10in the same program - G10 values are persistent — once written, they stay until overwritten
✅ Best Practices
- Use G10 in setup macros or master programs
- Label every G10 move clearly:
G10 L2 P1 X0 Y0 Z-25 ; Set G54
- Back up the machine offset table before using G10 in production
🧠 Pro Tip
Use G10 to preload multiple fixtures:
G10 L2 P1 X0 Y0 Z-25
G10 L2 P2 X200 Y0 Z-25
G10 L2 P3 X400 Y0 Z-25
Then just call G54, G55, or G56 as needed!
📌 Summary
| Task | Code Example |
|---|---|
| Set G54 to (100, 50, -25) | G10 L2 P1 X100 Y50 Z-25 |
| Set G55 to (200, 100, -30) | G10 L2 P2 X200 Y100 Z-30 |
| Set H1 to 150mm | G10 L20 P1 Z150.0 |
| Set H3 to 123.456mm | G10 L20 P3 Z123.456 |
🧠 Final Thoughts
G10 = Reliable automation + safer setups
If you’re aiming for zero manual input, consistent results, and fully portable programs, G10 is your go-to command.
“With G10, the machine doesn’t forget — and neither do you.”
✅ Next Suggested Topic:
“G68 and G69: Coordinate Rotation for CNC Machining”
Leave a comment