Posted by: davidhayden | March 3, 2012

Most Common G Codes for CNC Milling Applications


This is the thrid post in a series about common G & M codes that started with the common G codes for CNC turning / CNC lathe work.  

This Milling G Code information is excerpted from the 7 Easy Steps to CNC Programming series of books.      Books are available in hard copy and downloadable electronic versions.

Most Common CNC Milling G Codes

Code 

Group 

Parameters 

What it does / usage 

G0 / G00 

01 

 

Modal. Initiates rapid travel.  Causes the machine to move the tool to the programmed coordinate at the machines maximum speed. 

G1 / G01 

01 

Modal. Initiates linear feed.  Moves the tool in a straight line at the programmed feed rate as specified by F. 

G2 / G02 

01 

I, J, K,  R, F 

Modal. Initiates clockwise interpolation.  Moves the tool to a specified endpoint in a clockwise direction.  The parameters I, J, K and R define the size of the arc.

I, J, K define the center of the arc and are generally used together.  These parameters allow programming of arcs from 0-360 degrees

The R command is a shortcut for defining the arc radius and is never used on the same line with I, J, or K. The R command can be used to program arcs up to 360 degrees but not including 360 degrees. 

G3 / G03 

01 

I, J, K, R, F 

Modal. Initiates counterclockwise interpolation.  Moves the tool to a specified endpoint in a counterclockwise direction.  The parameters I, J, K and R define the size of the arc.

I, J, K define the center of the arc and are generally used together.  These parameters allow programming of arcs from 0-360 degrees.

The R command is a shortcut for defining the arc radius and is never used on the same line with I, J, or K. The R command can be used to program arcs up to 360 degrees but not including 360 degrees. 

G4 / G04 

00 

X, P 

Non-modal. Commands the machine to dwell or sit still for X seconds or P miliseconds.  For example G04 X3 would cause the machine to dwell for 3 seconds. 

To dwell for 3 seconds using the P parameter, the command would be G04 P3000 

 

G4 / G04 contd. 

00 

X, P 

This is useful for having the machine while coolant comes on or the spindle gets up to speed, etc. 

G17 

16 

 

Modal. Sets active plane to the X, Y plane. 

G18 

16 

 

Modal. Sets active plane to the X, Z plane (most common plane for turning). 

G19 

16 

 

Modal. Sets active plane to the Y, Z plane. 


G20 /
G94 

06 

 

Modal. Sets the machine to operate in inch mode. 

G21 / G95 

06 

 

Modal. Sets the machine to operate in metric mode 

G28 

00 

 

Non-Modal.  Commands the machine to move to the machine zero-reference point through an intermediate point. 

G40 

07 

 

Modal.  Cancels cuter compensation. 

G41 

07 

Modal. Cutter compensation left. This command tells the machine to move the cutter to the left of the programmed path by the amount specified in the offset identified by the D word. 

For example G41 X-3.000 D23 commands the machine to move to X-3 but to keep the tool to the left of the programmed path by amount in offset register 23. 

Left and Right are determined by looking down the tool path from start point to end point.  As you imagine looking down that path, the compensation will be to the left. 

G42 

07 

Modal. Cutter compensation Right. This command tells the machine to move the cutter to the right of the programmed path by the amount specified in the offset identified by the D word.

For example G41 X-3.000 D23 commands the machine to move to X-3 but to keep the tool to the right of the programmed path by amount in offset register 23.   

Left and Right are determined by looking down the tool path from start point to end point.  As you imagine looking down that path, the compensation will be to the right. 

G50 

00 

X, Y, Z 

Modal. Used to program the absolute zero.   

The X and Z would be programmed as the distance and direction from the desired absolute zero point to the current tool position. 

G70 

00 

 

Modal.  The ANSI/EIA RS-274-D standard command for inch programming. 

G73 

01 

X, Y, Z, R,
F, Q 

Modal. High Speed Chip Breaking.  This canned cycle: 

* moves to the programmed X, Y location
* rapids to a clearance point as specified by
   R,

* feeds to the depth of Q at the F feed rate
* retracts the tool just enough to break the
   chip

* feeds another Q distance and breaks the
   chip

* repeats the feed / chip-breaking cycle until
   the 
  final Z depth is reached.
* retracts the tool based on G98 / G99 Mode
* rapids to the next X, Y location and
   repeats the 
cycle. 

G74 

01 

X, Y, Z, F, R 

Modal. Left Hand Tapping.  This canned cycle:  

 * Starts the spindle in counter-clockwise
   rotation

