Tool length offset is a feature of CNC machines that allows the programmer to specify the length of each tool relative to a reference tool. This way, the machine can automatically adjust the Z-axis position of the spindle to account for the difference in tool length, without having to change the program coordinates. This saves time and reduces errors.
The G-code commands for tool length offset are G43 and G44. G43 activates tool length compensation, while G44 cancels it. The syntax for these commands is:
G43 Hnn Znn
or G43 Znn
G44 Hnn Znn
or G44 Znn
where nn
is a numerical value. The H
word specifies the tool length offset number, which corresponds to the tool number in the tool table. The Z
word specifies the Z-axis position of the tool tip. If the H
word is omitted, the tool number from the previous T
word is used.
The sign of the tool length offset value determines the direction of the compensation. A positive value means that the tool is longer than the reference tool, so the machine will move the spindle up by that amount. A negative value means that the tool is shorter than the reference tool, so the machine will move the spindle down by that amount.
Here is a text diagram to illustrate how tool length offset works:
+Z
^
|
| Tool 1 (reference tool)
| +-----------------+
| | |
| | |
| | |
| | |
| +-----------------+
| | |
| | |
| | |
| | |
| +-----------------+ <--- Z0 (program zero point)
| | |
| | |
| | |
| | |
| +-----------------+
| | |
| | |
| | |
| | |
| +-----------------+
| | |
| | |
| | |
| | |
| +-----------------+ <--- Z-50 (spindle position)
| | |
| | |
| | |
| | |
| +-----------------+
| | |
| | |
| | |
| | |
| +-----------------+
| | |
| | |
| | |
| | |
| +-----------------+
| | |
| | |
| | |
| | |
| +-----------------+ <--- Z-100 (workpiece surface)
| | |
| | |
| | |
| | |
| +-----------------+ <--- Z-150 (workpiece bottom)
| | |
| | |
| | |
| | |
| +-----------------+
| | |
| | |
| | |
| | |
| +-----------------+ <--- Z-200 (table surface)
| | |
| | |
| | |
| | |
| +-----------------+
| Tool 2 (longer tool)
| +-----------------+
| | |
| | |
| | |
| | |
| +-----------------+ <--- Z-50 (spindle position with G43 H2)
| | |
| | |
| | |
| | |
| +-----------------+ <--- Z-100 (workpiece surface with G43 H2)
| | |
| | |
| | |
| | |
| +-----------------+ <--- Z-150 (workpiece bottom with G43 H2)
| | |
| | |
| | |
| | |
| +-----------------+
| Tool 3 (shorter tool)
| +-----------------+
| | |
| | |
| | |
| | |
| +-----------------+ <--- Z-50 (spindle position with G43 H3)
| | |
| | |
| | |
| | |
| +-----------------+ <--- Z-100 (workpiece surface with G43 H3)
| | |
| | |
| | |
| | |
| +-----------------+ <--- Z-150 (workpiece bottom with G43 H3)
| | |
| | |
| | |
| | |
| +-----------------+
|
+-------------------------> +X
Here is an example of a CNC program that uses tool length offset:
% (program start)
O1234 (program number)
G90 G54 G17 (absolute coordinates, work offset, XY plane)
T1 M06 (select tool 1)
G43 H1 Z50. (activate tool length offset 1, move to Z50.)
G00 X0 Y0 (rapid move to XY origin)
G01 Z-50 F500. (linear move to Z-50 with feed rate 500 mm/min)
G02 X50 Y0 R25. (clockwise arc move to X50 Y0 with radius 25 mm)
G01 Z-100 F500. (linear move to Z-100)
G03 X0 Y0 R25. (counterclockwise arc move to X0 Y0 with radius 25 mm)
G01 Z-50 F500. (linear move to Z-50)
G00 Z50. (rapid move to Z50.)
M05 (stop spindle)
T2 M06 (select tool 2)
G43 H2 Z50. (activate tool length offset 2, move to Z50.)
M03 S1000 (start spindle clockwise with speed 1000 rpm)
G00 X100 Y0 (rapid move to X100 Y0)
G01 Z-50 F500. (linear move to Z-50)
G02 X150 Y0 R25. (clockwise arc move to X150 Y0 with radius 25 mm)
G01 Z-100 F500. (linear move to Z-100)
G03 X100 Y0 R25. (counterclockwise arc move to X100 Y0 with radius 25 mm)
G01 Z-50 F500. (linear move to Z-50)
G00 Z50. (rapid move to Z50.)
M05 (stop spindle)
T3 M06 (select tool 3)
G43 H3 Z50. (activate tool length offset 3, move to Z50.)
M03 S1500 (start spindle clockwise with speed 1500 rpm)
G00 X200 Y0 (rapid move to X200 Y0)
G01 Z-50 F500. (linear move to Z-50)
G02 X250 Y0 R25. (clockwise arc move to X250 Y0 with radius 25 mm)
G01 Z-100 F500. (linear move to Z-100)
G03 X200 Y0 R25. (counterclockwise arc move to X200 Y0 with radius 25 mm)
G01 Z-50 F500. (linear move to Z-50)
G00 Z50. (rapid move to Z50.)
M05 (stop spindle)
G44 H3 Z50. (cancel tool length offset 3, move to Z50.)
M30 (program end)
% (program end)