How does G66 work?
G66 is one of the more misunderstood custom macro B commands. Fanuc calls it a modal custom macro call. It looks just like a G65 command. Consider these two commands:
N045 G65 P1000 X3.0 Y3.0 Z0 A45.0 H8.0 F4.5
N045 G66 P1000 X3.0 Y3.0 Z0 A45.0 H8.0 F4.5
If you’ve worked with custom macro B, you know the G65 command will set the values of local variables #24 (X), #25 (Y), #26 (Z), #1 (A), #11 (H), and #9 (F) and then execute program O1000. With G65, that is, the program specified by the P word will be executed as part of the command.
While the G66 command is written in exactly the same manner, there is an important difference. Program 01000 will not be executed as part of the G66 function. G66 will set the values of local variables 24 (X), #25 (Y), #26 (Z), #1 (A), #11 (H), and #9 (F). But that’s it. G66 also puts the machine into a modal state. Every CNC command it executes from the G66 command (until G67 that cancels G66) will call program O1000 and the local variables will be set as specified in the G66 command).
When is this helpful?
G66 can be helpful when you have a given machining operation that must be performed at several locations on a workpiece. Maybe you must mill a round counter-bore or mill a square pocket in several XY locations. Consider these commands in the main program:
N070 G66 P1001 X1.0 Y0.5 R0.1 Z-0.5 F6.0
N075 X5.0 Y5.0 (First pocket location)
N080 X3.0 Y3.0 (Second pocket location)
N085 X1.0 Y1.0 (Third pocket location
N090 G67 (Cancel modal call)
In the G66 command, X represents the pocket length, Y the pocket width, R the approach position, Z the pocket depth, and F the feedrate for milling. And #24, #25, #18, #26, and #9 will be assigned. The custom macro (O1001) will include the necessary motions for one of the pockets. But again, N070 will not machine a pocket. Line N075 will cause the machine to first move to X5.0 Y5.0 and then call program O1001. This will be repeated until the machine executes the G67 in line N090.