On most CNC machines, the T code tells the machine the tool to place in the tool changer to prepare it for a tool change.
The M06 command will then perform the tool change.
On some CNC machines, the T code will actually switch to the tool called out.
The T command is a very important CNC code because most programs will use multiple tools during the execution of a program. It is not uncommon for dozens of tool changes to be performed in the process of running a more complex program.
Want to learn more about CNC G Code?
When does the T code get used?
The T code is used at the start of a program to make sure the correct tool is loaded before any machining is performed.
After this initial setup, the T code is used every time the machine switches to a new tool.
If tool #1 is currently in the CNC spindle, calling tool #2 with the T02 command will ready it in the tool changer. Using the M06 command will swap tools.
Readying the tool before the switch saves precious machining time, something that is more important for high volume production machining.
Even though the tool is already loaded in the tool changer, it is advised to still call the T02 command in this instance to make sure that the correct tool is loaded.
The code would look like this:
<machining code here>
Again, this format is used to ensure that the correct tool is placed in the CNC spindle during the tool change.
Without using the T02 command right before the M06 tool change command, it is possible that another is loaded in the tool change position and will be swapped in.
Imagine if you needed to re-run a portion of the code and started your program after the initial T02 code. If you didn’t repeat the T02 code right before the tool change then the machine would use the last tool number from its memory.
There is a good chance that it isn’t swapping the correct tool which can mean a machine crash.
How to change tools
CNC cutting tools are changed using the M06 command. On some machines (usually older CNCs), the T code will cause the machine to perform a tool change.
Check your machine manual to know how your machine will react.
If your machine is equipped with an automatic tool changer, then it is likely that you will be using the M06 command to change tools.
How is the T code used differently on mills vs lathes
As stated above, most CNC milling programs need the use of more than one tool to complete the machining of a workpiece.
Therefore, the usage of T code for tool changes is essential.
On lathes, the T change is less common because the same cutter can perform many turning operations.
However, operations such as parting-off, threading, and drilling require specific tools. The number of tools allowed on a CNC lathe depends on the number of cutters that fit in the machine’s turret.
Where should you document your tools?
Information about your tools should be stored in two locations, on your machine setup sheet and in your tool offset library.
The setup sheet is used to communicate to the machine operator what tools are expected to be loaded in the machine while running the program.
The tool offset library, sometimes called the tool offset table stores information related to the size of your cutting tools. This includes both the diameter (D offset) and tool length or height (H offset).
The D offset and H offset values allow the machine to compensate for the size of the cutting tool and accurately machine the part.
Frequently asked questions about the T code
What does T0X.0X mean?
You may see some codes that have two numbers separated by a dot along the T code (e.g. T01.01).
This formatting exists because some controllers such as Fanuc allow different offsets to be assigned to the same tool.
Depending on the type of operation performed by the tool, you may need to change its offset values. T01.01 is tool #1, offset 1. T01.02 would be tool #1, offset 2.