NC Code Reference Manual
NC Code Reference Manual
REFERENCE MANUAL
Table of Contens.......................................................................................................................... 1
Introduction......................................................................................................................................... 3
Contents of This Document.......................................................................................................... 3
Chapter 1 Programming Overview.................................................................................................... 5
1-1 Programming Basics.............................................................................................................. 6
Program Format.............................................................................................................................................................................. 6
Program Structure.......................................................................................................................................................................... 7
1-2 Coordinate Systems............................................................................................................... 8
Machine Coordinate Systems and Workpiece Coordinate Systems............................................................................. 8
Specifying Coordinates and Distances.................................................................................................................................10
1-3 Main Word Characteristics................................................................................................... 12
Preparatory Functions (G Functions).....................................................................................................................................12
Miscellaneous Functions (M Functions)...............................................................................................................................12
Feed Function (F Function).......................................................................................................................................................12
Spindle Speed Function (S Function)....................................................................................................................................13
1-4 Feed Rate and Spindle Speed............................................................................................. 14
Feed Rate and Overrides............................................................................................................................................................14
Rotation Speed and Overrides................................................................................................................................................14
A-axis Feed Rate............................................................................................................................................................................14
1-5 How Values Are Interpreted................................................................................................. 15
Expressing Numerical Values...................................................................................................................................................15
Millimeter Input and Inch Input..............................................................................................................................................15
Interpretation Methods and Units of Values......................................................................................................................16
Unit of Measurement for Angles ...........................................................................................................................................16
1-6 Sample Program.................................................................................................................. 17
Chapter 2 Code Reference............................................................................................................... 19
2-1 Explanatory Notes................................................................................................................ 20
2-2 Preparatory Functions (G Functions)................................................................................... 21
G00 <Positioning>......................................................................................................................21
G01 <Linear Interpolation>.....................................................................................................22
G02 and G03 <Circular Interpolation>.................................................................................................23
G04 <Dwell>.................................................................................................................................26
G10 <Data Setting>....................................................................................................................27
G17, G18, and G19 <Plane>.................................................................................................................................28
G20 and G21 <Measurement Unit>.......................................................................................................29
G28 <Reference-point Return>..............................................................................................30
G39 <Corner-offset Circular Interpolation>......................................................................31
G40, G41, and G42 <Tool-diameter Offset>...................................................................................................32
G43 and G49 <Tool-length Offset>........................................................................................................40
G50 and G51 <Scaling>..............................................................................................................................41
G53 <Movement in the machine coordinate system>..................................................42
G54, G55, G56, G57,
G58, and G59 <Select Coordinate System>.........................................................................................43
G80, G81, G82, G83,
G85, G86, and G89 <Fixed Cycle (Canned Cycle)>.......................................................................................44
G90 and G91 <Absolute and Incremental>........................................................................................49
G92 <Coordinate System>.......................................................................................................50
G98 <Initial Level Return>.......................................................................................................52
G99 <Point R Level Return>....................................................................................................52
2-3 Miscellaneous Functions (M Functions)............................................................................... 53
M00 <Program Stop>.................................................................................................................53
M01 <Optional Stop>................................................................................................................53
1
Table of Contens
Company names and product names are trademarks or registered trademarks of their respective holders.
2
Introduction
3
4
Chapter 1
Programming Overview
5
1-1 Programming Basics
Program Format
Programs are created as shown in the figure below. Addresses such as G, M, X, I, and J in combination with numeric values
specify the cutting sequence and the route taken by the tool.
Program number
Data end
Program end
Program Overview
%
Specify a block consisting only of "%" at both the start and the end of the data. The program is not executed if this is not
present at the start. The "%" at the end may be omitted.
<EOB>
This code indicates the end of the block (known as a carriage-return code).
O
Specify this discretely at the next block following the data start (the "%" at the start). A user-defined program number can
be added, but never specify more than one program number in a single program.
Specify an eight-digit numerical value (from 00000000 to 99999999) following the O. Leading zeroes ("0") can be omitted;
for example, "00000001" may be abbreviated to "01", and "00000100" may be abbreviated to "100". Also, omitting this block
poses no problems.
N
This is specified at the start of a block, but may optionally be omitted. The sequence number is simply a reference number,
and has no effect on the operation of the modeling machine. Specify an eight-digit numerical value (from 00000000 to
99999999) following the N. Upper zeroes ("0") may optionally be omitted; for example, "00000001" may be abbreviated to
"01", and "00000100" may be abbreviated to "100".
G
This is the preparatory function. You specify a specific function by specifying a two-digit numerical value following the "G"
address.
X, Y, and Z
These indicate coordinates and distances. To specify the center coordinate of a circle (or arc), you use I, J, and K. To specify
the radius of a circle or arc, you use R.
For a negative coordinate, prepend "-" to the numerical value (example: X-100). For positive values, prepending "+" is not
required.
F
This specifies the feed rate.
S
This specifies the spindle rotation speed.
M
This is a miscellaneous function. It performs such operations as rotating or stopping the spindle.
M02
This indicates the end of the program. Be sure to specify M02 or M30 at the end of the program.
Program Structure
A program is made of up "words" that are each a combination of an address and a numerical value, and "blocks" that are
each a combination of words.
Blocks
A program is a set of instructions (written commands) for the modeling machine. It is expressed using symbols and values.
Instructions are delimited by <EOB> markers. The information appearing between two <EOB> markers makes up one in-
struction. The single instruction between two <EOB> markers is termed a "block." A single block, in turn, is composed of a
combination of "words." This machine supports ASCII encoding, and uses the line feed (LF) as the "EOB" code (carriage return
[CR] + LF is also acceptable).
One block
End of block
One block
(start of next block)
One block
Words
Each block contains words, which indicate coordinates and specify operation. Programming requires knowledge of the
respective characteristics of words.
p.19 "Chapter 2 Code Reference"
p.63 "2-7 List of Words"
Address Value
Word
Dimension Words
Words that indicate dimensions, angles, and the like in particular are termed "dimension words. "Dimension words include
X, Y, Z, A, I, J, K, and R.
X, Y, Z, and A
These specify coordinates, distances, angles, and the like. To indicate a negative value, you prepend "-" to the value.
I, J, and K
These specify the center coordinates of an arc. To indicate a negative value, you prepend "-" to the value.
R
This specifies the radius of an arc.
Workpiece coordinate
system 4 (G57) Workpiece coordinate
system 3 (G56)
Workpiece
coordinate
system 1 (G54)
Workpiece
coordinate Workpiece
Workpiece origin- system 2 (G55) coordinate
point offset system 6 (G59)
Workpiece
coordinate
system 5 (G58)
Machine coordinate origin
Note, however, that the state shown in the figure above is obtained when EXOFS is zero. EXOFS (the external workpiece
origin-point offset) shifts the six workpiece coordinate systems as a group. The setting for EXOFS is made on the modeling
machine. (It can also be specified using G10.)
p.27 "G10 <Data Setting>"
For information on how to make the setting, refer to the documentation for the modeling machine.
Workpiece coordinate
system 4 (G57) Workpiece coordinate
system 3 (G56)
Workpiece
coordinate
system 1 (G54)
Workpiece
coordinate Workpiece
Workpiece origin- system 2 (G55) coordinate
point offset system 6 (G59)
Workpiece
coordinate
EXOFS system 5 (G58)
Rotary Axis
On a modeling machine equipped with a rotary axis unit, the A-axis is added to these other axes. The A-axis coordinate is
indicated as an angle.
EXOFS
Workpieceorigin- Machine coordinate origin
point offset
X, Y, Z, and A
These are used with positioning (G00), linear interpolation (G01), and the like. X x, Y y, Z z, and A a correspond respectively to
the X-axis, Y-axis, Z-axis, and A-axis coordinates. Specifying all of them at the same time is not required. For instance, when you
want to leave the Y and Z axes unchanged and move 10 millimeters along only the X axis, you would specify "G00X10.0".
I, J, and K
These specify the center coordinates of the arc when performing circular interpolation. Circular interpolation can be per-
formed only on the X-Y, Z-X, and Z-Y planes. The relationship between the planes and the I cx, J cy, and K cz dimension words
is as shown below.
Specified using IK
Specified using IJ
X-Y plane
R
This specifies the radius of the arc when performing circular interpolation.
(Increase in Y)
(Increase in X)
Absolute Incremental
No special rules exist for deciding when to use an absolute or an incremental program. Examine the drawing and choose
the one that makes for the simplest program.
Any number of G codes of different groups can be placed within a single block. When more than one G code of the same
group appears in a single block, the last G code takes effect.
p.63 "2-7 List of Words"
G00X15000Y10000M03
In this example, the spindle starts to turn, and then operation of G00 starts. Note carefully that operation does not necessarily
occur in the sequence in which the words are given.
p.63 "2-7 List of Words"
G01X15000F300000
G17G03X20000Y5000J5000
When a G code or the like is present in the same block, this code functions concurrently. In this example, the G01 operation
is performed at a speed of 300 mm/min. An F code continues to function in subsequent blocks, and the feed rate does not
change until another F code is specified. In this example, the G03 in the second line is also performed at a feed rate of 300
mm/min.
p.63 "2-7 List of Words"
G00X15000Y10000M03S8000
When an M03, a G code, or the like is present in the same block, this code functions concurrently. In this example, the G00
operation is performed simultaneously with the spindle rotating at a speed of 8,000 rpm.
p.63 "2-7 List of Words"
An override is a setting made on the modeling machine. You can adjust the feed rate manually as you monitor the actual
cutting. Two overrides are available: a G00 (positioning) override and an override of the feed rate specified by the F code.
You specify an override as a percentage, with each respective feed rate taken to be 100%.
For instance, executing a program that specifies a rate of 600 mm/min. at an override of 50% yields an actual feed rate of 300
mm/min. Note, however, that operation beyond the modeling machine's minimum or maximum feed rate is not possible.
Adjusting the feed rate to a value finer than the minimum resolution is also impossible.
For more information about setting overrides, refer to the documentation for the modeling machine.
Tool
The speed of rotation of the A-axis varies according to the position in the Y- and Z-axis directions. Note, however, that the
situation just described occurs when the Y- and Z-axis origins are at the A-axis center of rotation and the Y- and Z-axes are
both at rest. It is important to note that performing simultaneous feed of the Y and A, Z and A, or Y, Z, and A axes does not
result in the intended speed.
The meanings of each differ. The values "1000.0" and "1000" may have completely different meanings. Identical values of
"1000" may also have completely different meanings, depending on the setting.
For instance, in the case of distance, be aware that differences in the format or the setting result in different interpretations,
as shown below.
X1000 1000 mm 1 mm
(no decimal point) (in millimeters) (in 0.001-mm units)
Specify either G20 or G21 at the start of the program, before specifying the coordinate system, then do not specify either
again thereafter. Millimeter input must not be changed to inch input, or vice versa, during the course of the program.
Format used in the program Inch input (G20) Millimeter input (G21)
The setting for switching between the calculator and conventional types is made on the modeling machine. The words
subjected to calculator-type interpretation can be limited at this time. The possible limitations ranges are as follows.
None: No word is subjected to calculator-type interpretation. That is, all are subjected to conventional-type interpreta-
tion.
All: All corresponding words are subjected to calculator-type interpretation.
F: F codes alone are subjected to calculator-type interpretation, and other codes are subjected to conventional-type inter-
pretation.
IJKRXYZA: I, J, K, R, X, Y, Z, and A dimension words alone are subjected to calculator-type interpretation, and others are
subjected to conventional-type interpretation.
For information on how to make the settings, refer to the documentation for the modeling machine.
Not all values allow free selection of the presence or absence of the decimal point or of the interpretation method; for some
values, these are fixed and cannot be changed.
Also, spindle speed may be specified either as rpm or as a numerical code.
p.56 "2-4 Spindle Speed Function (S Function)"
: Tool path
: Tool radius 3 mm
Start position
% Data start
O00000001 Program number
G91 Incremental programming
G21 Specify millimeter input
G92X0Y0Z0 Specify workpiece coordinate origin
G10P1R3.0 Specify 3 mm of offset for offset number 1
G00Z5.0 Rapid-feed by 5 mm along Z-axis (X0Y0 unchanged)
F300.0S6000M03 Set spindle speed to 6,000 rpm and feed rate to 300 mm/min., and rotate spindle
G17G41D01G00X8.0Y8.0 Start tool-diameter offset and rapid-feed tool to X-axis 8 mm and Y-axis 8 mm
G01Z-7.0 Linear interpolation to -7 mm in Z-axis direction
Y35.0 Linear interpolation to 35 mm in Y-axis direction
X45.0 Linear interpolation to 45 mm in X-axis direction
G03X15.0Y-15.0I15.0 Circular interpolation (counterclockwise) from current tool position to X 15 mm, Y -15
mm
G01Y-20.0 Linear interpolation to -20 mm in Y-axis direction
X-60.0 Linear interpolation to -60 mm in X-axis direction
Z7.0 Linear interpolation to 7 mm in Z-axis direction
G40G00X-8.0Y-8.0 Cancel tool-diameter offset and return to start position
M05 Stop spindle
M02 Program end
% Data end
19
2-1 Explanatory Notes
Format
Words in square brackets ("[]") may be omitted.
Parameters are given in italics (such as "x," "y," and "feed rate"). A "parameter" is a numerical value appended as an argument
to a dimension word.
Words enclosed in curly brackets ("{}") are a range of available selections. Any one may be specified. For example:
{ G00 } G40 [X x] [Y y]
G01
G00G40
G00G40X15000
G00G40Y5000
G00G40X15000Y5000
G01G40
G01G40X15000
G01G40Y5000
G01G40X15000Y5000
Parameters
The range and functions of a parameter are shown in table form.
"Range 1," and "Range 2," are shorthand expressions for ranges in which an error does not occur. They correspond to the
following ranges of values.
No -99999999 to 99999999
When a parameter range is dependent on the mechanical specifications of the modeling machine, it is so indicated by ex-
pressions such as "dependent on machine specifications." To determine the specific values, refer to the documentation for
the modeling machine.
G00 <Positioning>
Format
G00[X x][Y y][Z z][A a]
Description
This effects rapid-feed movement in a straight line from the current tool position to the specified coordinate point. G00
ignores any feed rate set by an F code, and always effects movement at maximum speed. When an override has been set on
the modeling machine, however, operation is performed according to that setting.
The destination's coordinates are specified with X x, Y y, Z z, and A a. Specifying values for every one of these addresses (X
x, Y y, Z z, and A a) is not necessary. For example:
G00X100
specifies movement along only the X axis, with no movement on the Y, Z, or A axes. This is also the case when only the Y axis,
Z axis, X and Y axes, Y and Z axes, or Z and Y axes are specified. The axis that can be specified simultaneously might be limited
according to the model. For more information,refer to the documentation for the modeling machine.
G00 is also effective outside the block until a word of the same group is encountered. Unless G01, G02, or G03 is used in the
block after specifying G00, the destination for movement can be specified by using only X x, Y y, Z z, and A a. For example:
G00X100
Y100Z5
If the tool encounters an obstacle during movement, steps must be taken to prevent the tool from striking the object, and one
way to do this is to move each axes one at a time. An example of this would be to use the absolute specification "G00Z5000"
to raise the tool, followed by "X1000Y1000" for horizontal movement.
Format
G01[X x][Y y][Z z][A a]
Description
This effects movement in a straight line from the current tool position to the specified coordinate point. Movement is per-
formed at the feed rate specified by an F code.
p.58 "2-5 Feed Function (F Function)"
The destination's coordinates are specified with X x, Y y, Z z, and A a addresses. Specifying values for every one of these ad-
dresses (X x, Y y, Z z, and A a) is not necessary. For example:
G01X100
specifies movement along only the X axis, with no movement on the Y, Z, or A axes. This is also the case when only the Y axis,
Z axis, X and Y axes, Y and Z axes, or Z and Y axes are specified. When X x, Y y, Z z, and A a are all specified, the tool moves
along all four axes simultaneously.
G01 is also effective outside the block until a word of the same group is encountered. Unless G00, G02, or G03 is used in the
block after specifying G01, the destination for movement can be specified by using only X x, Y y, Z z, and A a.
G01X100
Y100Z5
G01 does not include a function for rotating the spindle motor. If the spindle motor is not already turning, an M03 word
should be given beforehand to start rotation.
p.54 "M03 and M05 <Spindle Motor Start/Stop>"
Format
[I cx] [J cy]
G17{ G02 } [X x] [Y y] { }
G03 R radius
[I cx] [K cz] }
G18{ G02 } [X x] [Z z] {
G03 R radius
[J cy] [K cz]
G19{ G02 } [Y y] [Z z] { }
G03 R radius
Description
This effects movement along an arc from the current tool position to the specified coordinate.
Circular interpolation can be carried out only on the X-Y plane, Z-X plane, or Y-Z plane. An A-axis coordinate cannot be in-
cluded. The feed rate specified by an F code is used at this time.
Also, Neither G02 nor G03 includes a function for rotating the spindle motor. If the spindle motor is not already turning, an
M03 word should be given beforehand to start rotation.
p.54 "M03 and M05 <Spindle Motor Start/Stop>"
p.58 "2-5 Feed Function (F Function)"
Circular interpolation can be carried out only on the X-Y plane, Z-X plane, or Y-Z
plane. The plane to use for circular interpolation is specified with G17, G18, or G19.
G17 specifies the X-Y plane, G18 the Z-X plane, and G19 the Y-Z plane. G17
The coordinates of the movement destination are specified using X x and Y y for
G17, X x and Z z for G18, and Y y and Z z for G19.
The center coordinates of the arc are specified using I cx and J cy for G17, I cx and G18
K cz for G18, and J cy and K cz for G19. Note, however, that these always specify
the movement distance (incremental value) from the current tool position, with
no regard for G90 or G91.
When the current tool position is specified as the destination, a circle with a center
angle of 360 degrees results.
G02 and G03 differ in the direction of interpolation for the arc.
G02 performs clockwise movement, whereas G03 performs counterclockwise G19
movement.
Specifying the radius of the arc (or circle) instead of the arc’s center coordinates is also possible. The radius of the arc is speci-
fied with R radius. This method is useful when numerical values read from a drawing can be used directly.
Two circles passing through two points exist, and so one or the other must be specified. One or the other can be specified
by specifying a positive value for the radius of an arc having a center angle of 180 degrees or less and an
negative value for the radius of an arc having a center angle exceeding 180 degrees.
G02 and G03, as well as G17, G18, and G19, are also effective outside the block until a different word of the same
group is encountered.
Executing a G41 or G42 code in the same block as a G02 or G03 code results in an error.
In cases such as when the arc’s radius is extremely large, linear interpolation may be performed.
Helical Interpolation
Adding an axis at the coordinates of the movement destination produces movement in the form of a helix, as shown in the
figure below. This is called helical interpolation. A three-dimensional curve is cut by performing a synchronized linear opera-
tion along the added axis while carrying out circular interpolation.
Format
[I cx] [J cy]
G17 { G02 } [X x] [Y y] { }Zz
G03 R radius
[I cx] [K cz]
G18 { G02 } [X x] [Z z] { }Yy
G03 R radius
G04 <Dwell>
Format
G04X time(X)
G04P time(P)
Description
This specifies the wait (dwell) time for moving from the previous block to the next block. Normally, no other word should be
included in the block where G04 appears.
This code is used with the aim of cutting a precise angle, ensuring precision when cutting the bottom of a drilled hole, or
the like.
The desired dwell time is specified after X or P. The specified time is in seconds when a value containing a decimal point is used,
and in milliseconds when no decimal point is used. Note, however, that time(P) must be given without a decimal point.
Format
G10L2P coordinate [X x][Y y][Z z][A a]
G10P number R radius
Description
This specifies the value for workpiece origin-point offset, EXOFS, and tool-diameter offset. These values are made and stored
on the modeling machine, but a specification by G10 takes precedence.
The offset number is indicated by number. This is specified by a value of 1 or higher, with no decimal point. The offset value
to be assigned to the offset number is specified by radius.
Format
G17
G18
G19
Description
This specifies a plane for circular interpolation (G02 or G03).
G17 specifies the X-Y plane, G18 the Z-X plane, and G19 the Y-Z plane. Each of these is normally used in combination with
G02 or G03 in the same block.
p.23 "G02 and G03 <Circular Interpolation>"
Y-Z plane
Z-X plane
X-Y plane
Format
G20
G21
Description
These set the unit of measurement used for distances and feed rates. G20 sets inch input, and G21 sets millimeter input.
Specify either G20 or G21 at the start of the program, before specifying the coordinate system, then do not specify either
again thereafter. Millimeter input must not be changed to inch input, or vice versa, during the course of the program.
In conventional-type interpretation and no decimal points, millimeter input is interpreted as being in units of 0.001 millimeter,
and inch input is interpreted as being in units of 0.0001 inch.
Format
G28[X x][Y y][Z z]
Description
A "reference point" refers to a specific, mechanically determined position. G28 is a function that enables easy movement to
the reference point.
This performs movement in a straight line from the present position to the midpoint, and then from the midpoint to the
reference point. The coordinates of the midpoint are specified with X x, Y y, Z z. The movement speed is rapid feed, as with
G00, and the code can also be overridden.
Reference point
Midpoint
Current position
The midpoint is determined as follows. When X x, Y y, Z z is omitted, the coordinate of a G28 code executed in a previous
block is used. Also, when no coordinate at all has been specified for a particular axis, no movement along that axis is per-
formed. An example is shown below.
G28Y30000 The midpoint is (X15000, Y30000). (No movement along the Z axis)
●
Format
G39[X x][Y y]
Description
Corner-offset circular interpolation is a function that performs circular interpolation at crossover points in a path adjusted
by tool-diameter offset. The radius of circular interpolation is the amount of offset for tool-diameter offset (that is, the radius
of the tool).
Corner-offset circular interpolation can be executed only when tool-diameter offset (G41 or G42) has been started. Also, as
with tool-diameter offset, it can be executed only on the X-Y plane.
The values for X x and Y y indicate the direction of the movement destination. Note that the movement destination itself is
nonexistent. The coordinates normally specified are the same coordinates for the linear-interpolation destination specified
in the next block.
Crossover
point_
Amount of tool-
diameter offset
Programmed path Programmed path
Path traveled by Path traveled by
center of tool center of tool
G39 is a word that is effective only within the block where it is specified. G39 functions only once, and circular interpolation
is canceled in the next and subsequent blocks. G39 does not affect G00, G01, G02, or G03.
Format
G00
{ G01
} G40 [X x][Y y]
G00 G41
G17{ }{ } D number [X x] [Y y]
G01 G42
X-axis coordinate of
x Range 1 Maximum cutting area
movement destination
Y-axis coordinate of
y Range 1 Maximum cutting area
movement destination
Dependent on machine Dependent on machine
number Offset number
specification specification
Description
Shifting the tool path by an amount equal to the radius of the tool is called "tool-diameter offset."
Using this function makes it possible to input the values from a drawing as coordinates with no need for modification, thus
facilitating programming. Also, if cutting is to be performed with a tool that has a different tool diameter, changing the
amount of offset is the only modification that is necessary.
G40
Cancel tool-diameter offset
G41
Tool-diameter offset -- left
G42
Tool-diameter offset -- right
Tool
1. Tool-diameter offset functions only in the X-Y plane. Z- and A-axis coordinates are not affected by tool-diameter offset,
and movement along these axes is performed as specified in the program.
2. To start and end tool-diameter offset, be sure to use G00 (positioning) and G01 (linear interpolation). Attempting to start
or end it using circular interpolation results in an error.
3. Specifying a plane other than the X-Y plane with G18 or G19 results in an error.
4. Setting a coordinate system (G10, G54, G55, G56, G57, G58, G59, or G92) while tool-diameter offset is in effect results in
an error.
5. Never position two or more blocks without X- and Y-axis motion instructions (such as a miscellaneous function or dwell)
next to one other while tool-diameter offset is in effect. Doing so may result in excessive or insufficient cutting depth.
6. No interference checking for the tool is performed. However, attempting to cut the inner side of a circle or arc with an
offset value that is larger than the radius of the circle or arc results in an error.
7. To change the offset number (D number) or change "tool-diameter offset -- left" or "-- right," first cancel tool-diameter offset
with G40, then specify G41 or G42 again.
8. Executing fixed-cycle operation (G80, G81, G82, G83, G85, G86, or G89) or scaling (G50 or G51) results in an error.
9.Performing reference-point return (G28) while tool-diameter offset is in effect results in an error
Specification by G10 takes precedence over the setting made on the modeling machine.
The offset value for offset number 0 is always 0 (zero). No other value can be specified for offset number 0.
: Programmed path
: Path traveled by center of tool
: Tool
: Tool radius
G41 or G42 is specified immediately after positioning (G00) or linear interpolation (G01). Tool-diameter offset cannot be
started with circular interpolation (G02 or G03). Also, compensation on this machine is performed only for the X-Y plane, and
so G17 (setting of the X-Y plane) is specified before G00 or G01.
As shown in the figure below, the tool is shifted to the left or right by the amount of offset as it moves forward from the
starting point. Tool-diameter offset is actuated when a movement instruction is specified.
Amount of offset
Start position
The following explanation describes the tool path when tool-diameter offset is started.
As the following figures shown, the transition from the start of tool-diameter offset to the next operation can be classified
as travel on the inner side of the program path, travel on the outer side at an obtuse angle, and travel on the outer side at
an acute angle. Outer-side travel "Type A" and "Type B" paths. The settings for Type A and Type B are made on the modeling
machine.
For information on how to make the setting, refer to the documentation for the modeling machine.
Workpiece
0 to 180°
A A
Start position of mou Start position of mo
of nt fs u
fs et nt
et of
A
Am of mou
off oun fse n
se t o
t f t t of
Start position Start position
Start position of
f
Start position
unt o
nt
ou t
Amo
t
offse
Am ffse
o
Amount of offset
Crossover
point Crossover point
Exceptions: Angles of 359° or more to less than 360° (inner-side angles of 1° or less)
Amount of offset
t
of offs
oun
nt
Am ffset
o f
o f o
nt
e
Crossover point
Crossover point
Amount of Amount of
offset offset
of
of o ount
t
ffse
nt
ou t
Am
Amffse
o
off nt
off nt
t
t
se
of mou
se
of ou
Am
A
Amount Amountt
of offset of offse
Exceptions
Exceptions include the following case. In the figure at left, a crossover point exists on the path of the tool, and the tool path is
created normally. When the amount of offset becomes larger, however, no crossover point exists on the tool path, as shown
in the figure at right, and an error occurs.
Amount
Center of arc 2 Center of arc 1
Amount of offset of offset
Crossover
point
Amount
of offset
End point
Amount nt
of offset ou et End point
Amf offs
o
End point
Amount
of offset
nt
oufset
m
A fo f
End point o
Crossover point
Amount
of offset
nt
oufset
m
A f of
End point o Crossover point
End point
Amount
of offset Amount
of offset
End point
Amount
of offset
Format
G43H number
G49
Description
This moves the tool along the Z axis by the specified offset amount. It is used to correct for a change in tool length due to a
tool change, to keep the position of the tip uniform. This function is enabled only on modeling machines equipped with an
ATC (Auto Tool Changer). G43 starts tool-length offset.
The amount by which the tool is shifted is specified by H number. Note, however, that the shift distance is not given directly
with number. The offset value is preset on the modeling machine, then specified with H number for the number of the offset
value. The value for number is given as a numerical value of 1 or higher, with no decimal point.
G49 or G43H0 cancels tool-length offset.
If an axis-movement instruction is present within the same block as a G43 instruction, the end point for axis movement
is the Z-axis coordinate for the movement destination plus the offset. When no axis-movement instruction is present, the
instruction is construed to be for a movement distance of zero, and movement along the Z axis by only an amount equal to
the offset is performed. This is the same for both absolute and incremental coordinates.
G43 and G49 are instruction in the same group. These instructions remain in effect even outside the block, until a new G43
or G49 instruction is received.
The offset value for offset number 0 is always 0 (zero). No other value can be specified for offset number 0.
Specification of the offset value is performed on the modeling machine. Specification by a program is not possible.
For information on how to make the setting, refer to the documentation for the modeling machine.
Sample Program
% Data start
O0001 Program number
G90 Specify absolute coordinates
G49M06T2 Select tool in stocker No. 2
G00Z30000 Positioning
X5000Y5000 Positioning
G43H1Z1000 Start tool-length offset with offset No. 1 and move to corrected position
F600S5000M03 Rotate spindle
G01Z-1000 Linear interpolation
X45000Y45000 Linear interpolation
Z30000 Linear interpolation
M05 Stop spindle
G49M06T0 Cancel tool-length offset and return tool
M30 Program end
% Data end
Format
G50
G51[X x][Y y][Z z]P scale
Description
G51 executes same-scale enlargement or reduction for each axis, referenced to the specified point. It is used for such applica-
tion as the creation of reduced-scale models. Because this instruction affects the entire program, G51 is normally specified
immediately after the start of the program.
G50 cancels G51.
When enlargement or reduction has been specified with G51, it remains in effect until canceled with G50 or another program
is executed. The reference point for enlargement or reduction is specified with the addresses X x, Y y, and Z z. When this is not
specified, the current tool position is used as the reference point. The scaling factor is specified with P scale. The value for
scale is given as a numerical value from 0.00001 to 999.999. A specified scaling factor less than 0.00001 is treated as a factor
of 0.00001, and a specified scaling factor lager than 999.999 is similarly taken to be a factor of 999.999.
G51 acts upon the X-, Y-, and Z-axis coordinates. A-axis coordinates are not scaled.
Specifying a scaling factor of 0.5 produces results like those shown in the figure below. When length is scaled by a factor of
0.5, the volume ratio becomes 0.125.
Format
G53[X x][Y s][Z z][A a]
Description
This moves the tool to the coordinate specified in the machine coordinate system. This is used when you wish to move the tool
to a mechanically specified position. The tool moves at the maximum rate, not the feed rate specified using an F code. How-
ever, when an override has been set on the modeling machine, operation is performed according to that setting value.
G53 must be always given in G90 (absolute programming). That is to say, the coordinate to be specified is the distance or
the angle (absolute value) from the origin-point in the machine coordinate system. Specifying G53 in G91 (incremental
programming) results in an error. The instruction is ignored even if operation continues.
The destination’s coordinates are specified with X x, Y y, Z z, and A a. Specifying values for every one of these addresses is
not necessary. For example, G53Z0 specifies movement along only the Z axis, with no movement on the X, Y and A axes.
This is also the case when only the X axis, Y axis, X and Y axes, Y and Z axes or Z and X axes are specified. The axis that can
be specified simultaneously might be limited according to the model. For more information,refer to the documentation for
the modeling machine.
If the tool encounters an obstacle during movement, steps must be taken to prevent the tool from striking the object, and
one way to do this is to move each axes one at a time. An example of this would be to use “G53Z0” to raise the tool at the top
position, followed by “X150Y150” for horizontal movement.
G53 is a word that is effective only within the block where it is specified.
G54, G55, G56, G57, G58, and G59 <Select Coordinate System>
Format
G54
G55
G56
G57
G58
G59
Description
These functions select any one of the machine’s six workpiece coordinate systems.
The locations of the six workpiece coordinate systems (that is, the six workpiece origin-point offsets) are set on the model-
ing machine.
Workpiece coordinate
system 4 (G57) Workpiece coordinate
system 3 (G56)
Workpiece
coordinate
system 1 (G54)
Workpiece
coordinate Workpiece
Workpiece system 2 (G55) coordinate
origin-point offset system 6 (G59)
Workpiece
coordinate
system 5 (G58)
Machine coordinate origin
On a modeling machine equipped with a rotary axis unit, the A axis is added to this. The workpiece origin-point offset for
the A-axis coordinate is expressed as an angle.
p.8 “1-2 Coordinate Systems”
p.27 “G10 <Data Setting>”
G80, G81, G82, G83, G85, G86, and G89 <Fixed Cycle (Canned Cycle)>
Description
G80
Description
A fixed (or canned) cycle is an instruction that executes a series of predetermined operations for cutting, such as for drilling a
hole. This simplifies programming, because cutting operations spanning several blocks can be executed in a single block.
G81, G82, G83, G85, G86, and G89 are fixed cycles for drilling. The functions of each of these words vary in terms of the feed
rates between the specified points, and in the presence or absence of a dwell interval. G80 cancels a fixed cycle.
G98 and G99 specify the tool position (along the Z axis) after the completion of the fixed cycle. G98 specifies a return to
the initial level, whereas G99 specifies return to the point R level. The initial level is the Z-axis tool position in effect before
the fixed cycle was specified. The point R level is set between the Z-axis position on the surface of the workpiece and the
initial level. The point R level is specified in order to increase the tool movement distance at maximum speed and reduced
the cutting time.
Tool
Initial level
Point R level
Point Z Workpiece
Cutting is performed at the spindle speed and feed rate that have been specified.
p.56 “2-4 Spindle Speed Function (S Function)”
p.58 “2-5 Feed Function (F Function)”
X x and Y y move the tool to the start point. When these are not specified, drilling is carried out at the current tool posi-
tion.
Z z specifies the location of the bottom of the hole (along the Z axis). When this is not specified, no drilling is performed.
R r specifies the point R level. This specifies the Z-axis coordinate of point R for absolute programming and the distance
from the initial level along the Z axis for incremental programming. When this is not specified, the same point as the initial
level is used.
P time is specified for fixed cycles that include dwell. A numerical value with no decimal point is specified for the dwell-time
interval after P. The units are always interpreted as milliseconds. When no P time is given, no dwell occurs.
K times specifies the number of repetitions. If programming is absolute, drilling is carried out as many times as specified at
the same position. In incremental programming, drilling is carried out as many times as specified at equidistant points, as
shown in the figure below. The coordinates for the following drilling location are determined according to the values speci-
fied for X x and Y y. When K times is not specified, drilling is performed only once. The value for times is given as a numerical
value from 0 (no drilling operation) to 9999, with no decimal point.
Tool Tool
Workpiece Workpiece
Absolute Incremental
Fixed cycles can be used only with X-, Y-, and Z-axis coordinates. An A-axis coordinate cannot be included. Also, drilling can
be performed only along the Z axis. Selecting the Y-Z plane or Z-X plane with G18 or G19 is not possible.
None of the fixed cycles includes a function for starting the spindle motor. If the spindle motor is not already turning, an
M03 word should be given beforehand to start rotation. Executing a fixed cycle while the motor is not rotating results in an
error.
The following figures illustrate the specifications for each of the fixed cycles.
G98G81 G99G81
Tool Tool
Point Z Point Z
Workpiece Workpiece
G98G82 G99G82
Tool Tool
Point Z Point Z
Workpiece Workpiece
G98G83 G99G83
Tool Tool
Point Z Point Z
Workpiece Workpiece
G98G85 G99G85
Tool Tool
Point Z Point Z
Workpiece Workpiece
G98G86 G99G86
Tool Tool
G98G89 G99G89
Tool Tool
Point Z Point Z
Workpiece Workpiece
Format
G90
G91
Description
Two types of coordinate specifications are available: absolute and incremental. G90 specifies absolute, and G91 specifies
incremental.
The figure below shows the difference between absolute and incremental specifications on an X-Y plane. Absolute specifica-
tions indicate the position as the distance (or angle) from the workpiece coordinate origin, whereas incremental specifications
indicate the position as the distance (or angle) from the current position.
Programming that specifies absolute coordinates is called "absolute programming," and programming that specifies incre-
mental coordinates is called "incremental programming."
No special rules exist for deciding when to use an absolute or an incremental program. Examine the drawing and choose
the one that makes for the simplest program.
(Increase in Y)
(Increase in X)
Absolute Incremental
Format
G92[X x][Y y][Z z][A a]
Description
This shifts the workpiece coordinate system so that the current tool position is moved to the specified coordinates.
This is used to make the modeling machine move the tool to a certain position and set the workpiece coordinate system
referenced to that point.
p.8 "1-2 Coordinate Systems"
Tool Tool
G92X5.0Y5.0
executed at
this position
Offset using
G92
G92 calculates the offset value from the currently selected workpiece coordinate system (one of G54 through G59) and the
current tool position. This offset value is then added to the respective workpiece origin-point offsets. That is, workpiece
coordinate systems 1 through 6 are all shifted by an identical distance.
Workpiece coor-
dinate system 4 Workpiece coor-
dinate system 3
Offset using
G92
Workpiece coor-
dinate system 1
Workpiece coor-
Workpiece origin- dinate system 2
point offset Workpiece coor-
dinate system 6
Workpiece coor-
Machine coordinate dinate system 5
origin
On modeling machines equipped with a rotary axis unit, the A axis is also added to this. The A-axis coordinate is expressed
as an angle.
G92 is a code effective only within the specified block.
In general, the workpiece coordinate system is not changed during the course of program execution. Consequently, this
word is used at the start of a program.
Format
G98
Description
This specifies the tool position (along the Z axis) after the completion of a fixed cycle. G98 signifies a return to the initial level.
The initial level is the Z-axis tool position in effect before the fixed cycle was executed. For more information about fixed
cycles, refer to "G80, G81, G82, G83, G85, G86, and G89 -- Fixed Cycle (Canned Cycle)."
Tool
Initial level
Point R level
Point Z Workpiece
Format
G99
Description
This specifies the tool position (along the Z axis) after the completion of a fixed cycle. G99 signifies a return to the point R
level. The point R level is set between the surface of the workpiece and the initial level. The point R level is used to increase
the amount of tool movement at maximum speed and reduce the cutting time. For more information about fixed cycles,
refer to "G80, G81, G82, G83, G85, G86, and G89 -- Fixed Cycle (Canned Cycle)."
Tool
Initial level
Point R level
Point Z Workpiece
Format
M00
Description
This pauses the program at the block specified by M00. The state of the spindle motor (rotating or stopped) does not change.
Release of the paused state is to be performed on the modeling machine.
Specify this code in a block by itself. Never include any other words in the same block.
Format
M01
Description
As with M00, the setting (enable or disable) can be made on the modeling machine. When set to "disabled," this instruction
is ignored.
Use this code in a block by itself. Never include any other words in the same block.
For information on how to make the setting, refer to the documentation for the modeling machine.
Description
This indicates that the program has ended. Be sure to specify M02 or M30 at the end of the program.
Specify this code in a block by itself. Never include any other words in the same block.
Format
M03
M05
Description
M03 instructs the modeling machine to start rotation of the spindle, and M05 instructs the machine to stop it.
M03 is the only instruction that is available to start the spindle motor. Cutting instructions such as G01, G02, and G03 do
not include a function for starting rotation of the spindle, so M03 must be given to start spindle rotation before any such
instruction is executed.
If the spindle is already turning, M03 is ignored and the spindle continues to rotate. Similarly, M05 is ignored when the spindle
motor is already stopped, and the spindle remains stopped.
Format
M06T number
Description
This sends a tool-selection instruction to the ATC (Auto Tool Changer). The stocker loaded with the tool to grasp is specified
with T number. The value for number is given as a numerical value of 1 or higher, with no decimal point.
Giving a value of 0 (zero) for number returns the currently grasped tool to the stocker. When 0 is specified at a time when no
tool is grasped, the value is ignored. Any instruction to select a tool that is already grasped is also ignored.
M06 has no tool-length offset function. To perform tool-length offset, G49 must be specified separately.
M06 specifies only the stocker number. It does not directly specify the tool itself.
Never put more than one M06 or T number in a single block. Also, be sure to specify M06 and the T number together, as a
pair. Specifying one or the other alone results in an error.
This function is valid only on modeling machines equipped with an ATC.
Format
M12
M13
Description
M12 instructs the modeling machine to turn on the air blower, and M13 instructs the machine to turn it off. This instruction
is valid only on modeling machines equipped with an air blower.
Format
M14
M15
Description
M14 instructs the modeling machine to turn on the chip cleaner, and M15 instructs the machine to turn it off. This instruction
is valid only on modeling machines equipped with a chip cleaner.
Format
M16
M17
Description
M16 instructs the modeling machine to turn on the illumination, and M17 instructs the machine to turn it off. This instruction
is valid only on modeling machines equipped with illumination.
Format
M30
Description
This indicates that the program has ended. Be sure to specify M02 or M30 at the end of the program.
Specify this code in a block by itself. Never include any other words in the same block.
S <Spindle Speed>
This specifies the speed of rotation of the spindle.
Note that this has no function for starting rotation of the spindle. To rotate the spindle, an M03 code must be specified
separately.
p.54 "M03 and M05 <Spindle Motor Start/Stop>"
Format
S revolution speed
Description
If this is specified when the spindle motor is already rotating, the operation is performed simultaneously with the specifica-
tion. If this is specified when the spindle is stopped, the spindle rotates at the speed specified by the S function when M03
is given.
Two methods of specifying the speed are available: "rpm" and "numerical code."
rpm Specification
This method specifies the speed in rpm (revolutions per minute). When the value specified is 100 or higher, it is interpreted
as rpm. The numerical value is given with no decimal point.
When a value exceeding the modeling machine's maximum speed is specified, the maximum speed is used; when a value
less than the minimum speed is specified, the minimum speed is used.
Numerical-code Specification
When the value is from 00 to 99, it is interpreted as a numerical-code specification. The numerical value is given with no
decimal point.
Speeds are preassigned to the numerical codes. To view the correspondences between numerical codes and assigned speeds,
refer to the following page.
When a value exceeding the modeling machine's maximum speed is specified, the maximum speed is used; when a value
less than the minimum speed is specified, the minimum speed is used.
Code rpm Code rpm Code rpm Code rpm Code rpm
F <Feed Rate>
This specifies the feed rate.
Format
F feed rate
Description
The feed rate is given as a numerical value placed immediately after the F. When an F function is specified, the function is
performed simultaneously with the specification.
If a feed rate exceeding the maximum is specified, the maximum feed rate is set. In the same way, the minimum feed rate
is set if the specified feed rate is less than the minimum. Also, adjusting the feed rate to a value finer than the minimum
resolution is impossible.
On modeling machines equipped with a rotary axis unit, the A-axis feed rate also follows the specification of the F code. As
with the feed rates for the X, Y, and Z axes, this is specified as millimeters (or inches) per minute. The speed of rotation is not
specified directly.
The A-axis feed rate varies according to the tool position at the time when the command for A-axis feed is encountered. The
peripheral speed for the circle whose radius is the distance from the Y and Z coordinates of the tool position to the origin is
the feed rate specified by the F code. The following figure shows a case where the Y- and Z-axis origins are set at the A-axis
center of rotation.
Tool
Note, however, that the speed of rotation for the A-axis is determined by the tool position at the time when the command
for A-axis feed is encountered, and remains constant until the feed command ends. For instance, when the Z-axis is raised
by simultaneous Z- and A-axis feed, the peripheral speed increases correspondingly as the Z-axis rises. This means that the
relative speeds of the tool and workpiece become faster than intended, which may cause damage to the tool. In such cases,
either specify a sufficiently slow feed rate beforehand or move the Z and A-axes one at a time.
Tool
When the Z-axis is at its highest position, the rotary axis unit rotates at maximum speed irrespective of any specified F
code.
N <Sequence Number>
Format
N number
Description
A sequence number is a reference number for a block. It is specified at the start of the block.
A sequence number may either be present or absent from any or all blocks. Also, sequence numbers need not be consecu-
tive or arranged in order from lower to higher. However, numbers in sequence from lower to higher are customarily used to
mark critical places within a program.
The value for number is an eight-digit numerical value (00000001 to 99999999). Never append a decimal point. Leading
zeroes (0) can optionally be omitted. For example, "00000001" may be specified as "01", and "00000100" may be specified
as "100".
O <Program Number>
Format
O number
Description
A program number is a reference number for a program. This is specified discretely at the next block following the data start
(the "%" at the start), but may optionally be omitted.
The value for number is an eight-digit numerical value (00000001 to 99999999). Never append a decimal point. Leading
zeroes (0) can optionally be omitted. For example, "00000001" may be specified as "01", and "00000100" may be specified
as "100".
Never specify more than one program number within a single program.
Format
/
Description
This function makes it possible to selectively skip over a block within a program. This word is given at the start of the
block.
•
•
•
G01Z-7.0
Y35.0
/G04X1000 <- This block is skipped (not executed).
G03X15.0Y-15.0I15.0
•
•
•
The setting for enabling or disabling block skip is made on the modeling machine.
For information on how to make the setting, refer to the documentation for the modeling machine.
Format
%
Description
This informs the modeling machine of the start and the end of the data.
Specify a block consisting only of “%” at the start and at the end of the data. The program is not executed if this is not present
at the start. The “%” at the end may be omitted. Never specify any word other than “%” in this block.
Description
An EOB (end of block) indicates the end of the block. This machine supports ASCII encoding. The line feed <LF> is used as
the “EOB” code (carriage return <CR> + <LF> is also acceptable).
( ) <Comment>
Format
(message)
Description
Comments can be included within a program.
A text string appearing between a “(“ and “)” is considered to be a comment and is skipped over during program execution.
Comments can be useful for noting a program’s revision history, describing the content of a program, indicating cautions
during cutting, and so on. A comment may contain an number of characters, without restriction.
%
G90
O0001
(main program start) <- Comment (not executed)
G00Z5.0
•
•
•
Other Functions
Word Function
A Dimension word
I Dimension word
J Dimension word
K Dimension word
N Sequence number
O Program number
R Dimension word
X Dimension word
Y Dimension word
Z Dimension word
/ Optional block skip
% Data start / Data end
<EOB> End of block
() Comment