All machining center controls come with a set of helpful hole-machining canned cycles. Most control manufacturers use G codes from G81 through G89 to name them (G81 for drilling, G82 for counter-boring, G83 for peck drilling and so on). While these canned cycles can easily handle the bulk of hole machining operations, there may be times when your application requires that you do something unusual—something that the standard canned cycles can’t handle. Figure 1 shows an example of such a problem.
This application requires a drill to machine through two surfaces. While you can handle this application with G81, there is no way to handle it cleanly. You must either specify two G81 commands (causing the tool to retract after the top surface is machined, thereby wasting time), or you must specify the overall depth with one G81 command (which wastes even more time while the drill cuts air between the surfaces).
While this is a pretty simple limitation of canned cycles, keep in mind that you can create a custom macro to help machine holes whenever you encounter a limitation of standard hole-machining canned cycles.
Figure 1 shows the letter address arguments to be used in the calling G65 command. Here is a portion of a main program that uses our custom macro:
O0001 (Program number)
N005 G90 G54 S1000 M03 (Start spindle)
N010 G00 X1.0 Y1.0 (Move to XY position)
N015 G43 H01 Z0.1 (Instate tool length compensation)
N020 G65 P1000 X1.0 Y1.0 R0.1 Z-1.0 C-1.5 K-2.5 F4.0 A6.0 (Machine hole)
N025 G91 G28 Z0 (Go to the zero return position in Z)
N030 M01 (Optional stop)
Notice from Figure 1 and line N020 above that we’re providing the ability to use two different feed rates. It is likely that the bottom surface will have better support than the top surface, meaning you must feed slower through the top surface than the bottom one.
Here is the custom macro:
O1000 (Program number)
G00 X#24 Y#25 (Move to XY position)
G00 Z#18 (Rapid to R plane)
G01 Z-#26 F#9 (Drill upper surface)
G00 Z#3 (Rapid to R plane above lower surface)
G01 Z-#6 F#1 (Drill lower surface)
G00 Z#18 (Retract from hole)
M99 (End of custom macro)
Again, this isn’t an extremely powerful application, but it does illustrate how you can develop your own canned cycles.
Remember that you can also call this macro with a user-defined G code. You can even make it a modal custom macro call (with a user defined G code). However, parameters must be appropriately set. These two additions will make your hole-machining custom macro behave very much like any control-based canned cycle.