top of page
Search

# Using Custom Macro to streamline tool length measurements

This rather advanced technique assumes your control has parametric programming (example shown in custom macro B). If you have this feature, you can eliminate the error-prone calculations and tool length compensation offset entry needed for tools on machining centers!

While nothing beats the efficiency of measuring tool lengths off-line, there are times when production quantities are so low that there is no real advantage to measuring tool lengths off-line, and many companies have their CNC operators measuring tool length values on-line. Like the suggestion from Mr. Engel, this technique uses custom macro B to allow us access to the machines current position and to tool length compensation offsets from within the CNC program.

System variable #5003 gives us access to the current absolute Z position and the #2000 series system variables give us access to the tool length compensation offsets. This particular example assumes you are using the length of the tool as the tool length compensation offset value. However, it could be easily modified if you use the distance from each tool tip down to program Zero in Z as your tool length compensation value.

To keep this program simple, we assume a vertical machining center and work in sequential tool order starting with tool station number one. The operator will simply stop the program when the last tool length is measured. More elaborate techniques could be used if you wanted the operator to be able to designate which tool stations require measuring. Additionally, this program assumes all tools to be measured are in the machine's tool changer magazine and that there is no tool in the spindle at the time this program is run.

Program:

• O9100 (Program to touch off tool lengths)

• #3006=101 (TOUCH SPINDLE NOSE TO BLOCK)

• #5003=0 (Set current Z position as program Zero surface)

• G91 G01 Z1.5 F30. (Move away from block in Z)

• G91 G28 Z0 M19 (Move to tool change position)

• #101=1 (Counter for tool station number)

• N1 T#101 M06 (Place current tool in spindle)

• #3006=102 (TOUCH TOOL TIP TO BLOCK)

• #[2000 + #101]=#5003 (Set tool length compensation offset)

• G91 G01 Z1.5 F30. (Move away in Z)

• G91 G28 Z0 M19 (Move to tool change position)

• #101=#101 + 1 (Step tool station counter)

To use this program, the setup person loads all tools to be measured into the tool changer magazine. Then, just as when measuring tool lengths completely manually, they will place a block on the table to be used as a reference point in Z (the top surface of the work holding setup is commonly used). They will then position the machine in X/Y so that the spindle nose (no tool in spindle) is above the block. When this program is run, the operator will be asked to touch the spindle nose to the block. Just as when measuring tool lengths completely manually, the operator will place the machine in manual mode, use jog to quickly position the spindle nose close to the block, and then cautiously touch the block (or gauge block) with the handwheel.

When this is done, they will place the machine back in automatic mode and press cycle start. The control will record this position in Z as the current program zero point (just like the operator does when manually resetting the Z axis display to zero) and then automatically move the machine to its tool change position. Tool number one will be placed in the spindle and the machine will stop again. The operator places the mode switch back to jog and cautiously touches the tool tip to the block. When this is done, they place the mode switch back to automatic and press cycle start. The length of tool is automatically stored in offset number one! This process is repeated for each tool until the last tool length is measured. This technique dramatically simplifies the tool length measuring process for the operator and eliminates tool offset entry mistakes.