G40, G41, G42 Cutter Compensation in CNC Programming Explained
G40 cancels cutter radius compensation, G41 activates left cutter compensation, and G42 activates right cutter compensation. These codes adjust the tool path to compensate for the tool's radius, ensuring accurate machining of the part's shape.How It Works
Cutter compensation in CNC programming helps the machine adjust the tool path to account for the size of the cutting tool. Imagine drawing a shape with a pencil that has a thick tip; the line you draw will be wider than the shape's exact edge. Cutter compensation shifts the tool path so the cut matches the intended shape exactly, not the center of the tool.
G41 and G42 tell the machine to offset the tool path to the left or right of the programmed line, depending on the direction of the cut. G40 turns off this compensation, returning the tool to follow the programmed path directly. This system is like using a stencil and adjusting your pen so the edge of the pen tip follows the stencil line perfectly.
Example
This example shows how to use G41 and G40 to apply and cancel left cutter compensation while milling a simple square.
N10 G90 G21 (Set absolute positioning and mm units) N20 T1 M06 (Select tool 1 and tool change) N30 G00 X0 Y0 (Rapid move to start) N40 G01 Z-5 F100 (Start cutting down) N50 G41 D1 X10 Y0 F200 (Activate left cutter compensation with tool radius offset D1) N60 X10 Y10 (Cut to corner) N70 X0 Y10 (Cut to next corner) N80 X0 Y0 (Cut back to start) N90 G40 (Cancel cutter compensation) N100 G00 Z100 (Retract tool) N110 M30 (End program)
When to Use
Use G41 or G42 when the tool's radius must be compensated to cut the exact shape programmed, especially for complex contours or when tool wear changes the effective tool size. G41 is used when the tool moves with the part on its left side, and G42 when the part is on the right side of the tool path.
Real-world use cases:
- Machining precise pockets or profiles where the tool diameter affects the final shape.
- Compensating for different tool sizes without rewriting the entire program.
- Adjusting for tool wear by changing the offset value without changing the path.
G40 is used to cancel compensation before rapid moves or finishing passes to avoid unexpected tool paths.
Key Points
G40cancels cutter compensation.G41applies left cutter compensation (tool offset left).G42applies right cutter compensation (tool offset right).- Cutter compensation adjusts tool path for tool radius, not the tool center.
- Use compensation to maintain part accuracy and adapt to tool changes.