CNC Part Programming

A CNC Program is a series of G and M codes that tell the machine how to move the tool relative to the work piece.

G Code Definitions

a) Absolute (G90) vs. Incremental (G91) Modes

In absolute mode, (G90) all coordinates are referenced from the origin of the work coordinate system.

In incremental mode, (G91) all coordinates are referenced from the current tool position.

Example 1:

Absolute coordinates of point 1 are (20,10)

Absolute coordinates of point 2 are (10,20)

Figure 3. Example 1.

What are the coordinates of point 2 relative to point 1?

(______, _______)

What are the coordinates of point 1 relative to point 2?

(______, _______)

b) Rapid Positioning (G00)

The form of the G00 code is:

G00 X_ Y_ Z_

This code causes the tool to move to the given coordinates as fast as possible and in a straight line. This code is used to position the tool and not to cut material!!

From Figure 3 above, to move from point 1 to point 2:

(Absolute Coordinates) G00 X___ Y___ Z___

(Incremental Coordinates) G00 X___ Y___ Z___

c) Linear Interpolation (G01)

The form of the G01 code is:

G01 X_ Y_ Z_ F_

This code causes the tool to move to the given coordinates at the given feed rate. Feed rate is given in inches per minute. This command is used for cutting!!!!!

From our example, to move from point 1 to point 2:

(Absolute Coordinates) G01 X___ Y___ Z___ F___

(Incremental Coordinates) G01 X___ Y___ Z___ F___

d) Circular Interpolation (G02, G03)

G02 - Generates a clockwise arc
G03 - Generates a counterclockwise arc

Method #1

G03 X___ Y___ I___ J___ F___

X,Y are the coordinates of the end point of the arc. I and J are the incremental coordinate of the center of the arc relative to the starting point of the arc.

Example 2: Interpret the following codes on the axes
N01 G90

N05 G01 X1.0 Y0.0 F250

N10 G03 X0 Y1.0 I-1.0 J0.0 F250

N15

Figure 4. Example 2.

Example 3:

How would you specify the arc shown below if you were working in incremental coordinates?, in absolute coordinates?

Figure 4. Example 3.

Method #2

G02 X_ Y_ R___ F_

X, Y are the end points of the arc.

R is the radius of the arc.

F is the feed rate

Example 4:

How would you specify the arc shown below if your were working in incremental coordinates?, in absolute coordinates?

Figure 5. Example 4.

e) General Preparatory Codes - Codes called to prepare the machine for operation.

% - Start of program

G54 G00 X0 Y0 Z0 - Sets work coordinates

G20 G90 G94 G17 - English units, Absolute coordinates, Feed rate in inches per minute and circular interpolation in the X-Y plane

T1 - Selects tool #1
M42 S200 F15.0 - Sets spindle speed to 200 rpm and feed rate to 15 in/minute
M03 - Turns spindle on
M06 - Tool Change

% - Start or end of program

N - Line number of program

[an error occurred while processing this directive]