Numeryx Home > User/Programmer

Drilling Canned Cycles

An-101, Copyright © by Gil Hagiz
Last updated Apr-23-2006
For version 6.02.1 and later
(For version 5.11)


This application note describes the available drilling cycles.
While programming of these cycles is based upon the standard, they offer a few enhancements and they work the same with 5-axis RTCP (Rotary Tool Center Point) programming.
Since these cycles are external to Ncplus they may be updated as the need arises.

Canned Cycles

Currently the following cycles are implemented:

g80 - Canned cycles cancel
g81 - Drilling
g82 - Drilling with dwell (counter boring)
g83 - Peck drilling with periodic withdrawal
g83.1 Peck drilling with periodic chip breaking
g84 - Tapping (see details below)
g85 - Boring
g86 - Boring with spindle stop

The drilling data is given as follows:

R - Reference plane - Z at beginning of drill
Z - Z at bottom
F - Feed for drilling or pitch for tapping (see details below)
Q - Step for peck drilling
D - Dwell at bottom

R1- An internal value for the R-plane.
Zi - Initial Z.

R1 = R + Clearance

The Clearance is 1 mm (0.04") and can be set in cnx-116.
With this automatic clearance the value entered for R is the actual Z where the drilling begins.
The drilling is always in the Z axis and the positioning in the X,Y axes.
Plane select mode (g17 - g19) is ignored for drilling.

A cycle is called from a user program by a positioning block in Cartesian or Polar.
G60 (unidirectional approach) can also be used.
The standard format is [square brackets denote optional]:

n1 g x.. y.. z.. g81 r...z... f... [q...] [d...] [g90|g91] [g98|g99]

- or in 2 lines:

n1 g x.. y.. z.. 
n2 g81 r... z... f... ... ... 

Subsequent lines require only a new position.

n3 x... y... [z...]

With g90 (default), R (R-plane) and Z at the bottom of the hole are given as absolute positions.
With g91, R is the relative distance from the initial Z to the reference plane and Z is the depth of the drilling from R-plane.
In this case both R and Z are expected to be negative for normal drilling.

With g98 (default), the tool retracts to the initial Z in Zi.
With g99, the tool retracts to the R1 plane.

For the explanation below, g80 is the non-active mode while g81 stands for any active mode.
Note that as soon as g81 becomes active the drilling cycle is called at the end of every block that contains NC data, even without motion, except for blocks with M2/M6/M30, that cancel the drilling, or G8/G9 that skip the drilling for that block only (see below).
Whenever Z is read from a positioning block current Z is saved into variable Zi and used as the initial Z.
When R,Z,F,Q,D are entered after g81 in the same block they are redirected to internal variables and the corresponding NC addresses do not change. D is set to zero when a fresh cycle begins.
If no F is defined after g81 the last programmed F is used, but if F is defined the previous F is resumed outside the drilling cycle (for example, if g1 is used for positioning).
A fresh g81 begins with g90 active. Also as long as g81 is active, g90/g91 do not affect the regular Absolute/Incremental for X and Y (until g80).
G98/G99 can be programmed any time, but g80 cancels g99, so the next g81 begins with g98 active.

To modify the drilling variables in the middle, e.g., the drilling depth or the feed, g81 must be written again, but this doesn't reset the defaults, as is the case with a fresh g81.

For all cycles, the sequence is as follows:

Note: the drilling variables are saved in the unit they were given (inch-mm) therefore after they are defined scale is allowed but not inch/metric switching.

NCPlus specific:

G84 Tapping

Rigid Tapping

A rigid tapping is possible with a mill that has a closed loop servo spindle. Such a spindle has an encoder and its position is known to the NC at all times. To make the spindle turn it is constantly advanced by a programmed displacement at the axes update time (1-2 msec), therefore its speed accuracy is as accurate as the linear axes.
No M3 is required. The spindle is at rest until the cycle begins.
The R-plane should be high enough for the spindle to accelerate.
To estimate acceleration distance, let's assume a typical spindle with acceleration of 2000 rpm/sec; at 2000 rpm the accel time is 1 sec or 16 revolutions. Multiply 16 by the pitch to get the accel distance.
Note that acceleration distance is proportional to the square of the Rpm, therefore at 1000 rpm it is 4 revolutions and at 500 it is just one revolution.

In short: at 500 Rpm you need about one pitch for acceleration.

The spindle reverses at the exact programmed bottom of the hole, then the tool goes up to the R-plane or the initial Z where the spindle stops.
Rigid tapping cycle moves the Z synchronized with the spindle. The tap can be safely repeated (at the same setup).
Feed override can be used as it affects both S and Z. Spindle override is ignored since the spindle is controlled by feed rather than speed.

Reset Recovery

For Rigid Tapping only, if the tapping is interrupted by Reset the spindle stays engaged with Z-axis and a message like "Rigid Tapping Jam - Jog Z to release, Reset to end" is displayed.
To release the Tap switch to Manual and jog Z up at a low feed override. Do not use MPG.
When done press Reset in Manual to return the spindle to its normal mode.

Flexible Tapping

In flexible tapping the NC assumes that the spindle speed is as programmed, but since speed deviations of 5% are acceptable, the Z is not synchronized with the spindle and a spring loaded flexible tool holder is required to compensate for the differences. Repeating the same tap will most likely destroy the thread.
Before starting the spindle should be running at the desired RPM.
The problem of accel/decel appears at the bottom of the thread. Both Z and the spindle stop but the spindle has to decelerate. The deceleration distance is same as the acceleration distance explained above.
Spindle override can be used, but not above 100%. Feed override is disabled.
The problem with traditional tension-compression holders is that they can cause large variations in tapping depth, which is very critical with blind holes.

Tapping cycles

G84 with decimals are used for the various tapping cycles.
Felxible tap is always available, Rigid tap is available where possible.
g84 - Flexible tap, Pitch
g84.1 Flexible tap, TPI
g84.2 Rigid tap, Pitch
g84.3 Rigid tap, TPI

To cut a left hand thread enter negative value for S.

When Pitch is used it is given in mm or inch per revolution.
Pitch per 1000-rev can be selected by setting a parameter.
When TPI is used it works the same regardless whether the program is metric or inch.

The display shows the spindle RPM under S and the Z-feed under F. The ratio between the two is the pitch.

Hole Patterns

For version 6.02.1 and later.
Instead of a position command for a single hole a few patterns are defined by g-codes, for example:

g222 i j r50 p z10 n8 g83 r1 z-25 q10 f500 g99   \8-hole, 100 mm diameter, bolt circle

For all patterns:

i,j first hole or center of bolt circle
x,y last hole
r,p length/direction of line, radius/direction of last hole
n - number of holes (cannot be the first address in a line)

G99 may be used. G98 is resumed before last hole.
The installer can set these cycles to be either modal or non-modal.

G220 - XY line

This cycle drills n holes along a line where the first and last XY positions are given.

g220 i_ j_ x_ y_ z_ n_ g81 ....
IJ is the location of the first hole, XY is the last.

G221 - RP line

This cycle drills n holes along a line where the first XY position and length/direction are given.

g221 i_ j_ r_ p_ z_ n_ g81 ....
IJ is the location of the first hole, R is the distance to the last hole and P is the direction in degrees (polar coordinates).

G222 - Bolt circle

This cycle drills n holes in a bolt circle.

g222 i_ j_ r_ p_ z_ n_ g81 ....
IJ is the absolute center, R is the radius and P is the rotation of the pattern (direction of last hole).