Subscribe to Blog
Email Address
 

Canned cycles are used every time we need to drill, ream or tap holes on our CNC machine

Standard Fanuc G-Code language supports more than a dozen canned cycles.

The most common cycles that will cover 99.9% of your g-Code CNC programming work are:

G-Code Name Motion Style
G81 Standard Drilling Feed-In, Rapid-Out
G83 Deep Hole Peck Drilling Incremental Feed-In by Peck Distance, Rapid Out, Repeat
G84 Right Hand Tapping Feed-In,Reverse Spindle, Feed-Out
G85 Reaming/Boring Feed-In, Feed Out

Subsequent holes

You can drill additional holes After your canned cycle has been initiated.
Any line with X Y position will be treated as another hole position.

Each position can have its own Retract value, feed rate and retract height modifier.

G80 - Canned Cycle Cancel Code

After all the holes of the canned cycle have been drilled, it is required to call G80 code in order to cancel the current cycle.

The less common canned cycles are:

G-Code Cycle Name Motion Style
G73 High Speed Chip-Break Drilling Incremental Feed-In by Peck Distance, Stop Feed, Repeat
G74 Left Hand Tapping Feed-In,Reverse Spindle, Feed-Out
G76 Boring, Orient Feed-in, Orient Spindle, Rapid-Out
G82 Spot Drilling Feed-In, Dwell, Rapid-Out
G86 Boring Feed-In, Spindle Stop, Rapid-Out
G87 Back Boring Cycle Orient Spindle, Move to Insert Point, Turn Spindle On,
Feed-In to target Z, Retract to start Z, Move to insert point, Rapid Out
G88 Manual Dwell Boring Cycle

Feed-in, Dwell, Stop Spindle,
Stop Program to let the operator manually retract the tool

G89 Dwell Boring Cycle Feed-In, Dwell, Feed-Out

Support of each of these cycles depends on your particular machine. So make sure to double-check you manual before using any. Especially the ones from the second table!

Retract control codes:

G98 and G99 codes control Z- retract distance between holes in the same cycle.
These codes must be applied on the same line as or before the canned Cycle. Or BEFORE each hole in the cycle

G-Code Code Name Motion Style
G98 Clearance Height Retract After each hole Tool retracts to the last rapid - Z height before the application of the canned cycle. Used when there is need to avoid clamps or part features that are above the R-value height.
G99 R - Height retract After each hole Tool retracts to the R value height of the canned cycle

This is how G98 retract modifier behaves:

And this is how behaves the G99 retract modifier:

Where part geometry is calling for use of G98 you can combine G98 and G99 to save on some rapid time:

As you can see we need to apply G98 on the hole after which we need to retract to the clearance height.

The codes shown on this picture are missing X,Y locations in some places. The correct program would look like this:

Code

G0 Z0.5
G81 G99 X1.5 Y2.0 Z-1.0 R0.1 (Drill First Hole. G99 - Retract to R-height)X2.0 Y2.0 R-0.75 (Drill Second Hole)
G98 X2.5 Y2.0 R-0.75(Drill Third Hole, After it Retract to 0.5" Z-Clearance height)
G99 X3.0 Y2.0 R.1 (Drill fourth hole. Retract to R-height)
X3.5 Y2.0 R-0.7 (Drill fifth hole. Retract to R-Height)

G80 (Cancel Canned cycle)

G0 Z0.5 (retract to clearance height)

The anatomy of a standard drilling program is as follows:

Code

O0001 (COMMENT OR PROGRAM NAME)

(Starting safety blocks)
G20 G17 G40 G49 G80 G90

(Tool Change Routine)
T15 M6

(Position Axis over the work)
G0 G54 G90 X1.5 Y2.125 S1500 M03;

(Apply Tool length offset at retract height, Turn on Coolant)
G0 G43 H15 Z2.0 M8

(Rapid tool to Safe Clearance height)
G0 Z1.0

(Activate Canned Cycle and drill the fist hole)
G81 G99 X1.5 Y2.125 Z-0.5 R0.1 F12.0

(drill subsequent holes)
X1.75 Y2.5
G98 X2.5 Y3.0 (Retract to Clearance height to avoid clamp after THIS hole)
G99 X3.5 Y3.0 (Switch back to retracting to R-value)

(Cancel Canned Cycle)
G80

(Retract to Clearance height, turn coolant off)
G0 Z2.0 M09

(Turn Spindle Off, Retract to TC height)
G0 G91 G28 Z0 M05

(End Program)
M30

 

Canned Cycles Format

G-Code Name Format Standard Example
G81 Standard Drilling

G81 X Y Z R F [K or L]

  • X , Y - Location of the first hole
  • Z - Absolute or relative depth of the hole (depending on your control)
  • R - Retract Height
  • F - Feed Rate
  • [K or L] - Number Repeats

G81 X1.5 Y1.0 Z-0.5 R0.1 F15.0
X2.0 Y1.5 (subsequent hole 1)
X2.5 Y2.1 (subsequent hole 2)
G80

G83 Deep Hole Peck Drilling

G83 X Y Z R Q F [K or L]

  • X , Y - Location of the first hole
  • Z - Absolute or relative depth of the hole (depending on your control)
  • R - Retract Height
  • Q - Peck Depth
  • F - Feed Rate
  • [K or L] - Number Repeats
G83 X1.5 Y1.0 Z-0.5 R0.1 Q0.25 F15.0
X2.0 Y1.5 (subsequent hole 1)
X2.5 Y2.1 (subsequent hole 2)
G80
G84 Right Hand Tapping

G84 X Y Z R F [K or L]

  • X , Y - Location of the first hole
  • Z - Absolute or relative depth of the hole (depending on your control)
  • R - Retract Height
  • F - Feed Rate (Usually in Inches per Revolution,depending on your control)
  • [K or L] - Number Repeats
G84 X1.5 Y1.0 Z-0.5 R0.1 F0.049
X2.0 Y1.5 (subsequent hole 1)
X2.5 Y2.1 (subsequent hole 2)
G80
G85 Reaming/Boring

G85 X Y Z R F [K or L]

  • X , Y - Location of the first hole
  • Z - Absolute or relative depth of the hole (depending on your control)
  • R - Retract Height
  • F - Feed Rate
  • [K or L] - Number Repeats
G85 X1.5 Y1.0 Z-0.5 R0.1 F15.0
X2.0 Y1.5 (subsequent hole 1)
X2.5 Y2.1 (subsequent hole 2)
G80

As already noted above each control will handle these cycles a little differently.
So be careful!

Comments:
No Comments posted yet, be the first one!

New Comment to: Lessson 3: CNC Canned Cycles, Drilling, Tapping, Reaming and Boring Cycles

Name: *
Solve Capcha:
*
Sing In

© 2009-2022 Eldar Gerfanov. All Rights Reserved.
© 2009 Eldar Gerfanov. Materials on this site are presented as is and are mostly for educational use.

You may freely reproduce information presented herein without any consent from me, provided you include link to this site.
In case when i am not the copyright holder, you may want to contact proper owner of material. Anyway, they are freely available on the Internet.
If you hold the copyright right for any of the materials on this site and want them removed, please contact me here