Speeding Up G-Code Programming With Canned Cycles
Last time we took a look at repetitive cycles on a CNC Lathe or machining center. In this article, we are going to dive into the world of drilling canned cycles and how we can program them using G-Code.
Canned cycles are used when we are programming by hand to speed up the programming process. For example, if we were to write a peck drilling cycle without using a canned cycle, we would need to write each position the drill moved to for each peck.
This would take considerable time.
By using a G83 pecking cycle that is explained below, the machine will take care of each peck while we just give the information of the depth and position of each hole.
Let’s take a look at the different functions of canned cycles and how they look like.
G83 – Face Drilling Cycle
The G83 cycle is the main drilling cycle we use when drilling on the center line of the part. When using driven tooling, this cycle is also used to drill into the face off center as we would when machining a bolt hole circle.
It has many uses such as peck drilling, spot drilling with a dwell and standard drilling.
A typical G83 block may look like this (dimensions in mm):
G83 X10.0 Z-15.0 C0.0 R3.0 Q5000 P500 F100;
G83 X (positional) Z (Depth of hole) C (radial position) R (retract distance of peck) Q (depth of each peck) P (dwell time at full depth of hole in milliseconds) F (feed rate);
For a more in-depth look at machining using G83 check out my article here.
G84 – Face Tapping Cycle
Similar to the way the G83 cycle works, the G84 is used when tapping. We can even peck tap using this cycle.
G84 X0.0 Z-9.0 F600;
G84 X (positional) Z (depth of thread) F (pitch of thread) ;
When rigid tapping using this technique the feed and speed overrides are locked to 100%.
You can read more about tapping cycles here.
G85 – Face Boring Cycle
The G85 cycle bores the material in the Z- direction and returns the tool at a feed rate. This can be used for both boring and reaming operations.
A typical block of G-Code would look like this:
G00 X80.0 Z5.0;
G85 Z-15.0 F100;
The G85 can also be used off center with driven tooling to bore on the face of the part.
Drilling on Different Planes
The three examples above all machine holes on the face of the component, when we are working using the G18 X Z plane.
We can select other planes to work in if we have a machine capable of using driven tooling. The G17 plane allows us to machine in the X and Y axis and the G19 plane for Y and Z axis.
To tell the machine the direction we wish to cut we simply state the required direction in the program using G17, G18 or G19.
G87 – Side Drilling Cycle
To machine a hole on the diameter of our part we can use the G87 cycle with the G19 plane selected.
The G-Code looks similar to the face drilling example.
G19 G87 Z-8.0 X-3.0 C90.0 Q2000 P100 F100;
G18 G80; (sets the standard working plane and cancels the cycle)
The X dimension is the depth of the bore while Z and C are positional. The Q, P and F words are the same as the examples above.
The above program example drills 3 separate holes, after each rotation of the C axis (the main spindle) the hole will automatically be drilled to the depth defined on the G87 line.
G88 – Side Tapping Cycle
When using G88, the tool reaches the full depth of the bore, the driven tooling spindle then reverses at the same speed and feed as it feeds out of the part.
G19 G88 Z-10.0 X-7.0 C90.0 F100;
G89 – Side Boring Cycle
Just like the face boring cycle, the G89 removes material in the X Axis instead of the Z axis using live tooling.
G19 G89 Z-20.0 X-5.0 P100 F100;
G80 – Cycle Cancel
The last three examples I finished the block of code using G80. The G80 G-Code command must be used when we are finished drilling, this cancels the cycle so the machine knows that all dimensions after the G80 are not hole positions.
By using the canned cycles listed above, we can greatly decrease the time it takes to write our programs plus it makes them a lot easier to read and therefore speeds up any editing that we may need to do.
For a full description of each technique and how to program using them check out this article about CNC lathe programming.
Author: Marc Cronin, Senior CNC Machine Tools Engineer, and founder of GCodeTutor.com