Modal Custom Macros
These commands can fully emulate canned cycles to perform repetitive CNC machine operations like hole making.
Think of how hole-making canned cycles work. You provide one command (like G81) that sets the initial variables (XY position, rapid plane, hole-bottom position and feed rate), and the CNC machines the first hole. Each subsequent command will machine another hole. You need only provide the information that changes for each additional hole, like the new XY position. Once you have listed the last hole, you specify a G80 command to cancel the canned cycle.
The G66.1 custom macro calling word lets you do the same thing with your own user-created canned-cycle custom macro programs. You can even create a user-defined G code to call it and modify the function of G80 to cancel it it (although we don’t show how to do this in this short article).
G66.1 will accomplish three things:
1. It will set local variables based on the included letter-address arguments.
2. It will execute the program specified by the P word included in the G66.1 command.
3. It will cause each subsequent command to repeat steps one and two until a G67 word is executed (canceling the modal custom macro calling state).
When the custom-macro-ending M99 word is executed, however, all local variables will be set back to vacant (null). If they are to be retained for the next (modal) command, your custom macro program must transfer local variables to more permanent common variables.
Here is a full example that uses this technique for a thread-milling custom macro: