Until this point, all our motion has been done with G00/G01 for lines and G02/03 for arcs. In this chapter, we introduce the notion of "Canned Cycles", which allow more complex types of motion aimed at simplifying the programming of certain common operations such as drilling holes on CNC milling machines.
Canned cycles are often modal just like the other motions. For example, once we select the high speed peck drilling cycle with G73, subsequent coordinates on later lines specify new hole locations where more peck drilling will be done.
Canned Cycles can save you time for common operations. They'll make your cnc programs shorter and more readable. That's really what they're for.
But, for some operations, things are so idiosyncratic to the specific requirements, that a canned cycle doesn't make sense. A good example is gun drilling.
A term you'll hear a lot is "peck drilling". This is the practice of drilling a little way (the peck distance), back off some distance, and then going back down to the bottom to take another peck. Think of the motion as being not unlike a woodpecker.
Recutting chips is always a bad thing for tool life. The purpose of peck drilling is to improve chip evacuation. There's only enough room down in the bore for the chips that fit in the flutes of the twist drill, and the deeper the hole, the harder it is to evacuate those chips out of the hole. Peck drilling helps with chip evacuation in two ways.
First, even a very short peck where the retraction is minimal helps to break off the chip resulting in shorter chips. Shorter chips are much easier to evacuate-they're lighter and less likely to tangle than long chips.
Second, if the twist drill retracts a substantial distance, this helps reduce the distance the helix of the twist drill has to carry chips.
One thing that is important to avoid when peck drilling is letting the coolant or air/mist blast wash chips back down the hole. For that reason, the best peck drilling cycles will not pull the twist drill completely clear of the hole.
Another thing to keep in mind is most manufacturers do not recommend peck drilling for carbide drills. It increases the tendency of chipping the brittle carbide.
There are some rules of thumb about when you need to start using a Peck Drilling Cycle as opposed to just plunging straight down. Most tooling manufacturers will suggest you start when the hole is 4 diameters deep. G-Wizard Calculator will remind you if you forget.
Since there are quite a few different types of canned drilling cycles, it's easiest to classify them in tabular form:
G Code
Purpose
Peck
Retract
Bottom of Hole
G73
High-speed Peck Drilling for Shallow Depths
Yes
Rapid
G74
Left-hand Tapping Cycle
Feed
Dwell -> Spindle CW
G76
Fine Boring Cycle
Rapid
Oriented Stop
G81
Drilling Cycle without Peck,
Drill Depths <= 3 Diameters
Rapid
G82
Spot Drilling Cycle
Rapid
Dwell
G83
Peck Drilling for Deeper Holes
Yes
Rapid
G84
Tapping Cycle
Feed
Dwell -> Spindle CCW
Boring Cycle
Feed
Boring Cycle
Rapid
Spindle Stop
G87
Back Boring Cycle
Rapid
Spindle CW
G88
Boring Cycle
Manual
Dwell -> Spindle Stop
G89
Boring Cycle
Feed
Dwell
As you can see, the cycles may be divided based on their purpose-drill holes, boring, or tapping, whether they are peck drilling cycles, how they retract, and anything special that happens at the bottom of the hole. For example, dwelling helps ensure a smooth bottom of hole finish and evacuates any chips from the bottom of the hole. Getting chips between the drill point and the hole bottom as the bit descends for another peck greatly increases tool wear, especially with work hardening materials like stainless steel.
There are a lot of parameters and options associated with the drilling cycles, so let's start with a relatively simple one: G81. G81 does no pecking and has no special operation at the bottom of the hole. It just goes down at the feedrate, and then retracts.
Let's use this example G81 block:
Z1.0 (Initial Z axis)
X10Y12 (XY for first hole)
G99 G81 R0.2 Z-0.7
X10Y14 (XY for second hole)
X10Y16 (XY for third hole)
G80 (Cancel canned cycle)
Here is a schematic of how it works:
Following along with the schematic:
G98 and G99 g-codes are used to modify the retraction behavior of canned drilling cycles. If G98 is in effect (specified before the cycle such as the G99 shown above), retract distance is back to the initial Z height. If G99 is in effect, retraction is to the R height. The option to retract to the original Z height using G98 is provided in case there are obstacles between the holes such as clamps or other features of the part.
As mentioned, these drilling cycles are modal. That means you can just real off a bunch of XY coordinates once the cycle is initiated, and the machine will happily execute the cycle at each location. To cancel the cycle, use G80. After executing the G80, the machine returns to G00 mode.
In the example above, we get 3 holes before the G80 cancels the dcycle.
By now, you're probably thinking the water is deep, it's cold, and it's moving pretty fast-drilling cycles, especially peck cycles, are complex!
It'll seem like it until you get used to them. The complexity is there to give you all the options you need to hand a myriad of situations. There is good news though, whether you're just trying to learn, or whether you're actively developing and testing drilling cycles in your g-code. You can use a g-code simulator to help make them easier to understand and work with. If you haven't already, pop over to our G-Wizard G-Code Editor/Simulator and sign up. That will put a first class g-code simulator in your hands which will make understanding and working with drilling cycles a whole lot easier.
Here is a shot of the portion of the GWE screen that shows a backplot of what the machine is doing as well as what we call a "hint" that explains the drill cycle in plain English:
Red lines are rapids and green lines are at feed speed...
The backplot clearly shows the three holes being drilled. The hint (the area in blue at the bottom) tells us the original line of code as well as 4 different hints:
It's really helpful to have these kinds of tools at hand when you're trying to work with canned cycles.
In the G81 example above we saw how the canned cycle is modal, so we can just keep giving XY values and drill a bunch of holes. There is another approach that can be used for multiple holes assuming they have regular spacing, and that's to use relative coordinates and repeats.
G82 is a drilling cycle that doesn't peck, but instead dwells at the bottom of the hole. This increases the accuracy of the hole depth.
A typical G82 looks like this:
G82 XYZ R P F L
XY: Coordinates of the hole position
Z: Hole bottom
R: Retract position in Z. Motions from initial Z to R are performed at rapids speeds. From R to hole bottom is done at feed speed.
P: Dwell time at bottom of hole.
F: Cutting feedrate
L: Number of repeats
Once the drill reaches the bottom of hole and has finished dwelling, retraction is at rapids speeds.
G83 g-code is a peck drilling cycle that retracts all the way out of the hole with each peck. As such, it is better suited to deep hole drilling than the G73 cycle. G83 also allows for dwells at the bottom of the hole. This increases the accuracy of the hole depth.
A typical G83 looks like this:
G83 XYZ R P Q F L
XY: Coordinates of the hole position
Z: Hole bottom
R: Retract position in Z axis. Motions from initial Z to R are performed at rapids speeds. From R to hole bottom is done at feed speed.
P: Dwell time at bottom of hole.
Q: Depth to increase on each peck.
F: Cutting feedrate
L: Number of repeats
Once the drill reaches the bottom of hole and has finished dwelling, retraction is at rapids speeds.
We think of deep hole drilling in terms of drill diameter. A deep hole is any hole more than 5 diameters deep. The deeper you go, the harder it gets. A variety of techniques are needed, and peck drilling cycles are just one. Here's a handy chart to help you keep up with the various techniques:
To learn more about all the other techniques, check out our Deep Hole Drilling article.
The G81 CNC Code may be used for spot drilling and standard drilling to shallow depths (<3 drill diameters deep).
G82 is very similar to G81 except that G82 has the option to add a dwell at the bottom of the hole.
The G83 cycle (often called peck drilling) is intended for deep hole drilling with chick breaking. The retracts (pecks) in this cycle clear the hole of chips and break off any long stringers.
G73 is a modal command that sets the CNC machine to run a peck drilling cycle. Peck drilling is the practice of drilling a hole with a series of steps (called "pecks") instead of drilling the complete hole in one pass.
Both are peck drilling cycles. But, the G73 is peck drilling with a short retract or pause for relatively shallow holes. G83, on the other hand, does a full retract which is better for chip evacuation of deep holes.
1. Dig out the programming book for your controller and read the chapter on canned cycles so you can see how they work.
2. Configure G-Wizard Editor properly for your controller's canned cycles.
3. Write some g-code that uses a canned drilling cycle.
4. Use the G-Wizard Conversational CNC tool in G-Wizard Editor to make a g-code program that uses canned drilling cycles. Take a look at how it works and compare to the program you wrote in #3.