Tool Radius Compensation in CNC: G40, G41, G42 Explained
Tool Radius Compensation (TRC) allows a CNC machine to account for the physical size of a cutting tool by offsetting the toolpath. This ensures the programmed contour matches the desired part geometry regardless of cutter diameter.
🔧 Why Use Tool Radius Compensation?
- Allows the same program to run with different cutter sizes
- Compensates for tool wear or resharpening
- Enables fine-tuning during finishing passes
- Avoids recalculating CAM toolpaths
🔢 G-Code Overview
| G-Code | Function |
|---|---|
| G40 | Cancel cutter compensation |
| G41 | Compensate to the left of the path (climb milling) |
| G42 | Compensate to the right of the path (conventional milling) |
🧭 Determining G41 vs G42
Use the direction of tool movement and imagine standing on the tool looking forward along the toolpath.
- If the part is on your left, use
G41 - If the part is on your right, use
G42
🟦 G41 = Cutter left
🟥 G42 = Cutter right
📘 Tool Table Offset: D-Word
To tell the control how much to compensate, you use the D-word (e.g., D01), which refers to a tool radius stored in the tool offset table.
Example:
G1 G41 D01 X50 Y50 F200 ; Start compensation
Make sure tool #1 has the correct radius value in the offset table!
🧪 Example: Using G41
T1 M06 ; Tool 1 - 10mm endmill
G90 G54
G0 X0 Y0
G1 Z-5 F100
G1 G41 D01 X50 Y0 F200
X50 Y50
X0 Y50
X0 Y0
G1 G40 X0 Y0 ; Cancel compensation
G0 Z100
✅ The machine compensates for the 5mm tool radius during movement.
❗ Entry and Exit Moves
Tool compensation must be enabled before entering the actual part profile and cancelled after exiting.
Recommended approach:
- Add a lead-in line before the contour when enabling
G41/G42 - Add a lead-out move before
G40
Example:
G1 G41 D01 X10 Y0 ; Entry move
(profile)
G1 G40 X0 Y0 ; Exit move
🛠️ Canceling Compensation: G40
Always use G40 to turn off compensation before:
- Lifting the tool
- Changing tools
- Ending the program
Failure to do so may cause errors or crashes.
🧠 Common Mistakes & Fixes
| Mistake | Solution |
|---|---|
| Not providing a valid lead-in | Add entry move before G41/G42 |
| No D-word in compensation line | Add Dnn matching the offset table |
| Forgetting to cancel with G40 | Always follow compensation with G40 |
| Tool radius set to 0 | Set correct value in offset table |
📏 Use Case: Multiple Tools with Same Program
By adjusting the D-values in the tool table, you can use the same program with:
- 8mm, 10mm, or 12mm tools
- Adjusted radii without modifying the G-code
- On-the-fly wear compensation
; For tool 2 with 12mm cutter
G41 D02
💡 Summary
Tool radius compensation makes your CNC programs:
- Flexible for different cutters
- Accurate regardless of tool wear
- Easier to tweak for high-precision parts
By mastering G40, G41, and G42, you gain fine control over the exact geometry your tool produces — a must for high-end CNC machining.
Leave a comment