Supported G-codes
G0 |
Rapid Linear Motion |
G1 |
Linear Motion at Feed Rate |
G2 |
Circular interpolation (clockwise) |
G3 |
Circular interpolation (counter clockwise) |
G4 |
Dwell |
G10 |
Set Coordinate System Data |
G17 |
Plane selection (XY) |
G18 |
Plane selection (XZ) |
G19 |
Plane selection (YZ) |
G20 |
System units in Inches |
G21 |
System units in Millimeters |
G28 |
Return to Home |
G38 |
Straight Probe |
G43 |
Tool Length Offset (+) |
G49 |
Cancel Tool Length Offset |
G53 |
Move in Machine Coordinates |
G54 |
Select Work Offset Coordinate System 1 |
G55 |
Select Work Offset Coordinate System 2 |
G56 |
Select Work Offset Coordinate System 3 |
G57 |
Select Work Offset Coordinate System 4 |
G58 |
Select Work Offset Coordinate System 5 |
G59 |
Select Work Offset Coordinate System 6 |
G5401 ... G5499 |
Select Work Offset Coordinate System |
G61 |
Disable Spline Interpolation |
G64 |
Enable Spline Interpolation |
G90 |
Set Distance Mode (absolute) |
G91 |
Set Distance Mode (incremental) |
G0 - Rapid Linear Motion
For rapid linear motion, program G0 X… Y… Z… A… B… C…, where all the axis words are
optional, except that at least one must be used. The G0 is optional if the current motion mode is
G0. This will produce coordinated linear motion to the destination point at the current traverse
rate (or slower if the machine will not go that fast). It is expected that cutting will not take place
when a G0 command is executing.
G1 - Linear Motion at Feed Rate
For linear motion at feed rate (for cutting or not), program G1 X… Y… Z… A… B… C…,
where all the axis words are optional, except that at least one must be used. The G1 is optional if
the current motion mode is G1. This will produce coordinated linear motion to the destination
point at the current feed rate (or slower if the machine will not go that fast).
Circular interpolation: G2 - clockwise, G3 - counter clockwise
A circular or helical arc is specified using either G2 (clockwise arc) or G3 (counterclockwise arc).
The axis of the circle or helix must be parallel to the X, Y, or Z-axis of the machine coordinate
system. The axis (or, equivalently, the plane perpendicular to the axis) is selected with G17 (Zaxis, XY-plane), G18 (Y-axis, XZ-plane), or G19 (X-axis, YZ-plane). If the arc is circular, it lies
in a plane parallel to the selected plane.
If a line of RS274/NGC code makes an arc and includes rotational axis motion, the rotational axes
turn at a constant rate so that the rotational motion starts and finishes when the XYZ motion starts
and finishes. Lines of this sort are hardly ever programmed.
Two formats are allowed for specifying an arc. We will call these the center format and the radius
format. In both formats the G2 or G3 is optional if it is the current motion mode.
• Radius Format Arc
In the radius format, the coordinates of the end point of the arc in the selected plane are specified
along with the radius of the arc. Program G2 X… Y… Z… A… B… C… R… (or use G3 instead
of G2). R is the radius. The axis words are all optional except that at least one of the two words for
the axes in the selected plane must be used. The R number is the radius. A positive radius
indicates that the arc turns through 180 degrees or less, while a negative radius indicates a turn of
180 degrees to 359.999 degrees. If the arc is helical, the value of the end point of the arc on the
coordinate axis parallel to the axis of the helix is also specified.
It is an error if:
· both of the axis words for the axes of the selected plane are omitted,
· the end point of the arc is the same as the current point.
• Center Format Arc
In the center format, the coordinates of the end point of the arc in the selected plane are specified
along with the offsets of the center of the arc from the current location. In this format, it is OK if
the end point of the arc is the same as the current point. It is an error if the arc is projected
on the selected plane, the distance from the current point to
the center differs from the distance from the end point to the center by more than
0.0002 inch (if inches are being used) or 0.002 millimeter (if millimeters are being
used).
When the XY-plane is selected, program G2 X… Y… Z… A… B… C… I… J… (or use G3
instead of G2). The axis words are all optional except that at least one of X and Y must be used. I
and J are the offsets from the current location (in the X and Y directions, respectively) of the
center of the circle. I and J are optional except that at least one of the two must be used. It is an
error if:
· X and Y are both omitted,
· I and J are both omitted.
When the XZ-plane is selected, program G2 X… Y… Z… A… B… C… I… K… (or use G3
instead of G2). The axis words are all optional except that at least one of X and Z must be used. I
and K are the offsets from the current location (in the X and Z directions, respectively) of the
center of the circle. I and K are optional except that at least one of the two must be used. It is an
error if:
· X and Z are both omitted,
· I and K are both omitted.
When the YZ-plane is selected, program G2 X… Y… Z… A… B… C… J… K… (or use G3
instead of G2). The axis words are all optional except that at least one of Y and Z must be used.
J and K are the offsets from the current location (in the Y and Z directions, respectively) of the
center of the circle. J and K are optional except that at least one of the two must be used. It is an
error if:
· Y and Z are both omitted,
· J and K are both omitted.
G4 - Dwell
For a dwell, program G4 P… . This will keep the axes unmoving for the period of time in seconds specified by the P number.
Range: 1 ... 60 sec.
G10 - Set Coordinate System Data
To set the coordinate values for the origin of a coordinate system, program
G10 L2 P … X… Y… Z… A… B… C…, where the P number must evaluate to an integer in the
range 1 to 6 (corresponding to G54 to G59), P5401 = G5401 ... P5499 = G5499 and all axis words are optional.
The coordinates of the origin of the coordinate system specified by the P number are reset to the coordinate values
given (in terms of the absolute coordinate system). Only those coordinates for which an axis word
is included on the line will be reset.
G10 L1 - Set Tool Table. Example: G10 L1 P1 Z5
G10 L10 - Set Tool Table. Example: G10 L10 P1 Z5
G10 L2 - Set Coordinate System. Example: G10 L2 P1 X1 Y2 Z3
G10 L20 - Set Coordinate System. Example: G10 L20 P1 X1 Y2 Z3
P0 = Current coordinate system
P1 = G54
P2 = G55
P3 = G56
P4 = G57
P5 = G58
P6 = G59
P5401 = G5401
...
P5499 = G5499
G17 - Plane selection (XY)
Set current work plane to XY. This is the default work plane.
G18 - Plane selection (XZ)
Set current work plane to XZ.
G19 - Plane selection (YZ)
Set current work plane to YZ.
G20 - System units in Inches
G20 is obsolete!
The system units are selected using parameter 500 - System Units (inches/millimeters).
G21 - System units in Millimeters
G21 is obsolete!
The system units are selected using parameter 500 - System Units (inches/millimeters).
G28 - Return to Home
G28 is obsolete!
Due to frequent misinterpretation of the code, G28 is no longer supported. This code can be replaced with a macro with the code for moving G0 or G1 to any preset zero point G5428, for example M30:
MDI("G0 G5428 Z0")
MDI("G0 G5428 Y0")
...
Two home positions are defined. The parameter values are in terms of the absolute coordinate system, but are in unspecified length units.
To return to home position by way of the programmed position, program G28 X… Y… Z… A…
B… C…. All axis words are optional. The path is made by a traverse move from the
current position to the programmed position, followed by a traverse move to the home position. If
no axis words are programmed, the intermediate point is the current point, so only one move is
made.
G38 - Straight Probe
Program G38 X… Y… Z… to perform a straight probe operation.
In general, G38 moves along an linear axis until the signal at the input specified by parameter P is triggered.
Parameter P sets the input number at which the signal level is expected to triggered.
Examples:
G91 G38 P10 X50 F600 - move along the X axis to a maximum distance of 50 mm at a speed of 600 mm/min - stop when the signal level changes at input 10.
G91 G38 X50 F600 - move along the X axis to a maximum distance of 50 mm at a speed of 600 mm/min - stop when the signal level changes at the input specified in the table of Inputs with the corresponding function.
G43 - Tool Length Offset (+)
To use a tool length offset, program G43 H…, where the H number is the desired index in the tool table.
H is the tool number associated with the length offset to be applied.
The H number should be, but does not have to be
G49 - Cancel Tool Length Offset
To use no tool length offset, program G49.
G53 - Move in Machine Coordinates
For linear motion to a point expressed in machine coordinates, program G1 G53 X… Y… Z… A… B… C… (or use G0 instead of G1),
where all the axis words are optional, except that at least one must be used.
The G0 or G1 is optional if it is the current motion mode.
G53 is not modal and must be programmed on each line on which it is intended to be active.
This will produce coordinated linear motion to the programmed point.
If G1 is active, the speed of motion is the current feed rate (or slower if the machine will not go that fast).
If G0 is active, the speed of motion is the current traverse rate (or slower if the machine will not go that fast).
G54 - Select Work Offset Coordinate System 1
To select coordinate system 1, program G54.
G55 - Select Work Offset Coordinate System 2
To select coordinate system 2, program G55.
G56 - Select Work Offset Coordinate System 3
To select coordinate system 3, program G56.
G57 - Select Work Offset Coordinate System 4
To select coordinate system 4, program G57.
G58 - Select Work Offset Coordinate System 5
To select coordinate system 5, program G58.
G59 - Select Work Offset Coordinate System 6
To select coordinate system 6, program G59.
G5401 ... G5499 - Select Work Offset Coordinate System
G61 - Disable Spline Interpolation
Disable spline interpolation for toolpath.
G64 - Enable Spline Interpolation
Enable spline interpolation for toolpath.
Parameters that set and affect various characteristics of the spline curve: 3300, 3301, 3302, 3303, 3304:
Parameter 3300 - global enable/disable spline interpolation. In the control program (G-code), spline interpolation is activated with G code G64 and deactivated with G61;
Parameter 3301 - smoothing mode: #1 - the angle between the segments is less than the threshold angle, #2 - the angle between the segments is greater than the threshold angle.
Parameter 3302 - the threshold angle between path segments when spline interpolation becomes active.
Parameter 3303 - degree. Specifies the degree of "involvement" of neighboring segments.
Parameter 3304 - smoothness. The larger this parameter, the smoother the trajectory becomes.
G90 - Set Distance Mode (absolute)
To go into absolute distance mode, program G90. In absolute distance mode, axis numbers (X, Y, Z, A, B, C) usually represent positions in terms of the currently active coordinate system.
I and J numbers always represent increments, regardless of the distance mode setting.
G91 - Set Distance Mode (incremental)
To go into incremental distance mode, program G91. In incremental distance mode, axis numbers (X, Y, Z, A, B, C) usually represent increments from the current values of the numbers.
I and J numbers always represent increments, regardless of the distance mode setting.