M6 (Tool Change)
To change a tool in the spindle from the tool currently in the spindle to the tool most
recently selected (using a T word - see Section 3.7.3), program M6. When the tool change is complete:
- The spindle will be stopped.
- The tool that was selected (by a T word on the same line or on any line after the previous tool change) will be in the spindle. The T number is an integer giving the changer slot of the tool (not its id).
- If the selected tool was not in the spindle before the tool change, the tool that was in the spindle (if there was one) will be in its changer slot.
- The coordinate axes will be stopped in the same absolute position they were in before the tool change (but the spindle may be re-oriented).
- No other changes will be made. For example, coolant will continue to flow during the tool change unless it has been turned off by an M9.
The tool change may include axis motion while it is in progress. It is OK (but not useful) to program a change to the tool already in the spindle. It is OK if there is no tool in the selected slot; in that case, the spindle will be empty after the tool change. If slot zero was last selected, there will definitely be no tool in the spindle after a tool change.
The tool change command will call the change_tool subroutine inside macro.cnc.
You can adapt the behavior for your own needs in this function e.g:
- Perform automatic tool-length measurement
- Perform tool change with an automatic tool changer.
For a (non-functional) example of how to implement automatic tool change for a 16-tool changer. see the contents of the default_macro.cnc file at the end of this document. It checks whether the current tool is already in the spindle. It checks that the tool number is in the range of 1-4. Then it first drops the current tool and picks the new tool: