Multiple machining operations on holes

It is not uncommon to perform several machining operations on a group of holes. You may, for example, have to spot drill, drill, and tap several holes. The more holes you must machine, the more redundant commands there will be in your program. And if you are programming manually, each operation will be quite error prone. This means you must cautiously verify each tool.

This is an excellent application for using sub-programs. The more holes that must be machined, the more this technique will help. And, if the first operation is correct – hole locations and obstruction clearing – you can rest assured that all other operations will be correct as well. After all, the same commands will be used.

How to do it

In the main program, you will include a command for each cutting tool that machines the first hole, specifying how the holes are to be machined (cycle type, hole bottom, rapid plane, feedrate, etc.). Then you will command the related subprogram to be executed. In the sub-program, you will include all of the other hole locations, as well as any other commands that might be necessary (like G98 and G99 words to clear obstructions).


Here is an example main program:

  • O0046

  • N005 T01 M06 (CENTER DRILL)

  • N010 G54 G90 S1200 M03 T02

  • N015 G00 X1.0 Y1.0

  • N020 G43 H01 Z2.0

  • N025 G81 R0.1 Z-0.15 F3.0

  • N030 M98 P1000

  • N035 T02 M06 (27/64 DRILL)

  • N040 G54 G90 S700 M03 T03

  • N045 G00 X1.0 Y1.0

  • N050 G43 H02 Z2.0

  • N055 G73 R0.1 Z-0.7 Q0.1 F6.0

  • N058 M98 P1000

  • N060 T03 M06 (1/2-13 TAP)

  • N065 G54 G90 S229 M03 T01

  • N070 G00 X1.0 Y1.0

  • N075 G43 H03 Z2.0

  • N080 G84 R0.25 Z-0.75 F17.6

  • N085 M98 P1000

  • N090 G28 Y0

  • N095 M30

Here is the sub-program:

  • O1000 (1/2-13 holes)

  • N001 X6.0

  • N002 X11.0

  • N003 X10.0 Y5.0

  • N004 X4.0

  • N005 X1.0 Y10.0 G98

  • N006 X6.0 G99

  • N007 X11.0

  • N008 G80

  • N009 G91 G28 Z0 M19

  • N010 M01

  • N011 M99

In lines N020, N050, and N075, notice that the tool is brought to within 2.0 inches of the work surface. This sets the initial plane for clearing obstructions with G98 and G99. In lines N025, N055, and N080 of the main program, the appropriate canned cycle command is given and the first hole is machines. In lines N030, N058, and N085, subprogram O1000 is executed, which contains the balance of the holes to be machined. Notice the G98 in line N005 of the sub-program. There is an obstruction (maybe a clamp) between this hole and the next. In line N006, the R plane is reset so the tool will not continue to retract to the initial plane (only one obstruction to clear). Finally, notice that certain tool ending commands are redundant and included in the subprogram (lines N009 and N010) to minimize the number of commands required yet further.

The only problem with this technique is that more than one program is required for a given job. Indeed, if you have five different kinds of holes that must be machined, you’ll have six programs if you use this technique for each. It can be difficult enough to track one program per job, let alone many. And loading individual programs may be difficult.

We can solve the program loading problem by including all of the programs in one file on your DNC system. A parameter within the machine controls whether the machine will stop reading a program at the program ending word (M02, M30, or M99), or whether it will continue reading until an end-of-file delimiter (a percent sign - % is read). This parameter will be the topic of the Parameter Preference article later in this newsletter.

Additionally, some Fanuc compatible controls (but not most Fanuc controls) allow you to include the sub-programs right in the main program, before the end of program command. This allows you to keep all of the commands related to a job in one program – simplifying the tracking and loading of your programs.

cnc reverse logo.jpg

44 Little Cahill Road

Cary, IL  60013

Ph: 847-639-8847

  • Facebook Social Icon