Mill GCodes
Home Up JSSMDX Products JSSMDX Support Links GotWeek

 

Common GCodes For Milling Machines

G0    Rapid Positioning

    The machine moves at maximum speed to the specified locations. G0 is a modal code, rapid motion stays in effect until another motion code is encountered. Rapid motion may be linear, shortest axis completes first, or shortest of X and Y complete first, then the Z motion is executed. G0 is usually followed by one or more positions specified by X, Y, and/or Z codes. G0 is used when the tool is not cutting material, to move between cutting different areas of the part.

G1    Linear Positioning

    The machine moves at the current feed rate in a straight line to the specified locations.  G1 is a modal code, linear feed motion stays in effect until another motion code is encountered.

G2    Arc Clockwise

    The machine moves at the current feed rate in a circular or helical arc to the specified locations. The arc motion begins at  the current location and moves in a clockwise direction. G2 is a modal code, arc motion stays in effect until another motion code is encountered. Arc motion occurs in the plane specified by G17-XY, G-18-ZX, G19-YZ code (see below). Different machines can specify the center of arcs in several different ways. One way is to specify the absolute center of the arc, usually with I, J, K codes. Another way is to specify the center relative to the starting location or relative to the ending location. Another way is to specify the radius of the arc, usually with a R code.

G3    Arc Counter-Clockwise

    The machine moves at the current feed rate in a circular or helical arc to the specified locations. The arc motion begins at  the current location and moves in a counter-clockwise direction. G3 is a modal code, arc motion stays in effect until another motion code is encountered.  Arc motion occurs in the plane specified by G17-XY, G-18-ZX, G19-YZ code (see below).

G4    Dwell

    The machine remains in the current position for the specified length of time, or number of spindle revolutions.

G6.2    NURB Curve

    The machine follows the specified curve at the current feed rate. Unlike most G codes, a NURB curve takes more than one line. The first line has the curve order (P), first knot (K), starting control point (X Y Z and weight R). The next lines contain consecutive knot values and control points. The remaining knots follow, such as:

G6.2 P4 K0.0 X0.0 Y0.0 Z0.0 R1.0
K0.0 X0.1 Y0.1 Z0.0 R1.0
.
.
.
K1.0 X1.0 Y1.0 Z0.0 R1.0
K1.0
K1,0
K1.0

G17    XY-Plane Selection

    Selects the XY-Plane of the current coordinate system for subsequent arc movement. G17 is a modal command which remains in effect until another plane is selected.

G18    ZX-Plane Selection

    Selects the ZX-Plane of the current coordinate system for subsequent arc movement. G18 is a modal command which remains in effect until another plane is selected.

G19    YZ-Plane Selection

    Selects the YZ-Plane of the current coordinate system for subsequent arc movement. G19 is a modal command which remains in effect until another plane is selected.

G20    Inches

    Specifies that the program units are in inches.

G21    Millimeters

    Specifies that the program units are in millimeters.

G40    Cutter Compensation Off

    Cutter compensation that was initialized by a G41 or G42 command is turned off. Cutter compensation is used to offset the tool path by the amount specified by the current diameter offset number. The diameter offset is usually specified with a tool change as a D followed by the offset. The offset can be the diameter of the tool, but it can also be used to specify a smaller offset to account for smaller tool size due to wear.

G41    Cutter Compensation Left

    Cutter compensation is initialized by a linear move to the specified location. The material is to the left side of the tool as it follows the path.

G42    Cutter Compensation Right

    Cutter compensation is initialized by a linear move to the specified location. The material is to the right side of the tool as it follows the path.

G43 Length Compensation Positive

    Tool length compensation in the Positive direction.

G44 Length Compensation Negative

    Tool length compensation in the Negative Direction.

G54 to G59 Work Coordinate System Select

    Selects the work coordinate system, 1 through 6.

G73    Peck Drilling Cycle

    Indicates the start of a peck drilling canned cycle. Position commands, such as X, Y, indicate the locations of holes for drilling. The canned cycle is modal - it remains in effect until it is canceled by a G80 command.

