Bird
0
0
CNC Programmingscripting~5 mins

Tool diameter compensation concept in CNC Programming

Choose your learning style9 modes available
Introduction
Tool diameter compensation helps the machine adjust the path to cut the exact size of the part, even if the tool is bigger or smaller than expected.
When the cutting tool wears down and becomes smaller.
When using different tools with slightly different diameters for the same job.
When you want to program the part size without changing the tool path every time.
When you need precise control over the final size of the part.
Syntax
CNC Programming
G41 Dxx (left compensation)
G42 Dxx (right compensation)
G40 (cancel compensation)
Dxx refers to the tool diameter offset number stored in the machine.
G41 moves the tool path to the left of the programmed line, G42 to the right.
Examples
Starts left tool diameter compensation using offset 1, then moves the tool to X50 Y50.
CNC Programming
G41 D1
G01 X50 Y50 F100
Starts right tool diameter compensation using offset 2, then moves the tool to X100 Y0.
CNC Programming
G42 D2
G01 X100 Y0 F150
Cancels any tool diameter compensation and moves the tool to X0 Y0.
CNC Programming
G40
G01 X0 Y0
Sample Program
This program sets absolute positioning and cancels compensation first. It selects tool 1, moves to start, then applies left tool diameter compensation with offset 1 while moving along an L-shaped path. Finally, it cancels compensation and ends.
CNC Programming
N10 G90 G40 G21
N20 T1 M06
N30 G00 X0 Y0
N40 G41 D1 G01 X50 Y0 F200
N50 Y50
N60 G40 G00 X0 Y0
N70 M30
OutputSuccess
Important Notes
Always start compensation (G41 or G42) before the cutting move to avoid errors.
Cancel compensation (G40) before tool changes or program end to prevent unexpected moves.
Tool diameter offsets (D values) must be set correctly in the machine tool offset table.
Summary
Tool diameter compensation adjusts the tool path to cut the exact part size.
G41 is for left compensation, G42 for right, and G40 cancels compensation.
Use compensation to handle tool wear and different tool sizes without changing the program.