* moves to the programmed X, Y location
* rapids to a clearance point as specified by
   R,

* feeds to the Z depth at the F feed rate
* reverses the spindle direction
* feeds the tool out of the hole based on the
   G98 / G99 Mode
* rapids to the next X, Y location and
   repeats the 
  cycle. 

G76 

01 

X, Y, Z, F, R 

Modal. Fine Boring.  This canned cycle:  

* moves to the programmed X, Y location
* rapids to a clearance point as specified
   by R,

* feeds to the Z depth at the F feed rate
* stops and orients spindle so tip is away
   from the 
stock
* rapids the tool out of the hole based on the
   G98 / G99 Mode
* rapids to the next X, Y location and repeats
   the 
cycle. 

G80 

01 

 

Cancels Canned Cycles. 

G81 

01 

X, Y, Z, R, F 

Modal. Drill.  This canned cycle: 

* moves to the programmed X, Y location
* rapids to a clearance point as specified by
   R,

* feeds to the Z depth at the F feed rate
* retracts the tool based on G98 / G99 Mode
* rapids to the next X, Y location and repeats
   the 
 cycle. 

G82 

01 

X, Y, Z, F,
P, R 

Modal. Counter-Boring  This canned cycle:  

* moves to the programmed X, Y location
* rapids to a clearance point as specified by
   R,

* feeds to the Z depth at the F feed rate
* dwells at the bottom of the hole for the
   amount 
 of milliseconds as specified by the
   P parameter

* retracts the tool based on G98 / G99 Mode
* rapids to the next X, Y location and repeats
   the 
cycle.   

G83 

01 

X, Y, Z,  F, R, Q 

Modal. Full Retract Peck Drilling.  This canned cycle works the same way as G73 except this command causes the tool to retract all the way out of the hole instead of just enough to break the chip. 

G84 

01 

X, Y, Z, F, R 

Modal. Right Hand Tapping.  This canned cycle: 

* moves to the programmed X, Y location
* rapids to a clearance point as specified by
   R,

* feeds to the Z depth at the F feed rate
* reverses the spindle direction
* feeds the tool out of the hole based on the
  G98 / G99 Mode
* rapids to the next X, Y location and
   repeats the
 cycle. 

G85 

01 

X, Y, Z, 

F, R 

Modal. Boring.  This canned cycle: 

* moves to the programmed X, Y location
* rapids to a clearance point as specified by
   R,

* feeds to the Z depth at the F feed rate
* feeds the tool out of the hole based on the
  G98 / G99 Mode
* rapids to the next X, Y location and repeats
   the 
cycle. 

G86 

01 

X, Y, Z, F, R 

Modal. Boring This canned cycle: 

* moves to the programmed X, Y location
* rapids to a clearance point as specified by
   R,

* feeds to the Z depth at the F feed rate
* stops the spindle
* rapids the tool out of the hole based on the
  G98 / G99 Mode
* rapids to the next X, Y location and repeats
   the
 cycle. 

G90 

03 

 

Modal. The ANSI/EIA RS-274-D standard command for absolute programming.    

G91 

03 

 

Modal. The ANSI/EIA RS-274-D standard command for incremental programming.    

G98 

10 

 

Modal.   Return to Initial level.  
This command tells the control to return the tool to the Z level where the canned cycle was first initiated.  For example if you program the tool to rapid .100 above the part then call the canned cycle, the initial level is .100 above the surface. 

G99 

10 

 

Modal. Return to R Level.  

In the canned cycle command when you program an R parameter you tell the machine to rapid from the initial level to the R level before starting the canned cycle.
The G99 tells the control, when it is finished with the canned cycle to rapid to the R level instead of the Initial level.  

This can be handy when you drill holes down in a pocket and then you want to retract the tool and Rapid to a level above the part but not out to the initial level between holes.  By programming the G99 with a Z level you can keep the tool close to the work piece.

Remember though, on the last hole, you should add the G98 to force the cycle to return to the initial level.  This may keep the tool from crashing into the part as it rapids home or to a new location. 

 

Watch for upcoming post on the most common M Codes used in CNC Milling applications.  These tables are excerpted from the 7 Easy Steps to CNC Programming series of books.

Advertisements

Responses

  1. […] Common G Codes for Milling: G00, G01, G02 and G03, G83 […]

  2. […] Common G Codes for Milling: G00, G01, G02 and G03, G83 […]

  3. […] brief video only mentions the G17, G40, G80 as the commands used for a safe start line.  Other G codes recommended for a safe start line […]

  4. nice article,it is useful to me and others,please just keep it….


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: