Every so often I get a question related to how standard canned cycles work – or rather – how they don’t work in a manner desired by the questioner. Here is an example I recently received:
We just bought a Haas with high pressure coolant to drill holes in a radial fashion through tubes – as many as 25,000 holes per part. I use G81-G82-G83-G73 to minimize program length and complexity. The problem is that with the new carbide drills I am using, the tooling people are telling me I need to reduce feedrate as the drill breaks through the material in order to prevent the drill corners from failing. I was wondering if there is a macro type programming tool I could use for this application which would allow me to call it once at the beginning of a drilling cycle and have it repeat at each location defined in a subprogram and then cancel the macro simply, as I do now with G80. Thanks for your help in this matter.
While you may not have this specific canned cycle need, there may be times when you wished that a given hole-machining canned cycle behaved differently. Or maybe you wanted to create a canned cycle for your own specific needs. Believe it or not, this is easily possible with custom macro B. You can even make the calling G code modal, making it behave much like any built-in canned cycle.
The first task is to develop a workable custom macro to handle the application. In our case, we need to be able to have a drill machine most of the hole at one feedrate, then complete the hole at a different feedrate. For now, we’ll use a G65 (custom macro calling word) to activate the custom macro – and we’ll try to make the letter address arguments (variables) match those used in a G81 command. Here is an example of a calling program that uses the custom macro:
O0001 (Main program)
N005 T01 M06 (Load drill in spindle)
N010 G90 S600 M03 (Start spindle)
N015 G00 X1.0 Y1.0 (Move to first hole location)
N020 G43 H01 Z0.1 M08 (Instate tool length compensation, move above work surface)
N025 G65 P9010 R0.1 Z-0.75 F8.0 W-1.0 H3.0 (Machine one hole)
N030 G91 G28 Z0 M19 (Retract to tool change position)
N035 M01 (Optional stop)
.
.
.
Line N025 calls the hole-machining custom macro (program O9010). R specifies the rapid plane, Z the intermediate hold depth, and F the initial feedrate. So far, these words are just as they are in the G81 drilling cycle. We’ve added W to specify the final hole-bottom position and H to specify the “break-though” feedrate. Here is one version of the custom macro that will work. Note that we’re assuming that the tool is already at the XY hole-position and 0.1 inch above the work surface when this custom macro is called.
So far, of course, the calling program (O9010) machines only one hole. If more holes must be machined, one way to do so would be to move to another hole location and repeat the G65 command. Here is another program that machines five holes using this technique.
O0002 (Main program)
N005 T01 M06 (Load drill in spindle)
N010 G90 S600 M03 (Start spindle)
N015 G00 X1.0 Y1.0 (Move to first hole location)
N020 G43 H01 Z0.1 M08 (Instate tool length compensation, move above work surface)
N025 G65 P9010 R0.1 Z-0.75 F8.0 W-1.0 H3.0 (Machine first hole)
N027 X2.0
N030 G65 P9010 R0.1 Z-0.75 F8.0 W-1.0 H3.0 (Machine first hole)
N033 X3.0
N035 G65 P9010 R0.1 Z-0.75 F8.0 W-1.0 H3.0 (Machine first hole)
N037 X4.0
N040 G65 P9010 R0.1 Z-0.75 F8.0 W-1.0 H3.0 (Machine first hole)
N043 X5.0
N045 G65 P9010 R0.1 Z-0.75 F8.0 W-1.0 H3.0 (Machine first hole)
N050 G91 G28 Z0 M19 (Retract to tool change position)
N055 M01 (Optional stop)
.
.
.
But as you can see, machining multiple holes in this fashion will be quite cumbersome, defeating the primary purpose of using a canned cycle in the first place. Note that a custom macro can be called in a modal manner, using G66, which will dramatically simplify the program. G67 is used to cancel a G66 modal calling command. Here is yet another version of the program that uses G66 and G67.
O0002 (Main program)
N005 T01 M06 (Load drill in spindle)
N010 G90 S600 M03 (Start spindle)
N015 G00 X1.0 Y1.0 (Move to first hole location)
N020 G43 H01 Z0.1 M08 (Instate tool length compensation, move above work surface)
N025 G66 P9010 R0.1 Z-0.75 F8.0 W-1.0 H3.0 (Set variables)
N030 X1.0 Y1.0 (Machine first hole)
N035 X2.0
N040 X3.0
N045 X4.0
N050 X5.0
N055 G67
N060 G91 G28 Z0 M19 (Retract to tool change position)
N065 M01 (Optional stop)
.
.
.
With G66, the custom macro will not actually be executed in line N025 (as it is with G65). Instead, only the local variables will be set. In line N030, the machine will move to the X and Y position specified (it’s already there) and then the custom macro (O9010) will be executed using the values specified with the arguments in line N025. In line N035, the machine will move to X2.0 and then call the custom macro again – machining the second hole. This process is repeated until line N055, when the modal custom macro calling command is cancelled with G67.
Lines N030 through N055 could, of course be placed in a subprogram and any special positioning movement techniques (like the Haas G72) could be used to shorten program length.
One last point. Custom macro B allows you to activate a custom macro using a G code of your choosing. That is, you can create a user defined G code. You can even make it modal!
Comments