Tool Changes and Tool Offsets in G-Code

Learn CNC Programming with CNCCookbook’s G-Code Tutorial

G-Code Tool Changes

Most CNC g-code programs will have one or more g-code tool changes programmed into them. This will be true even if your machine doesn’t have an automatic tool changer. That’s because the tool change programming serves two purposes. First, in the case of a machine with an automatic tool changer (ATC), the tool changing g-codes tell the ATC to load a particular tool in the spindle or, in the case of a lathe, to rotate that tool into position on the lathe’s turret. The second role of these codes is to set up a different tool length offset. The tool length offset tells the CNC machine how much the length of the current tool differs from tool #1. It will adjust its notion of where the tool tip is when you make your next move based on this.

Accomplishing these two functions can require anywhere from one to several g-codes. Let’s go through each possible g-code and it’s style of use.

T Tool Select and M06 Tool Change

The “T” word is commonly used to select a tool. On a VMC with ATC, usually the “T” word tells the mill to select that tool, but it requires the M06 word to be executed before the tool is actually changed. This gives the ATC a little bit of advanced warning, allowing it to rotate the new tool into position while the machine is busy doing something else, which can make for a faster tool change. On most lathes, and even for some mills, the M06 is not needed. On those machines, it is likely an error to use an M06.

Sample tool change using T + M06

N10 T12 ( Select Tool #12 )

N20 M06 ( Change to selected tool )

If the machine doesn’t use M06, the sample would look like this:

N10 T12

If you wanted to take advantage of the separate T and M06 to give your machine maximum time to get ready in order to make the tool change faster, you’d do something like this:

T12

M06

T14

(Machining with T12 in spindle, but T14 is ready for next M06)

M06

(Now T14 is loaded)

T02 (Setting up T02 for later)

(Machining with T14)

M06

(Now T02 is in spindle)

( etc. )

 

Random Memory Tool Selection

One trick some machines use to make tool changes go even faster is to set it up so tools don’t have to go back into a particular pocket on the changer. Instead, the machine just sticks the tool in the nearest pocket so it doesn’t have to take so long to rotate a pocket into position. The machine keeps track of which slot T02 is actually in, for example, and you can always refer to it as “T02”
no matter what slot it winds up in.

 

 

Recently updated on April 30th, 2024 at 11:18 am