Note: This article is part of CNCCookbook’s G-Code Tutorial.
What does the G49 CNC Code do?
The G49 g code cancels tool length compensation. You can turn it back on again using the "H" word on a G43 or G44 g code.
What is Tool Length Compensation?
Tool Length Compensation is a form of cutter compensation. Closely related is Tool Radius Compensation, which uses the G41 and G42 g-codes.
When Tool Length Compensation is on, the cnc machine compensates for the tool length. What that means is that the X, Y, and Z coordinates are adjusted so they represent the tip of the tool.
If Tool Length Compensation is off, it means X, Y, and Z represent the tip of the spindle, and not the tip of the tool.
Tool Length Compensation is largely about adjustments to the Z Axis since we're talking about tool length here. The tool's length is stored in the CNC Machine's tool table as tool length offsets. The tool length offset value for the tool is added to the current Z axis position when Tool Length Compensation is turned on.
Cutter Radius Compensation is used for X and Y axis compensation.
What are the G codes for tool length compensation?
Tool Length Compensation involves the G43, G44, and G49 g codes, plus the H codes. The H codes tell the machine which tool length offsets to use.
G43 tells the machine to begin applying length compensation by adding the current length offset (selected by the H code) to all Z axis positions. It assumes a positive tool length.
G44 is the alternative to G43. It tells the machine to apply tool length compensation by subtracting the current length offset from all positions. This alternative is rarely seen in practice.
Note that H0 is a special H code. It specifies a length offset value of zero.
Finally, G49 will cancel tool length compensation.
Where should you put G49 in a CNC program?
Note that G49 is not required by most CNC programs because it is rare that you would want to move the tip of your spindle to an exact location. In most cases involving cnc machine tools, it is the tip of your cutting tool you'll be interested in moving.
Some programmers will choose to include G49 as part of their safety block. But, if you just make sure the call out the correct offset (H code) for their tool when that tool is selected, there is really no need to include G49.
Other Considerations when using the G49 G-Code
An H0 , M30 , and RESET (on Haas) will also cancel tool length compensation.
If you rarely use more than one tool on a job, you may not want to bother with tool length compensation.
Note that some machines will immediately move the end of the spindle to the position the cutting tool was previously in when a G49 code is executed. If you're not prepared for this, for example if the cutting tool is still in the spindle, it could lead to a crash.
Be the first to know about updates at CNC Cookbook
Join our newsletter to get updates on what's next at CNC Cookbook.