G74    Left Tap Cycle

    Indicates the start of a left handed tapping canned cycle. Position commands, such as X, Y, indicate the locations of holes for drilling. The canned cycle is modal - it remains in effect until it is canceled by a G80 command.

G80    Canned Cycle Cancel

    Indicates the end of a canned/drilling cycle. Usually this is followed by a new motion command, for instance, G1 to return to the rapid plane.

G81    Spot Drilling Cycle

    Indicates the start of a spot drilling canned cycle. Position commands, such as X, Y, indicate the locations of holes for drilling. The canned cycle is modal - it remains in effect until it is canceled by a G80 command.

G82    Drill Cycle

    Indicates the start of a drilling canned cycle. Position commands, such as X, Y, indicate the locations of holes for drilling. The canned cycle is modal - it remains in effect until it is canceled by a G80 command.

G83    Peck Drilling Cycle

    Indicates the start of a peck drilling canned cycle. Position commands, such as X, Y, indicate the locations of holes for drilling. The canned cycle is modal - it remains in effect until it is canceled by a G80 command.

G84    Tap Cycle

    Indicates the start of a tapping canned cycle. Position commands, such as X, Y, indicate the locations of holes for drilling. The canned cycle is modal - it remains in effect until it is canceled by a G80 command.

G85    Ream Drilling Cycle

    Indicates the start of a ream drilling canned cycle. Position commands, such as X, Y, indicate the locations of holes for drilling. The canned cycle is modal - it remains in effect until it is canceled by a G80 command.

G86, G88, G89    Bore Drilling Cycles

    Indicates the start of bore drilling canned cycles. Position commands, such as X, Y, indicate the locations of holes for drilling. The canned cycle is modal - it remains in effect until it is canceled by a G80 command.

G87    Back Bore Drilling Cycles

    Indicates the start of back bore drilling canned cycles. Position commands, such as X, Y, indicate the locations of holes for drilling. The canned cycle is modal - it remains in effect until it is canceled by a G80 command.

G90    Absolute Positioning

    The coordinates specified by position commands, such as X, Y, Z, are absolute positions in the current work coordinate system.

G91    Incremental Positioning

    The coordinates specified by position commands, such as X, Y, Z, are positions relative to the current position in the current work coordinate system.

G92    Set Current Position

    Changes the current position to new values, so the machine thinks it is now in a different place. Maybe used in a program to machine multiple parts.

G98    Cycle Full Retract

Indicates a drilling canned cycle is to return to the initial rapid plane at the start of the cycle (as opposed to retracting to the cycle clearance plane).

 

Common Usage Of The Other Letters

M Codes

    M stands for Machine, and thus the M codes are for machine specific commands.

X (and/or Y and/or Z)

    X designates the coordinate position of the X-Axis in the current coordinate system. It may be the coordinate of a motion command, the location of the control point for a curve, or the location of a hole for drilling. It may be absolute or relative to the current position.

I, J, K

    I, J, and/or K are used to locate the center of arcs. The center may be in absolute coordinates, or relative to the current position. K is also used to specify the Knot value for curves.

R

    R can be used to specify the radius of an arc to locate it's center.
    R is also used to specify the weight value for a control point for a curve.
    R is also used to specify the clearance plane for drilling cycles.

O

    O is used at the beginning of each program to specify the program number, or program name.

P

    P is used for curves to specify the order of the curve. The order of a curve is it's degree+1.
    P is also used for drilling cycles to specify a dwell time or revolutions.
    P is also used for calling another (sub) program.

L

    L is used with P to specify the number of times to repeat a sub-program.

Q

    Q is used in a drilling cycle to specify the peck increment.

A, B, and/or C

    A, B, and/or C specify the angular position of rotary axes.

D

    D is used to specify the diameter offset number.

H

    H is used to specify the tool length offset number.

T

    T is used to select the tool.

F

    F is used to change the feed rate.

S

    S is used to change the speed of the spindle

E

    E is used to select a work coordinate system.

 

P.S.    If I forgot anything, please let me know, I'll be glad to add it.
Thanks!