Smithy CNC Mills User Manual

SmithyCNC Bed Mill
Programmer’s Reference Guide
Programmer’s Reference Guide
Preface
Smithy CNC EZ-TROL SYSTEMS
SmithyCNC Programmer’s Reference Manual: Preface
PREFACE
SmithyCNC uses the robost EMC2 (Enhanced Machine Control) as the computer numerical control system for the SmithyCNC EZ-Trol system. While the EZ-Trol systems allows you to create and import dbx files with its CAD program and convert the file into G-Code with its CAM System, there may be instances where the user finds it helpful to review the actual G-Code or the user may find, in some cases it is quicker and easier to directly enter the G-Code into the EZ-Trol system.
This Programmer’s Reference Guide is the product of several authors writing for linuxCNC.org. As you find it to be of value in your work, we invite you to con­tribute to its revision and growth."
SmithyCNC Programmer’s Reference Manual: Preface
SmithyCNC Programmer’s Reference Manual: Preface
Programmer’s Reference Guide
Introduction & Language Overview
Smithy CNC EZ-TROL SYSTEMS
1
SmithyCNC Programmer’s Reference Manual:Language Overview
LANGUAGE OVERVIEW
The RS274/NGC, the program language for numerically controlled machines, is based on lines of code. Each line (also called a "block") may include commands to a machining center to do several different things. Lines of code may be col­lected in a file to make a program or run a block at a time in MDI mode.
A typical line of code consists of an optional line number at the beginning fol­lowed by one or more "words." A word consists of a letter followed by a number (or something that evaluates to a number). A word may either give a command or provide an argument to a command. For example, "G1 X3" is a valid line of code with two words. "G1" is a command meaning "move in a straight line at the programmed feed rate", and "X3" provides an argument value (the value of X should be 3 at the end of the move). Most RS274/NGC commands start with either G or M (for General and Miscellaneous). The words for these commands are cal
led "G codes" and "M codes."
The RS274/NGC language does not specify a special code for the start of a pro-
am. When the “Interpreter”, however, deals with files it expects certain pro-
gr
am end codes. These codes include M2, M30, or M60. Whenever the
gr Interpreter encounters one of these codes it assumes that the current line is the last line of the program. Lines of a file that occur after the end of a program code are not to be executed. The interpr
A file may also be demarcated with percents in the following way. The first non­blank l surrounded by white space, and later in the file (normally at the end of the file) there may be a similar line. Demarcating a file with percents is optional if the fi nal contents of a file demarcated by percents stop after the second percent line. Anything after that is ignored.
ine of a file ma
le has an M2 or M30 at the end, but is r
le has a per
f a fi
led i
y contain nothing but a percent sign, "%", possibly
cent line at the beginning but not at the end. The useful
eter does not even read them.
equired if not. An error will be sig-
1-2
SmithyCNC Programmer’s Reference Manual: Language Overview
1.1 Format of a line
A permissible line of input RS274/NGC code consists of the following four parts, in the order listed.
1. An optional block delete character, which is a slash "/" .
2. An optional line number.
3. Any number of words, parameter settings, and comments. (up to 256 charac-
ters).
4. An end of line marker (carriage return or line feed or both).
Any input not explicitly allowed is illegal and will cause the Interpreter to signal an error. There are three additional things that affect all parts of a program.
Spaces and tabs are allowed anywhere on a line of code and do not change the meaning of the line, except inside comments. This makes some strange-looking input legal. The line "g0x +0. 12 34y 7"is equivalent to "g0 x+0.1234 y7", f example.
or
Blank lines are allowed in the input. They are ignored.
Input is case insensitive, except in comments, i.e., any letter outside a comment may be in upper or lower case without changing the meaning of a line.
1.2 Line Number
A line number is the letter N followed by an integer (with no sign) between 0 and 99999 written with no more than five digits (000009 is not OK, for exam­ple). Line numbers may be repeated or used out of order, although normal prac­tice is to avoid such usage. Line numbers may also be skipped, and that is nor­mal pr the proper place if used.
actice. A l
ine number is not required to be used, but must be in
SmithyCNC Programmer’s Reference Manual: Language Overview
1-3
SmithyCNC Programmer’s Reference Manual:Language Overview
1.3 Word
A word is a letter other than N followed by a real value.
Words may begin with any of the letters shown in Table1.1. The table includes N for completeness, even though, as defined above, line numbers are not words. Several letters (I, J, K, L, P, R) may have different meanings in different contexts.
Table 1-1: Words and their meanings
Letter Meaing
A A Axis of machine
B B Axis of machine
C C Axis of machine
D Tool Radius compensation number
F Feedrate
G General Function (See Table 1-5)
H Tool length offset index
I X offset for arcs and G87 canned cycles
J Y offset for arcs and G87 canned cycles
K
M Miscel
N Line Number
P
Q Feed increment in G83 canned cycle
R Arc radius or canned cycle plane
S Spindle Speed
T Tool Selection
X X
Y Y
Z Z-Axis of machine
Z offset for arcs and G87 canned cycles Spindle-Motion Ratio f
lanous function (S
Dwell time in canned cycles and with G4.
ey used wi
K
-Axis of machine
Axis of machine
-
th G10.
or G33 synchr
able 1-7)
ee T
onized movements
1-4
SmithyCNC Programmer’s Reference Manual: Language Overview
1.3.1 Number
The following rules are used for (explicit) numbers. In these rules a digit is a single character between 0 and 9.
* A number consists of (1) an optional plus or minus sign, followed by (2) zero to many digits, followed, possibly, by (3) one decimal point, followed by (4) zero to many digits - provided that there is at least one digit somewhere in the number.
* There are two kinds of numbers: integers and decimals. An integer does not have a decimal point in it; a decimal does.
* Numbers may have any number of digits, subject to the limitation on line length. Only about seventeen significant figures will be retained, however (enough for all known applications).
* A non-zero number with no sign as the first character is assumed to be positive.
Notice that initial (before the decimal point and the first non-zero digit) and trailing (after the decimal point and the last non­required. A number written with initial or trailing zeros will have the same value when it is read as if the extra zeros were not there.
zero digi
t) zeros ar
e allowed but not
Numbers used for specific purposes in RS274/NGC are often restricted to some finite set of values or some to some range of values. In many uses, decimal num-
or parameters
bers must be close to integers; this includes the values of index and carousel slot numbers, for example), M codes, and G codes multiplied by ten. A decimal number which is supposed be close to an integer is considered close enough i
1.3.2 Parameter Value
A par must ev number, and the value of the parameter value is whatever number is stored in the numbered parameter.
The # character takes precedence over other operations, so that, for example, "#1+2" means the number f
alue f
v parameter 3. The # character may be repeated; for example ##2 means the value of the parameter whose index is the (integer) value of parameter 2.
f it is within 0.0001 of an integer.
lowed b
ameter v
aluate to an integer between 1 and 5399. The integer is a par
ound in parameter 3. Of course, #[1+2] does mean the value found in
alue is the pound char
ound b
acter # f
y adding 2 to the v
ol
y a r
alue of par
es (f
eal value. The real value
ameter
ameter 1, not the
SmithyCNC Programmer’s Reference Manual: Language Overview
1-5
SmithyCNC Programmer’s Reference Manual:Language Overview
1.3.3 Expressions and Binary Operations
An expression is a set of characters starting with a left bracket [ and ending with a balancing right bracket ]. In between the brackets are numbers, parame­ter values, mathematical operations, and other expressions. An expression may be evaluated to produce a number. The expressions on a line are evaluated when the line is read, before anything on the line is executed. An example of an expression is [ 1 + acos[0] - [#3 ** [4.0/2]]].
Binary operations appear only inside expressions. There are four basic mathe­matical operations: addition (+), subtraction (-), multiplication (*), and division (/). There are three logical operations: non-exclusive or (OR), exclusive or (XOR), and logical and (AND). The eighth operation is the modulus operation (MOD). The ninth operation is the "power" operation (**) of raising the number on the left of the operation to the power on the right. The relational operators are equality (EQ), inequality (NE), strictly greater than (GT), greater than or equal to (GE), strictly less than (LT), and less than or equal to (LE).
The binary operations are divided into three groups. The first group is: power. The second gr addition, subtraction, logical non-exclusive or, logical exclusive or, and logical and. If operations are strung together (for example in the expression [2.0 / 31.5
- 5.5 / 11.0]), operations in the first gr
tions in the second group and operations in the second group before opera­tionsin the third group. If an expression contains more than one operation from the same group (such as the first / and * in the example), the oper left is performed first. Thus, the example is equivalent to: [((2.0 / 3) * 1.5) ­(5.5 / 11.0)] , which simplifies to [1.0 - 0.5] , which is 0.5.
The logical operations and modulus are to be performed on any real numbers, not just on integers. The number zero is equivalent to logical false, and anynon­zero number is equivalent to logical true.
1.3.4 Unary Operation Value
A unary operation value is either "ATAN" followed by one expression divided by another expression (for example "ATAN[2]/[1+3]") or any other unary operation name followed by an expression (for example "SIN[90]"). The unary operations
e: ABS (absolute v
ar gent), COS (cosine), EXP (e r (round up), LN (natural logarithm), ROUND (round to the nearest whole num­ber), SIN (sine), SQRT (square root), and TAN (tangent). Arguments to unary operations which take angle measures (COS, SIN, and TAN) are in degrees.
oup is: multiplication, division, and modulus. The thir
oup are to be performed bef
alue), ACOS (ar
aised to the giv
c cosine), A
en power), FIX (round down), FUP
SIN (ar
c sine), ATAN (arc tan-
d group is:
ore opera-
ation on the
1-6
SmithyCNC Programmer’s Reference Manual: Language Overview
Values returned by unary operations which return angle measures (ACOS, ASIN, and ATAN) are also in degrees.
The FIX operation rounds towards the left (less positive or more negative) on a number line, so that FIX[2.8] =2 and FIX[-2.8] = -3, for example. The FUP operation rounds towards the right (more positive or less negative) on a number line; FUP[2.8] = 3 and FUP[-2.8] = -2, for example.
1.4 Parameter Setting
A parameter setting is the following four items one after the other: (1) a pound character # , (2) a real value which evaluates to an integer between 1 and 5399, (3) an equal sign = , and (4) a real value. For example "#3 = 15" is a parameter setting meaning "set parameter 3 to 15."
A parameter setting does not take effect until after all parameter values on the same line have been found. For example, if parameter 3 has been previously set to 15 and the line "#3=6 G1 x#3" is interpreted, a straight move to a point where x equals 15 will occur and the value of parameter 3 will be 6.
1.5 Comments and Messages
Printable characters and whi parenthesis always starts a comment. The comment ends at the first right parenthesis found thereafter. Once a left parenthesis is placed on a line, a matching right parenthesis must appear bef may not be nested; it is an error if a left parenthesis is found after the start of a comment and before the end of the comment. Here is an example of a line con­taining a comment: "G80 M5 (stop motion)". Comments do not cause a machining center to do anything.
A comment contains a message if "MSG," appears after the left parenthesis and
y other printing char
e an
or
bef space and lower case char the right parenthesis are considered to be a message. Messages should be dis­played on the message display device. Comments not containing messages need not be displayed there.
A comment can also be used to speci
ee section [sub:G38.2:-
S
te space inside parentheses is a comment. A left
e the end of the line. Comments
or
acters. V
acters ar
Straight-Probe].
ariants of "MSG," which include whi
lowed. The r
e al
y a fi
f
le f
est of the characters before
or the r
esults of G38.2 probing.
te
SmithyCNC Programmer’s Reference Manual: Language Overview
1-7
SmithyCNC Programmer’s Reference Manual:Language Overview
1.6 Repeated Items
A line may have any number of G words, but two G words from the same modal group (see Section [sec:Modal-Groups]) may not appear on the same line.
A line may have zero to four M words. Two M words from the same modal group may not appear on the same line.
For all other legal letters, a line may have only one word beginning with that letter.
If a parameter setting of the same parameter is repeated on a line, "#3=15 #3=6", for example, only the last setting will take effect. It is silly, but not illegal, to set the same parameter twice on the same line.
If more than one comment appears on a line, only the last one will be used; each of the other comments will be read and its format will be checked, but it will be ignored thereafter. It is expected that putting more than one comment on a line will be very rare.
1.7 Item order
The three t ning of this section) are word, parameter setting, and comment. Imagine that these three types of item are divided into three groups by type.
The first group (the words) may be reordered in any way without changing the meaning of the line.
If the second group (the parameter settings) is reordered, there will be no change in the meaning of the line unless the same parameter is set more than once. In this case, only the last setting of the parameter will take effect. For example, after the l
ameter 3 wi
par the line is interpreted, the value of parameter 3 will be 15.
If the third group (the comments) contains more than one comment and is reordered, only the last comment will be used.
If each gr line, then the three groups may be interleaved in any way without changing the meaning of the line. For example, the line "g40 g1 #3=15 (foo) #4=-7.0" has five items and means exactly the same
ypes of item whose order ma
ine "#3=15 #3=6" has been interpr
l be 6. If the or
l
oup is k
ept in order or reordered without changing the meaning of the
der is reversed to "#3=6 #3=15" and
y vary on a line (as given at the begin-
eted, the v
alue of
1-8
SmithyCNC Programmer’s Reference Manual: Language Overview
thing in any of the 120 possible orders (such as "#4=-7.0 g1 #3=15 g40 (foo)") for the five items.
1.8 Commands and Machine Modes
In RS274/NGC, many commands cause a machining center to change from one mode to another, and the mode stays active until some other command changes it implicitly or explicitly. Such commands are called "modal". For example, ifcoolant is turned on, it stays on until it is explicitly turned off. The G codes for motion are also modal. If a G1 (straight move) command is given on one line, for example, it will be executed again on thenext line if one or more axis words is available on the line, unless an explicit command is given on that next line using the axis words or cancelling motion.
"Non-modal" codes have effect only on the lines on which they occur. For exam­ple, G4 (dwell) is non-modal.
SmithyCNC Programmer’s Reference Manual: Language Overview
1-9
SmithyCNC Programmer’s Reference Manual:Language Overview
1.9 Modal Groups
Modal commands are arranged in sets called "modal groups", and only one member of a modal group may be in force at any given time. In general, a modal group contains commands for which it is logically impossible for two members to be in effect at the same time - like measure in inches vs. measure in millimeters. A machining center may be in many modes at the same time, with one mode from each modal group being in effect. The modal groups are shown in Table 1-2.
Table 1-2: Modal Group
Modal Group Meaning Member Words
Motion “Group 1”
Plane S
Distance Mode G90 G91
Feed Rate Mode G93, G94
Cutter Radius Compensation G40, G41, G42
Return Mode in Canned Cycles G98, G99
Coordinate System Selecion
election
ts
Uni
Tool Length G43, G49
Stopping M0, M1, M2, M30, M60
ool Change
T
G0 G1 G2 G3 G33 G38.2 G80 G81 G82 G83 G84 G85 G86 G87 G88 G90
G17 G18 G19
G20, G21
, G55, G56, G57
G54 G59.1, G59.2, G59.3
M6
, G58, G59,
1-10
Spindle Turning M3, M4, M5
Coolant
tches
erride S
Ov
Flow Control 0-
Non-Modal codes “Group 0)”
wi
M7, M8, M9. Special case: M7 and m* may be active at the same time
M48, M49
G4, G10, G28, G30, G53, G92, G92.1, G92.2, G93. 3, M100 to M199
SmithyCNC Programmer’s Reference Manual: Language Overview
For several modal groups, when a machining center is ready to accept com­mands, one member of the group must be in effect. There are default settings for these modal groups. When the machining center is turned on or otherwise re-initialized, the default values are automatically in effect.
Group 1, the first group on the table, is a group of G codes for motion. One of these is always in effect. That one is called the current motion mode.
It is an error to put a G-code from group 1 and a G-code from group 0 on the same line if both of them use axis words. If an axis word-using G-code from group 1 is implicitly in effect on a line (by having been activated on an earlier line), and a group 0 G-code that uses axis words appears on the line, the activty of the group 1 G-code is suspended for that line. The axis word-using G-codes­from group 0 are G10, G28, G30, and G92.
It is an error to include any unrelated words on a line with O- flow control.
SmithyCNC Programmer’s Reference Manual: Language Overview
1-11
Programmer’s Reference Guide
G Codes
Smithy CNC EZ-TROL SYSTEMS
2
SmithyCNC Programmer’s Reference Manual:G Codes
G-CODE OVERVIEW
G codes of the RS274/NGC language are shown in Table 5and described follow­ing that.
In the command prototypes, the hypen (-) stands for a real value. As described earlier, a real value may be (1) an explicit number, 4, for example, (2) an expression, [2+2], for example, (3) a parameter value, #88, for example, or (4) a unary function value, acos[0], for example.
In most cases, if axis words (any or all of X-, Y-, Z-, A-, B-, C-) are given, they specify a destination point. Axis numbers are in the currently active coordinate system, unless explicitly described as being in the absolute coordinate system. Where axis words are optional, any omitted axes will have their current value. Any items in the command prototypes not explicitly described as optional are
ed. It is an error if a required item is omitted.
requir
In the prototypes, the values following letters are often given as explicit num­bers. Unless stated otherwise, the expl example, G10 L2 could equal parameter 100 were 2, G10 L#100 would also mean the same. Using real values which are not explicit numbers as just shown in the examples is rarely useful.
If L- is written in a prototype the "-" will often be referred to as the "L number". Similarly the "-" in H- may be called the "H number", and so on for any other
ter.
let
ly well be written G[2*5] L[1+1]. If the value of
icit numbers can be real values. For
2.1 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 notgo
ast). It is expected that cut
that f
ecuting.
ex
It is an error if:
* all axis words are omitted.
ting wi
l not tak
l
e place when a G0 command is
2-2
ter radius compensation is active, the motion will differ from the above;
If cut see Chapter [cha:Cutter-Radius-Compensation]. If G53 is programmed on the same line, the motion will also differ; see Section [sub:G53:-Move-in].
SmithyCNC Programmer’s Reference Manual: G-Codes
2.2 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 coordinat­ed linear motion to the destination point at the current feed rate (or slower if the machine will not go that fast).
It is an error if:
* all axis words are omitted.
If cutter radius compensation is active, the motion will differ from the above; see Chapter [cha:Cutter-Radius-Compensation]. If G53 is programmed on the same line, the motion will also differ; see Section [sub:G53:-Move-in].
2.3 G2, G3: Arc at Feed Rate<sub:G2,-G3:-Arc>
A circular or helical arc is specified using either G2 (clockwise arc) or G3 (coun­terclockwise arc). The axis of the circle or helix must be parallel to the X, Y, or Z-axis of the machine coor perpendicular to the axis) is selected with G17 (Z-axis, XY-plane), G18 (Y-axis, XZ-plane), or G19 (X-axis, YZ-plane). If the arc is circular, it lies in a plane paral­lel to the selected plane.
dinate system. The axis (or
, equivalently, the plane
ine of RS274/NGC code mak
If a l
otational ax
the r and finishes when the XYZ motion starts and finishes. Lines of this sort are
dly ever programmed.
har
If cutter radius compensation is active, the motion will differ from what is described here. See Chapter [cha:Cutter-Radius-Compensation].
Two formats are allowed for specifying an arc. We will call these the center for­mat and the r current motion mode.
2.3.1 Radius format arcs
In the radius format, the coordinates of the end point of the arc in the selected plane ar C- R- (or use G3 instead of G2). R is the radius. The axis words are all optional ex
e specified along with the radius of the arc. Program G2 X- Y- Z- A- B-
cept that at least one of the two wor
es turn at a constant r
adius f
ormat. In both formats the G2 or G3 is optional if it is the
es an ar
c and includes rotational axis motion,
ate so that the rotational motion starts
ds f
or the ax
es in the selected plane
SmithyCNC Programmer’s Reference Manual: G Codes
2-3
SmithyCNC Programmer’s Reference Manual:G Codes
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.
It is not good practice to program radius format arcs that are nearly full circles or are semicircles (or nearly semicircles) because a small change in the location of the end point will produce a much larger change in the location of the center of the circle (and, hence, the middle of the arc). The magnification effect is large enough that rounding error in a number can produce out-of-tolerance cuts. Nearly full circles are outrageously bad, semicircles (and nearly so) are only very bad. Other siz are OK.
e arcs (in the range tin
y to 165 degrees or 195 to 345 degrees)
Here is an example of a r an arc: G17 G2 x 10 y 15 r 20 z 5.
That means to make a clockwise (as viewed f helical arc whose axis is parallel to the Z-axis, ending where X=10, Y=15, and Z=5, with a radius of 20. If the starting value of Z is 5, this is an arc of a circle
allel to the XY-plane; otherwise it is a helical arc.
par
2.3.2 Center format arcs
n the center f
I plane ar rent 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:
* When the arc is projected on the selected plane, the distance from the current point to the center di mor ters are being used).
When the XY-plane is selected, program G2 X- Y- Z- A- B- C- I- J- (or use G3
e speci
e than 0.0002 inch (i
ormat, the coor
fied along wi
adius format command to mill
rom the positive Z-axis) circular or
dinates of the end point of the ar
th the of
om the distance from the end point to the center by
r
ers f
f
f
f inches are being used) or 0.002 millimeter (if millime-
fsets of the center of the arc from the cur-
c in the selected
2-4
SmithyCNC Programmer’s Reference Manual: G-Codes
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
* or 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,
* or I and K are both omitted.
When the YZ G3instead 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, r at least one of the two must be used. It is an error if:
* Y and Z are both omi
* or J and K are both omitted.
Here is an example of a center format command to mill an arc: G17 G2 x10 y16 i3 j4 z9.
That means to mak
c whose axis is par
ical ar with its center offset in the X direction by 3 units from the current X location and offset in the Y direction by 4 units from the current Y location. If the current loca­tion has X=7, Y=7 at the outset, the center will be at X=10, Y=11. If the starting value of Z is 9, this is a circular arc; otherwise it is a helical arc. The radius of this
c would be 5.
ar
In the center format, the radius of the arc is not specified, but it may be found eas­ily as the distance from the center of the circle to either the current point or the end point of the arc.
-plane is selected, program G2 X
espectively) of the center of the circle. J and K ar
tted
e a clockwise (as viewed f
lel to the Z
al
-axis, ending where X=10, Y=16, and Z=9,
- Y- Z- A- B- C- J- K- (or use
e optional except that
axis) circular or hel-
-
e z
om the posi
r
tiv
SmithyCNC Programmer’s Reference Manual: G Codes
2-5
SmithyCNC Programmer’s Reference Manual:G Codes
2.4 G33: Spindle-Synchronized Motion
For spindle-synchronized motion, code G33 X- Y- Z- K- where K gives the distance moved in XYZ for each revolution of the spindle. This syntax is subject to change (In particular, to use F- instead of K-). For instance, G33 Z1 K.0625 pro­duces a 1 inch motion in Z over 16 revolutions of the spindle. This command might be part of a program to produce a 16TPI thread.
All the axis words are optional, except that at least one must be used. This will pro­duce coordinated linear motion to the destination point at a rate dependant on the speed of the spindle.
It is an error if:
* all axis words are omitted.
* the spindle is not turning when this command is executed
* the requested linear motion exceeds machine velocity
limits due to the spindle speed
2.5 G4: Dwell
For a dwell, program G4 P- . This will keep the ax time in seconds specified by the P number. It is an error if:
* the P number is negative.
es unmoving for the period of
2.6 G10: Set Coordinate System Data<sub:G10:-Set-Coordinate>
The RS274/NGC language view of coor
ection[sub:Coordinate-Systems].
S
o set the coor
T P - X- Y- Z- A- B- C-, where the P number must evaluate to an integer in
ange 1 to 9 (corr
the r The coordinates of the origin of the coordinate system specified by the P number
eset to the coor
e r
ar tem). Only those coordinates for which an axis word is included on the line will be reset.
dinate values for the origin of a coordinate system, program G10 L2
esponding to G54 to G59.3) and al
dinate v
alues giv
dinate systems is described in
l axis wor
en (in terms of the absolute coor
ds are optional.
dinate sys-
2-6
It is an error if:
* the P number does not evaluate to an integer in the
ange 1 to 9.
r
SmithyCNC Programmer’s Reference Manual: G-Codes
If origin offsets (made by G92 or G92.3) were in effect before G10 is used, they will continue to be in effect afterwards.
The coordinate system whose origin is set by a G10 command may be active or inactive at the time the G10 is executed.
Example: G10 L2 P1 x 3.5 y 17.2 sets the origin of the first coordinate system (the one selected by G54) to a point where X is 3.5 and Y is 17.2 (in absolute coordinates). The Z coordinate of the origin (and the coordinates for any rotational axes) are whatever those coordinates of the origin were before the line was executed.
2.7 G17, G18, G19: Plane Selection<sub:G17,-G18,-G19:>
Program G17 to select the XY-plane, G18 to select the XZ-plane, or G19 to select the YZ-plane. The effects of having a plane selected are discussed in Section [sub:G2,-G3:-Arc] and Section [sub:G81-to-G89:]
2.8 G20, G21: Length Units
Program G20 to use inches for length units. Program G21 to use millimeters.
It is usually a good idea to program either G20 or G21 near the beginning of a pro­gram before any motion occurs, and not to use either one anywher program. It is the responsibility of the user to be sure all numbers are appropriate for use with the current length units.
e else in the
2.9 G28, G30: Return to Predefined Absolute Position<sub:G28,-
G30:-Return>
wo positions are defined (by parameters 5161-5166 for G28 and parameters 5181-
T
or G30). The par
5186 f and the machine's nativ
eturn to the pr
o r
T G28 X- Y- Z- A- B- C- (or use G30 ...). All axis words are optional. The path is made
erse mo
v
a
y a tr
b a traverse move to the predefined position. If no axis words are programmed, the intermediate point is the current point, so only one move is made.
G28 and G30 do not use home switches to find the predefined position. They mere­ly command a r that the machine has already been homed.
apid motion to the posi
ameter v
e coor
edefined posi
e from the current position to the programmed position, followeby
v
alues ar
dinate system.
tion by way of the programmed position, program
e in terms of the absolute coor
tion defined by the parameters, assuming
dinate system
SmithyCNC Programmer’s Reference Manual: G Codes
2-7
SmithyCNC Programmer’s Reference Manual:G Codes
2.10 G38.2: Straight Probe<sub:G38.2:-Straight-Probe>
Program G38.2 X- Y- Z- A- B- C- to perform a straight probe operation. The axis words are optional, except that at least one of them must be used. The tool in the spindle must be a probe.
It is an error if:
* the current point is the same as the programmed point.
* no axis word is used
* cutter radius compensation is enabled
* the feed rate is zero
In response to this command, the machine moves the controlled point (which should be at the end of the probe tip) in a straight line at the current feed rate toward the programmed point. In inverse time feed mode, the feed rate is such that the whole motion from the current point to the programmed point would take the specified time. If the pr
obe does not trip during the move, an error is signal
led.
After successful probing, parameters 5061 to 5066 will be set to the coordinates of the location of the controlled point at the time the probe tripped.
A comment of the form (PROBEOPEN fi the coordinate of each successful straight probe in it. The file must be closed with (PROBECLOSE).
lename.txt) will open filename.txt and store
2.11 G40, G41, G42: Cutter Radius Compensation.<sub:G40,-
G41,-G42:>
ogram G40. It is OK to turn compensation
, pr
adius compensation of
o turn cut
T off when it is already off.
ter radius compensation may be performed only if the XY-plane is active.
Cut
o turn cut
T programmed path when the tool radius is positive), program G41 D- . To turn
ter r
cut grammed path when the tool radius is positive), program G42 D- . The D word is optional; i used. If used, the D number should normally be the slot number of the tool in the spindle, although this is not required. It is OK for the D number to be zero; a
ter r
ter radius compensation on left (i.e., the cutter stays to the left of the
adius compensation on right (i.e.
e is no D wor
f ther
d, the r
f
, the cut
adius of the tool currently in the spindle will be
ter stays to the right of the pro-
2-8
SmithyCNC Programmer’s Reference Manual: G-Codes
radius value of zero will be used.
It is an error if:
* the D number is not an integer, is negative or is larger than the number of carousel slots,
* the XY-plane is not active,
* or cutter radius compensation is commanded to turn on when it is already on.
The behavior of the machining center when cutter radius compensation is on is described in Chapter [cha:Cutter-Radius-Compensation]
2.12 G43, G49: Tool Length Offsets<sub:G43,-G49:-Tool>
2.12.1 G43 H-
To use a tool length offset from the tool table, program G43 H-, where the H num­ber is the desired index in the tool table. It is expected that all entries in this table will be positive. The H number should be, but does not have to be, the same as the slot number of the tool currently in the spindle. It is OK for the H number to be zero; an offset value of zero will be used.
It is an error if:
* the H number is not an integer
ousel slots.
car
, is negative, or is larger than the number of
2.12.2 G43 H-1 I- K-
To use a tool length offset from the program, use G43 H-1 I- K-, where I- gives the X tool offset (for lathes) and K- gives the Z tool offset (for lathes and mills).
It is an error if:
* motion is commanded on the same line as G43 H-1
2.12.3 G49
set, pr
o use no tool length of
T
am using the same of
It is OK to pr using no tool length offset if none is currently being used.
ogr
f
ogram G49.
set already in use. It is also OK to program
f
SmithyCNC Programmer’s Reference Manual: G Codes
2-9
SmithyCNC Programmer’s Reference Manual:G Codes
2.13 G53: Move in absolute coordinates<sub:G53:-Move-in>
For linear motion to a point expressed in absolute 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).
It is an error if:
* G53 is used without G0 or G1 being active,
* or G53 is used while cutter radius compensation is on.
See Section [sub:Coordinate-Systems] for an overview of coordinate systems.
2.14 G54 to G59.3: Select Coordinate System<sub:G54-to-
G59.3:>
To select coordinate system 1, program G54, and similarly for other coordinate sys­tems. The system-number-G-code pairs are: (1-G54), (2-G55), (3-G56), (4-G57), (5­G58), (6-G59), (7-G59.1), (8-G59.2), and (9-G59.3).
It is an error if:
* one of these G-codes is used while cutter radius
compensation is on.
ection [sub:Coor
ee S
S
dinate-
Systems] for an overview of coordinate systems.
2.15 G61, G61.1, G64: Set Path Control Mode<sub:G61,-G61.1,-
G64:>
Program G61 to put the machining center into exact path mode, G61.1 for exact stop mode, or G64 P- f program for the mode that is already active. See Section [sub:Path-Control-Mode]
or a discussion of these modes.
f
or continuous mode wi
th optional tolerance. It is OK to
2-10
2.16 G80: Cancel Modal Motion
am G80 to ensur
ogr
Pr an error if:
e no axis motion wi
ll occur. It is
SmithyCNC Programmer’s Reference Manual: G-Codes
* Axis words are programmed when G80 is active, unless
a modal group 0 G code is programmed which uses axis words.
2.17 G76: Threading Canned Cycle<sec:G76:-Threading-
Canned>
Program G76 P- Z- I- J- R- K- Q- H- to perform a threading canned cycle. It is an error if:
* The active plane is not the ZX plane
* Other axis words, such as X- or Y-, are specified
* The R- degression value is less than 1.0.
* All the required words are not specified
* J-, K- or H- is negative
The "drive line" is a safe line outside the thread material. The "drive line" goes from the initial location to the Z- value specified with G76. The Z extent of the thread is the same as the drive line.
The "thread pitch", or distance per revolution, is given by the P- value.
The "thread peak" is given by the I- value, which is an offset from the drive line. Negative I values indicate external threads, and positive I values indicate internal threads. Generally the material has been turned to this size before the canned cy
The "ini bey
The "f beyond the "thread peak" position. K- is positive, even when I- is negative.
The "depth degression" is given by the R- value. R1.0 selects constant depth on
cessiv
suc
2.0 select decreasing depth and increasing area. Values above 2.0 select decreasing
area.
The "compound slide angle" Q- is the angle (in degrees) describing to what extent
cessiv
suc side of the tool to remove more material than the other. A positive Q value causes
cle.
y the J- value. The first threading cut will be J
tial cut depth" is giv
ond the "thread peak" position. J- is positive, even when I- is negative.
l thread depth" is given by the K- value. The final threading cut will be K
ul
eading passes. R2.0 selects constant ar
e thr
e passes should be offset along the drive line. This is used to cause one
en b
alues between 1.0 and
ea. V
SmithyCNC Programmer’s Reference Manual: G Codes
2-11
SmithyCNC Programmer’s Reference Manual:G Codes
the leading edge of the tool to cut more heavily. Typical values are 29,
29.5 or 30.
The number of "spring passes" is given by the H- value. Spring passes are additional passes at full thread depth. If no additional passes are desired, program H0.
Each pass begins at a position on the drive line. It consists of
1. An X traverse to the depth for this pass
2. A pause for the spindle to reach index position
3. A spindle-synchronized Z feed along the thread
4. A traverse to the original X
5. On all passes but the last, a traverse Z move to the
beginning point for the next pass
The tool will pause briefly before each threading pass, so a relief groove will be required at the entry unless the beginning of the thr material.
The exi a slow spindle, the exit move might take only a small fraction of a revolution. If the spindle speed is increased after several passes are complete, subsequent exit moves will require a larger portion of a revolution, resulting in a very heavy cut during the exit move. This can be avoided by providing a relief groove at the exit, or by not changing the spindle speed whi
The sample pr pr
t move (traverse to original X) is not synchronized to the spindle speed. With
le threading.
am g76.ngc shows the use of the G76 canned cycle, and can be
ogr
eviewed and ex
ecuted on an
y machine using the sim/lathe.ini configur
ead is past the end of the
ation.
2.18 G81 to G89: Canned Cycles<sub:G81-to-G89:>
The canned cy section. Two examples are given with the description of G81 below.
All canned cycles are performed with respect to the currently selected plane. Any of the thr of the descriptions assume the XY-plane has been selected. The behavior is always analogous i
ee planes (XY
cles G81 through G89 have been implemented as described in this
, YZ, ZX) ma
f the YZ or XZ
y be selected. Thr
-plane is selected.
oughout this section, most
2-12
SmithyCNC Programmer’s Reference Manual: G-Codes
Rotational axis words are allowed in canned cycles, but it is better to omit them. If rotational axis words are used, the numbers must be the same as the current position numbers so that the rotational axes do not move.
All canned cycles use X, Y, R, and Z numbers in the NC code. These numbers are used to determine X, Y, R, and Z positions. The R (usually meaning retract) position is along the axis perpendicular to the currently selected plane (Z-axis for XY-plane, X-axis for YZ-plane, Y-axis for XZ-plane). Some canned cycles use additional arguments.
For canned cycles, we will call a number "sticky" if, when the same cycle is used on several lines of code in a row, the number must be used the first time, but is optional on the rest of the lines. Sticky numbers keep their value on the rest of the lines if they are not explicitly programmed to be different. The R number is always sticky.
In incremental distance mode: when the XY-plane is selected, X, Y, and R numbers are treated as increments to the current position and Z as an increment from the Z-axis position before the move involving Z takes place; when the YZ or XZ-plane is selected, treatment of the axis words is analogous. In absolute distance mode, the X, Y, R, and Z numbers are absolute positions in the current coordinate system.
The L number is optional and represents the number of repeats. L=0 is not allowed. If the repeat featur sequence of motions is repeated in several equally spaced places along a straight line. In absolute distance mode, L>1 means "do the same cycle in the same place several times,"
tting the L word is equivalent to specifying L=1. The L number is not sticky.
Omi
e is used, it is normally used in incremental distance mode, so that the same
When L>1 in incremental mode with the XY-plane selected, the X and Y positions are deter­mined by adding the given X and Y numbers either to the current X and Y positions (on the first go-around) or to the X and Y positions at the end of the previous go-around (on the repetitions). The R and Z positions do not change during the repeats.
act move at the end of each repeat (called "clear Z" in the descriptions
The height of the r below) is determined b
ve the R position and the retract mode is G98, OLD_Z), or otherwise to the R position.
is abo
ection [sub:G98,-G99:-
ee S
S
It is an error if:
* X, Y, and Z words are all missing during a canned cycle,
* a P number is required and a negative P number is used,
* an L number is used that does not ev
otational axis motion is used during a canned cycle,
* r
etr
y the set
et]
S
ting of the r
aluate to a positive integer,
act mode: ei
etr
ther to the original Z posi
tion (if that
SmithyCNC Programmer’s Reference Manual: G Codes
2-13
SmithyCNC Programmer’s Reference Manual:G Codes
* inverse time feed rate is active during a canned cycle,
* or cutter radius compensation is active during a canned cycle.
When the XY plane is active, the Z number is sticky, and it is an error if:
* the Z number is missing and the same canned cycle was not already active,
* or the R number is less than the Z number.
When the XZ plane is active, the Y number is sticky, and it is an error if:
* the Y number is missing and the same canned cycle was not already active,
* or the R number is less than the Y number.
When the YZ plane is active, the X number is sticky, and it is an error if:
* the X number is missing and the same canned cycle was not already active,
* or the R number is less than the X number.
2.18.1 Preliminary and In-Between Motion
At the very beginning of the execution of any of the canned cycles, with the XY­plane selected, if the current Z position is below the R position, the Z-axis is traversed to the R position. This happens only once, r
In addition, at the beginning of the first cycle and each repeat, the following one or two moves are made
erse parallel to the XY-plane to the given XY-position,
v
1. a str
2. a straight traverse of the Z-axis only to the R position, if it is not already at the R
position.
If the XZ or YZ plane is activ gous.
aight tr
a
e, the pr
eliminary and in-between motions are analo-
egardless of the v
alue of L.
2-14
2.18.2 G81: Drilling Cycle
The G81 cy
- A
- Z
Y
cle is intended for drilling. Program G81 X-
-
- L
- R
- C
- B
SmithyCNC Programmer’s Reference Manual: G-Codes
1. Preliminary motion, as described above.
2. Move the Z-axis only at the current feed rate to the Z position.
3. Retract the Z-axis at traverse rate to clear Z.
Example 1. Suppose the current position is (1, 2, 3) and the XY-plane has been select­ed, and the following line of NC code is interpreted.
G90 G81 G98 X4 Y5 Z1.5 R2.8
This calls for absolute distance mode (G90) and OLD_Z retract mode (G98) and calls for the G81 drilling cycle to be performed once. The X number and X position are 4. The Y number and Y position are 5. The Z number and Z position are 1.5. The R number and clear Z are 2.8. Old Z is 3. The following moves take place.
1. a traverse parallel to the XY-plane to (4,5,3)
2. a traverse parallel to the Z-axis to (4,5,2.8)
3. a feed paral
4. a traverse parallel to the Z-axis to (4,5,3)
Example 2. Suppose the current position is (1, 2, 3) and the XY-plane has been select­ed, and the following line of NC code is interpreted.
G91 G81 G98 X4 Y5 Z-0.6 R1.8 L3
This calls for incremental distance mode (G91) and OLD_Z retract mode (G98) and calls
or the G81 dri
f the Y number is 5, the Z number is -0.6 and the R number is 1.8. The ini is 5 (=1+4), the ini the Z posi
The first move is a traverse along the Z-axis to (1,2,4.8), since old Z < clear Z.
The first repeat consists of 3 moves.
1. a traverse parallel to the XY-plane to (5,7,4.8)
eed parallel to the Z-axis to (5,7, 4.2)
2. a f
averse parallel to the Z-axis to (5,7,4.8)
3. a tr
lel to the Z-axis to (4,5,1.5)
lling cycle to be repeated three times. The X number is 4,
tial Y position is 7 (=2+5), the clear Z position is 4.8 (=1.8+3), and
tion is 4
.2 (=4
.8-0.6). Old Z is 3.
tial X posi
tion
SmithyCNC Programmer’s Reference Manual: G Codes
2-15
SmithyCNC Programmer’s Reference Manual:G Codes
The second repeat consists of 3 moves. The X position is reset to 9 (=5+4) and the Y position to 12 (=7+5).
1. a traverse parallel to the XY-plane to (9,12,4.8)
2. a feed parallel to the Z-axis to (9,12, 4.2)
3. a traverse parallel to the Z-axis to (9,12,4.8)
The third repeat consists of 3 moves. The X position is reset to 13 (=9+4) and the Y position to 17 (=12+5).
1. a traverse parallel to the XY-plane to (13,17,4.8)
2. a feed parallel to the Z-axis to (13,17, 4.2)
3. a traverse parallel to the Z-axis to (13,17,4.8)
2.18.3 G82: Drilling Cycle with Dwell
The G82 cycle is intended for drilling. Program G82 X- Y- Z- A- B- C- R- L- P-
eliminary motion, as described above.
1. Pr
2. Move the Z-axis only at the current feed rate to the Z position.
3. Dwell for the P number of seconds.
4. Retract the Z-axis at traverse rate to clear Z.
2.18.4 G83: Peck Drilling
The G83 cycle (often called peck drilling) is intended for deep drilling or milling with chip breaking. The retracts in this cycle clear the hole of chips and cut off any long stringers (which are common when drilling in aluminum). This cycle takes a Q num­ber which represents a "delta" increment along the Z-axis. Program G83 X- Y- Z- A- B- C- R- L- Q-
1. Preliminary motion, as described above.
2. Move the Z-axis only at the current feed rate
downward by delta or to the Z position, whichever is less deep.
2-16
apid back out to the clear_z.
3. R
SmithyCNC Programmer’s Reference Manual: G-Codes
4. Rapid back down to the current hole bottom, backed off a bit.
5. Repeat steps 1, 2, and 3 until the Z position is reached at step 1.
6. Retract the Z-axis at traverse rate to clear Z.
It is an error if:
* the Q number is negative or zero.
2.18.5 G84: Right-Hand Tapping<sub:G84:-Right-Hand-Tapping>
This code is currently unimplemented in EMC2. It is accepted, but the behavior is unde­fined.
2.18.6 G85: Boring, No Dwell, Feed Out
The G85 cycle is intended for boring or reaming, but could be used for drilling or milling. Program G85 X- Y- Z- A- B- C- R- L-
eliminary motion, as described above.
1. Pr
2. Move the Z-axis only at the current feed rate to the Z position.
3. Retract the Z-axis at the current feed rate to clear Z.
2.18.7 G86: Boring, Spindle Stop, Rapid Out
The G86 cycle is intended for boring. This cycle uses a P number for the number of sec­onds to dwell. Program G86 X- Y- Z- A- B- C- R- L- P-
1. Preliminary motion, as described above.
2. Move the Z-axis only at the current feed rate to the Z position.
3. Dwell for the P number of seconds.
. Stop the spindle turning.
4
act the Z-axis at traverse rate to clear Z.
etr
5. R
as going.
estart the spindle in the dir
6. R
The spindle must be turning bef
ection i
or
t w
e this cy
cle is used. It is an err
or if:
SmithyCNC Programmer’s Reference Manual: G Codes
2-17
SmithyCNC Programmer’s Reference Manual:G Codes
* the spindle is not turning before this cycle is executed.
2.18.8 G87: Back Boring<sub:G87:-Back-Boring>
This code is currently unimplemented in EMC2. It is accepted, but the behavior is undefined.
2.18.9 G88: Boring, Spindle Stop, Manual Out
This code is currently unimplemented in EMC2. It is accepted, but the behavior is undefined.
2.18.10 G89: Boring, Dwell, Feed Out<sub:G89:-Boring,-Dwell,>
The G89 cycle is intended for boring. This cycle uses a P number, where P specifies the number of seconds to dwell. program G89 X- Y- Z- A- B- C- R- L- P-
1. Preliminary motion, as described above.
2. Move the Z-axis only at the current feed rate to the Z position.
3. Dwell for the P number of seconds.
4. Retract the Z-axis at the current feed rate to clear Z.
2.18.11 G90, G91: Set Distance Mode<sub:G90,-G91:-Set>
Interpretation of RS274/NGC code can be in one of two distance modes: absolute or incremental.
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. Any exceptions to that rule are described explicitly in this
ection [sub:G81-to-G89:].
S
o go into incr
T 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 set­ting. K numbers represent increments in all but one usage (see Section [sub:G87:­Back-Boring]), where the meaning changes with distance mode.
emental distance mode, pr
ogram G91. In incremental distance mode,
2-18
2.19 G92, G92.1, G92.2, G92.3: Coordinate System Offsets
SmithyCNC Programmer’s Reference Manual: G-Codes
<sub:G92,-G92.1,-G92.2,>
See Section [sub:Coordinate-Systems] for an overview of coordinate systems.
To make the current point have the coordinates you want (without motion), program G92 X- Y- Z- A- B- C- , where the axis words contain the axis numbers you want. All axis words are optional, except that at least one must be used. If an axis word is not used for a given axis, the coordinate on that axis of the current point is not changed. It is an error if:
1. all axis words are omitted.
When G92 is executed, the origin of the currently active coordinate system moves. To do this, origin offsets are calculated so that the coordinates of the current point with respect to the moved origin are as specified on the line containing the G92. In addition, parameters 5211 to 5216 are set to the X, Y, Z, A, B, and C-axis offsets. The offset for an axis is the amount the origin must be moved so that the coordinate of the controlled point on the axis has the specified value.
Here is an example. Suppose the current point is at X=4 in the currently specified coor­dinate system and the current X
-3, sets parameter 5211 to -3, and causes the X-coordinate of the current point to be 7.
-axis offset is z
ero, then G92 x7 sets the X-axis offset to
The axis offsets are always used when motion is specified in absolute distance mode using any of the nine coordinate systems (those designated by G54 - G59.3). Thus all nine coordinate systems ar
Being in incremental distance mode has no effect on the action of G92.
Non-zero offsets may be already be in effect when the G92 is called. If this is the case,the new v offset were zero, and B is the old offset. For example, after the previous example, the
alue of the curr
v
-
X
-5, which is calculated by [[7-9] + -3].
To reset axis offsets to zero, program G92.1 or G92.2. G92.1 sets parameters 5211 to 5216 to z
To set the axis offset values to the values given in parameters 5211 to 5216, program G92.3.
ou can set axis of
Y Program G92 in the first program. This will set parameters 5211 to 5216. Do not use G92.1 in the r saved when the first program exits and restored when the second one starts up. Use G92.3 near the beginning of the second program. That will restore the offsets saved in the first pr
alue of each of
ent point is 7. If G92 x9 is then programmed, the new X-axis offset is
eas G92.2 lea
, wher
o
er
sets in one pr
f
ogram. If other programs are to run between the the program that sets the
e affected by G92.
set is A+B
f
es their current values alone.
v
ogram and use the same offsets in another program.
emainder of the first pr
, wher
e A is what the of
am. The par
ogr
fset would be if the old
ameter values will be
SmithyCNC Programmer’s Reference Manual: G Codes
2-19
SmithyCNC Programmer’s Reference Manual:G Codes
offsets and the one that restores them, make a copy of the parameter file written by the first program and use it as the parameter file for the second program.
2.20 G93, G94: Set Feed Rate Mode<sub:G93,-G94:-Set>
Two feed rate modes are recognized: units per minute and inverse time. Program G94 to start the units per minute mode. Program G93 to start the inverse time mode.
In units per minute feed rate mode, an F word is interpreted to mean the controlled point should move at a certain number of inches per minute, millimeters per minute, or degrees per minute, depending upon what length units are being used and which axis or axes are moving.
In inverse time feed rate mode, an F word means the move should be completed in[one divided by the F number] minutes. For example, if the F number is 2.0, the move should be completed in half a minute.
When the inverse time feed rate mode is active, an F word must appear on every line which has a G1, G2, or G3 motion, and an F wor G1, G2, or G3 is ignored. Being in inverse time feed rate mode does not affect G0 (rapid traverse) motions. It is an error if:
* inverse time feed rate mode is active and a line with G1, G2, or G3 (explicitly or
tly) does not have an F word.
implici
d on a line that does not have
2.21 G98, G99: Set Canned Cycle Return Level<sub:G98,-G99:-Set>
When the spindle retracts during canned cycles, there is a choice of how far it retracts: (1) retract perpendicular to the selected plane to the position indicated by the R word, or (2) retract perpendicular to the selected plane to the position that axis was in just before the canned cycle started (unless that position is lower than the posi
o use option (1), pr
T the R word has different meanings in absolute distance mode and incremental distance mode.
tion indicated b
y the R word, in which case use the R word position).
am G99. To use option (2), program G98. Remember that
ogr
2-20
SmithyCNC Programmer’s Reference Manual: G-Codes
SmithyCNC Programmer’s Reference Manual:G Codes
2-21
SmithyCNC Programmer’s Reference Manual: G-Codes
Programmer’s Reference Guide
M Codes
Smithy CNC EZ-TROL SYSTEMS
3
SmithyCNC Programmer’s Reference Manual:M Codes
M-CODE OVERVIEW
In addition to the G-Codes, there is a set of M-Codes (miscellaneous codes) that are used to to control your machine tool and its auxillary functions.
3.1 M0, M1, M2, M30, M60: Program Stopping and Ending
<sub:M0,-M1,-M2,>
To stop a running program temporarily (regardless of the setting of the optional stop switch), program M0.
To stop a running program temporarily (but only if the optional stop switch is on), program M1.
It is OK to program M0 and M1 in MDI mode, but the effect will probably not be noticeable, because normal beha input, anyway.
vior in MDI mode is to stop after each line of
change pal
To ex (regardless of the setting of the optional stop switch), program M60.
If a pr will restart the program at the following line.
To end a program, program M2. To exchange pallet shuttles and then end a pro­gram, program M30. Both of these commands have the following effects.
1. Axis offsets are set to zero (like G92.2) and origin offsets are set to the
default (like G54).
2. S
3. Distance mode is set to MODE_ABSOLUTE (l
4. Feed rate mode is set to UNITS_PER_MINUTE (like G94).
5. Feed and speed overrides are set to ON (like M48).
6. Cut
ogram is stopped by an M0, M1, or M60, pressing the cycle start button
elected plane is set to CANON_PLANE_XY (like G17).
ter compensation is turned of
let shuttles and then stop a running program temporarily
e G90).
ik
e G40).
ik
f (l
3-2
7. The spindle is stopped (like M5).
8. The current motion mode is set to G_1 (like G1).
SmithyCNC Programmer’s Reference Manual: M-Codes
9. Coolant is turned off (like M9).
No more lines of code in an RS274/NGC file will be executed after the M2 or M30 command is executed. Pressing cycle start will start the program back at the beginning of the file.
3.2 M3, M4, M5: Spindle Control<sub:M3,-M4,-M5:>
o start the spindle turning clockwise at the currently programmed speed, pro-
T gram M3.
To start the spindle turning counterclockwise at the currently programmed speed, program M4.
To stop the spindle from turning, program M5.
It is OK to use M3 or M4 if the spindle speed is set to zero. If this is done (or if the speed override switch is enabled and set to zero), the spindle will not start turning. If, later, the spindle speed is set above zero (or the override switch is turned up), the spindle will start turning. It is OK to use M3 or M4 when the spindle is already turning or to use M5 when the spindle is already stopped.
3.3 M6: Tool Change<sub:M6:-Tool-Change>
To change a tool in the spindle f
ly selected (using a T wor
most r gram M6. When the tool change is complete:
* The spindle will be stopped.
* The tool that was selected (by a T word on the same line or on any line after the previous tool change) will be in the spindle. The T number is an integer giving the changer slot of the tool (not its id).
* If the selected tool was not in the spindle before the tool change, the tool that was in the spindle (if there was one) will be in its changer slot.
* The coordinate axes will be stopped in the same absolute position they were in before the tool change (but the spindle may be re-oriented).
* No other changes will be made. For example, coolant will continue to flow during the tool change unless
ecent
rom the tool current
d - see Section [sub:T
ly in the spindle to the tool
-Tool]), pro-
Select
:-
SmithyCNC Programmer’s Reference Manual: M Codes
3-3
SmithyCNC Programmer’s Reference Manual:M Codes
it has been turned off by an M9.
The tool change may include axis motion while it is in progress. It is OK (but not useful) to program a change to the tool already in the spindle. It is OK if there is no tool in the selected slot; in that case, the spindle will be empty after the tool change. If slot zero was last selected, there will definitely be no tool in the spindle after a tool change.
3.4 M7, M8, M9: Coolant Control<sub:M7,-M8,-M9:>
To turn mist coolant on, program M7.
To turn flood coolant on, program M8.
To turn all coolant off, program M9.
It is always OK to use any of these commands, regardless of what coolant is on or off.
3.5 M48, M49: Override Control<sub:M48,-M49:-Override>
To enable the spindle speed and feedrate override switches, program M48. To disable both switches, program M49. See Section [sub:Feed-Interaction] for more detai enabled or disabled. These switches can also be toggledindividually using M50 and M51 as described in the sections [sec:M50:-F Spindle-
ls. It is OK to enable or disable the switches when they are already
erride] and [sec:M51:-
Speed-Ov
erride-Contr
eed-Ov
ol].
3.6 M50: Feed Override Control<sec:M50:-Feed-Override>
To enable the feedrate override switch, program M50 or M50 P1. To disable the switch program M50 P0. While disabled the feed override will have no influence, and the motion will be executed at programmed feedrate.(unless there is an adaptive feedrate override active).
3.7 M51: Spindle Speed Override Control<sec:M51:-Spindle-
Speed-Override-Control>
To enable the spindle speed override switch, program M51 or M51 P1. To dis-
erride wi
able the swi have no influence, and the spindle speed will have the exact program specified value (using the S-word as described in [sub:S:-Set-Spindle]).
tch pr
am M51 P0. Whi
ogr
le disabled the spindle speed o
v
l
l
3-4
SmithyCNC Programmer’s Reference Manual: M-Codes
3.8 M52: Adaptive Feed Control<sec:M52:-Adaptive-Feed-Control>
To use an adaptive feed, program M52 or M52 P1. To stop using adaptive feed, pro­gram M52 P0. When adaptive feed is enabled, some external input value is used together with the user interface feed override value and the commanded feed rate to set the actual feed rate. In EMC2, the HAL pin motion.adaptive-feed is used for this purpose. Values on motion.adaptive-feed should range from 0 (feed hold) to 1 (full speed).
3.9 M53: Feed Stop Control<sec:M53:-Feed-Stop-Control>
To enable the feed stop switch, program M53 or M53 P1. To disable the switch pro­gram M53 P0. Enabling the feed stop switch will allow motion to be interrupted by means of the feedstop control. In EMC2, the HAL pin motion.feed-hold is used for this purpose. Values of 1 will cause the motion to stop (if M53 is active).
3.10 M62 to M65: Digital IO Control<sec:M62-to-M65:>
To control a digital output bit, program M- P-, where the M-word ranges from 62 to 65, and the P-
M62 Turn on digital output synched with motion
word ranges f
rom 0 to an implementation-defined maximum.
M63 Turn off digital output synched with motion
urn on digital output immediately
M64 T
M65 Turn off digital output immediately
3.11 M100 to M199: User Defined Commands
To invoke a user-defined command, program M- P- Q- where P- and Q- are both optional. The external program "Mnnn"in the directory [DISPLAY]PROGRAM_PREFIX
ecuted wi
is ex RS274NGC fi
It is an error if
* The specified User Defined Command does not exist
th the P and Q v
le pauses unti
alues as i
l the in
v
ts two ar
oked program exits.
guments. Execution of the
SmithyCNC Programmer’s Reference Manual: M Codes
3-5
Programmer’s Reference Guide
O Codes
Smithy CNC EZ-TROL SYSTEMS
4
SmithyCNC Programmer’s Reference Manual:O Codes
O-CODE OVERVIEW
O-codes provide for flow control in NC programs. Each block has an associated number, which is the number used after O. Care must be taken to properly match the O-numbers.
The behavior is undefined if
* Other words are used on a line with an O- word
4.1 Subroutines: "sub", "endsub", "return", "call"
Subroutines extend from a O- sub to an O- endsub. The lines inside the subrou­tine (the "body") are not executed in order; instead, they are executed each time the subroutine is called with O- call.
O100 sub (subroutine to move to machine home) G0 X0 Y0 Z0 O100 endsub (many intervening lines) O100 call
Inside a subroutine, O- return can be executed. This immediately returns to the calling code, just as though O- endsub was encountered.
O- call takes up to 30 optional arguments, which are passed to the subroutine
ameters from #N+1 to #30 have the same value as in
as #1, #2, ... the cal ters #1 through #30 (regardless of the number of arguments) will be restored to the v
Because "1 2 3" is parsed as the number 123, the parameters must be enclosed in square brackets. The following calls a subroutine with 3 arguments:
O200 call [1] [2] [3]
Subroutine bodies may not be nested. They may only be called after they are defined. They may be called from other functions, and may call themselves recursively if it makes sense to do so. The maximum subroutine nesting level is 10.
Subr parameters above #30 and those changes will be visible to the calling code.
ling context. On r
outines do not have "return values", but they may change the value of
, #N. P
alues they had before the call.
ar
eturn from the subr
outine the previous v
alues parame-
4-2
SmithyCNC Programmer’s Reference Manual: O-Codes
4.2 Looping: "do", "while", "endwhile", "break", "continue"
The "while loop" has two structures: while/endwhile, and do/while. In each case, the loop is exited when the "while"condition evaluates to false.
(draw a sawtooth shape) F100 #1 = 0 O101 while [#1 lt 10] G1 X0 G1 Y[#1/10] X1 #1 = [#1+1] O101 endwhile
Inside a while loop, O- break immediately exits the loop, and O- continue imme­diately skips to the next evaluation of the while condition. If it is still true, the loop begins again at the top. If it is false, it exits the loop.
4.3 Conditional: "if", "else", "endif"
The "if" condi another if it is false.
eed rate depending on a variable)
(Set f O102 if [#2 GT 5] F100 O102 else F200 O102 endi
tional ex
f
ecutes one group of statements if a condition is true and
4.4 Indirection
The O- value may be given by a parameter or calculation.
O[#101+2] call
SmithyCNC Programmer’s Reference Manual: O Codes
4-3
SmithyCNC Programmer’s Reference Manual:O Codes
4-4
SmithyCNC Programmer’s Reference Manual: O-Codes
SmithyCNC Programmer’s Reference Manual: O Codes
4-5
SmithyCNC Programmer’s Reference Manual:O Codes
4-6
SmithyCNC Programmer’s Reference Manual: O-Codes
SmithyCNC Programmer’s Reference Manual: O Codes
4-7
SmithyCNC Programmer’s Reference Manual:O Codes
4-8
SmithyCNC Programmer’s Reference Manual: O-Codes
SmithyCNC Programmer’s Reference Manual: O Codes
4-9
SmithyCNC Programmer’s Reference Manual:O Codes
4-10
SmithyCNC Programmer’s Reference Manual: O-Codes
SmithyCNC Programmer’s Reference Manual: O Codes
4-11
SmithyCNC Programmer’s Reference Manual:O Codes
4-12
SmithyCNC Programmer’s Reference Manual: O-Codes
SmithyCNC Programmer’s Reference Manual: O Codes
4-13
SmithyCNC Programmer’s Reference Manual:O Codes
4-14
SmithyCNC Programmer’s Reference Manual: O-Codes
SmithyCNC Programmer’s Reference Manual: O Codes
4-15
SmithyCNC Programmer’s Reference Manual:O Codes
4-16
SmithyCNC Programmer’s Reference Manual: O-Codes
SmithyCNC Programmer’s Reference Manual: O Codes
4-17
SmithyCNC Programmer’s Reference Manual:O Codes
4-18
SmithyCNC Programmer’s Reference Manual: O-Codes
SmithyCNC Programmer’s Reference Manual: O Codes
4-19
SmithyCNC Programmer’s Reference Manual:O Codes
4-20
SmithyCNC Programmer’s Reference Manual: O-Codes
SmithyCNC Programmer’s Reference Manual:O Codes
4-21
SmithyCNC Programmer’s Reference Manual: O-Codes
Programmer’s Reference Guide
Other Codes
Smithy CNC EZ-TROL SYSTEMS
5
SmithyCNC Programmer’s Reference Manual: Other Codes
OTHER CODES
5.1 F: Set Feed Rate<sub:F:-Set-Feed>
To set the feed rate, program F- . The application of the feed rate is as described in Section [sub:Feed-Rate], unless inverse time feed rate mode is in effect, in which case the feed rate is as described in Section [sub:G93,-G94:­Set].
5.2 S: Set Spindle Speed<sub:S:-Set-Spindle>
To set the speed in revolutions per minute (rpm) of the spindle, program S- . The spindle will turn at that speed when it has been programmed to start turn­ing. It is OK to program an S word whether the spindle is turning or not. If the speed o ent from what is programmed. It is OK to program S0; the spindle will not turn if that is done. It is an error if:
verride swi
tch is enabled and not set at 100%, the speed wi
ll be differ-
* the S number is negative.
As described in S canned cycle is active and the feed and speed override switches are enabled, the one set at the lower setting wi still be synchronized. In this case, the speed may differ from what is pro­grammed, even if the speed override switch is set at 100%.
ection [sub:G84:-Right-Hand-Tapping], if a G84 (tapping)
ll take effect. The speed and feed rates will
5.3 T: Select Tool<sub:T:-Select-Tool>
To select a tool, program T-, where the T number is the carousel slot for the
ammed (see S
tool. The tool is not changed unti Tool-Change]). The T word may appear on the same line as the M6 or on a pre­vious line. It is OK, but not normally useful, if T words appear on two or more lines with no tool change. The carousel may move a lot, but only the most recent T word will take effect at the next tool change. It is OK to program T0; no tool will be selected. This is usefulif you want the spindle to be empty after a
f:
tool change. It is an err
* a negative T number is used,
* or a T number larger than the number of slots in the
ousel is used.
car
or i
l an M6 is pr
ogr
ection [sub:M6:-
5-2
SmithyCNC Programmer’s Reference Manual: Other-Codes
On some machines, the carousel will move when a T word is programmed, at the same time machining is occurring. On such machines, programming the T word several lines before a tool change will save time. A common programming practice for such machines is to put the T word for the next tool to be used on the line after a tool change. This maximizes the time available for the carousel to move.
SmithyCNC Programmer’s Reference Manual: Other Codes
5-3
Programmer’s Reference Guide
Order of Execution
Smithy CNC EZ-TROL SYSTEMS
6
SmithyCNC Programmer’s Reference Manual: Order of Execution
ORDER OF EXECUTION
6.1 Order of Execution<sec:Order-of-Execution>
The order of execution of items on a line is critical to safe and effective machine operation. Items are executed in the order shown below if they occur on the same line.
1. Comment (including message)
2. set feed rate mode (G93, G94).
3. set feed rate (F).
4. set spindle speed (S).
5. select tool (T).
6. change tool (M6).
7. spindle on or of
8. coolant on or off (M7, M8, M9).
9. enable or disable overrides (M48, M49).
10. dwell (G4).
11. set active plane (G17, G18, G19).
12. set length units (G20, G21).
13. cut
14. cutter length compensation on or off (G43, G49)
15. coordinate system selection (G54, G55, G56, G57, G58, G59, G59.1, G59.2,
G59.3).
ter radius compensation on or off (G40, G41, G42)
f (M3, M4, M5).
6-2
16. set path contr
17. set distance mode (G90, G91).
ol mode (G61, G61.1, G64)
SmithyCNC Programmer’s Reference Manual: Order of Execution
18. set retract mode (G98, G99).
19. home (G28, G30) or change coordinate system data G10) or set axis offsets
(G92, G92.1, G92.2, G94).
20. perform motion (G0 to G3, G33, G80 to G89), as modified (possibly) by
G53.
21. stop (M0, M1, M2, M30, M60).
SmithyCNC Programmer’s Reference Manual: Oreder of Execution
6-3
Programmer’s Reference Guide
G Code Best Practices
Smithy CNC EZ-TROL SYSTEMS
7
SmithyCNC Programmer’s Reference Manual: G-Code Best Practices
G-CODE BEST PRACTICES
7.1 Use an appropriate decimal precision
Use at least 3 digits after the decimal when milling in millimeters, and at least 4 digits after the decimal when milling in inches. In particular, arc tolerance checks are made to .001 and .0001 depending on the active units.
7.2 Use consistent white space
G-code is most legible when at least one space appears before words. While it is
tted to insert whitespace in the middle of numbers, there is no reason
permi to do so.
7.3 Prefer "Center-format" arcs
Center-format arcs (which use I- J- K- instead of R-) behave more consistently than R-format arcs, particularly for included angles near 180 or 360 degrees.
7.4 Put important modal settings at the top of the file
When correct execution of your program depends on modal settings, be sure to set them at the beginning of the part program. Modes can carry over from pre­vious pr
As a good preventative measure, put a line similar to the following at the top of
l your programs:
al
G17 G20 G40 G49 G54 G80 G90 G94
(XY plane, inch mode, cancel diameter compensation, cancel length of dinate system 1, cancel motion, non-incremental motion, feed/minute mode)
Perhaps the most critical modal setting is the distance units--If you do not include G20 or G21, then different machines will mill the program at different scales. Other settings, such as the return mode in canned cycles may also be important.
ograms and from the MDI commands.
set, coor
f
-
7-2
7.5 Don't put too many things on one line
erything in S
e ev
gnor
I of code that is the slightest bit ambiguous. Similarly, don't use and set a param­eter on the same line, even though the semantics are well defined. (Exception:
ection [sec:Order-of-Execution], and instead write no line
SmithyCNC Programmer’s Reference Manual: G-Code Best Practices
Updating a variable to a new value, such as #1=#1+#2)
7.6 Don't use line numbers
Line numbers offer no benefits. When line numbers are reported in error mes­sages, the numbers refer to the line number in the file, not the N-word value.
SmithyCNC Programmer’s Reference Manual: G-Code Best Practices
7-3
Programmer’s Reference Guide
Coordinate Systems
Smithy CNC EZ-TROL SYSTEMS
8
SmithyCNC Programmer’s Reference Manual: Coordinate System
COORDINATE SYSTEM AND G92 OFFSET
8.1 Overiew
You have seen how handy a tool length offset can be. Having this allows the programmer to ignore the actual tool length when writing a part program. In the same way, it is really nice to be able to find a prominent part of a casting or block of material and work a program from that point rather than having to take account of the location at which the casting or block will be held during the machining.
This chapter introduces you to offsets as they are used by the EMC. These include;
* machine coordinates (G53)
* nine offsets (G54-G59.3 )
* a set of global offsets (G92).
8.2 The Machine Position Command (G53)
Regardless of any offsets that may be in effect, putting a G53 in a block of code tells the interpreter to go to the real or absolute axis positions commanded in the block. For example
g53 g0 x0 y0 z0
will get you to the actual position where these three axes are zero. You might use a command like this if you have a favorite position for tool changes or if your machine has an auto tool changer. You might also use this command to get
y so that y
the tool out of the w
G53 is not a modal command. It must be used on each line where motion based upon absolute machine position is desired.
a
ou can r
otate or change a part in a vice.
8-2
SmithyCNC Programmer’s Reference Manual: Coordinate System
8.3 Fixture Offsets (G54-G59.3 )
Figure 8-1 Offsets
Work or fixture offset are used to make a part home that is different from the absolute, machine coordinate system. This allows the part programmer to set up home positions f would be to mill multiple copies of parts on "islands" in a piece, similar to figure 8-1.
or multiple parts. A typical oper
ation that uses fixture offsets
The values for offsets are stored in the VAR file that is requested by the INI file during the startup of an EMC. In our example below we'll use G55. The values for each axis for G55 are stored as variable numbers.
5241 0.000000
5242 0.000000
5243 0.000000
5244 0.000000
5245 0.000000
5246 0.000000
In the VAR file scheme, the first variable number stores the X offset, the second
SmithyCNC Programmer’s Reference Manual: Coordinate System
8-3
SmithyCNC Programmer’s Reference Manual: Coordinate System
the Y offset and so on for all six axes. There are numbered sets like this for each of the fixture offsets.
Each of the graphical interfaces has a way to set values for these offsets. You can also set these values by editing the VAR file itself and then issuing a [reset] so that the EMC reads the new values. For our example let's directly edit the file so that G55 takes on the following values.
5241 2.000000
5242 1.000000
5243 -2.000000
5244 0.000000
5245 0.000000
5246 0.000000
You should read this as moving the zero positions of G55 to X = 2 units, Y= 1 unit, and Z = -2 units away from the absolute zero position.
Once there are values assigned, a call to G55 in a program block would shift the zero reference by the values stored. The following line would then move each
tion. Unlike G53, G54 through G59.3 are modal
axis to the new zer comands. They will act on all blocks of code after one of them has been set. The program that might be run using figure [fig:offsets] would require only a single coor done there. The following code is offered as an example of making a squareusing the G55 offsets that we set above.
G55 G0 x0 y0 z0
g1 f2 z-0.2000
x1
y1
dinate reference for each of the locations and all of the work to be
o posi
8-4
x0
y0
SmithyCNC Programmer’s Reference Manual: Coordinate System
g0 z0
g54 x0 y0 z0
m2
"But," you say, "why is there a G54 in there near the end." Many programmers leave the G54 coordinate system with all zero values so that there is a modal code for the absolute machine based axis positions. This program assumes that we have done that and use the ending command as a command to machine zero. It would have been possible to use g53 and arrive at the same place but that command would not have been modal and any commands issued after it would have returned to using the G55 offsets because that coordinate system would still be in effect.
G54 use preset work coordinate system 1
G55 use preset work coordinate system 2
G56 use preset work coordinate system 3
G57 use preset work coor
G58 use preset work coordinate system 5
G59 use preset work coordinate system 6
G59.1 use pr
G59.2 use preset work coordinate system 8
G59.3 use pr
8.3.1 Default coordinate system
One other variable in the VAR file becomes important when we think about off­set systems. This variable is named 5220. In the default files its value is set to
1.00000. This means that when the EMC starts up i
nate system as i offset system as its default for startup and reset. Any value other than an interger (decimal really) between 1 and 9 will cause the EMC to fault on startup.
eset work coordinate system 7
eset work coor
ault. If you set this to 9.00000 it would use the nineth
ts def
dinate system 4
dinate system 9
t should use the first coor
di
-
SmithyCNC Programmer’s Reference Manual: Coordinate System
8-5
SmithyCNC Programmer’s Reference Manual: Coordinate System
8.3.2 Setting coordinate system values within G-code.
In the general programming chapter we listed a G10 command word. This command can be used to change the values of the offsets in a coordinate system. (add here)
8.4 G92 Offsets
G92 is the most misunderstood and maligned part of EMC programming. The
ay that it works has changed just a bit from the early days to the current
w releases. This change has confused many users. It should be thought of as a temporary offset that is applied to all other offsets.
In response to criticism of it, Ray Henry studied it by comparing the way the interpreter authors expected it to work and the way that it worked on his Grizzly minimill. The following quoted paragraphs are extracted from his paper which is available in several text formats in the dropbox at [http://www.linuxcnc.org].
8.4.1 The G92 commands
This set of commands include;
G92 This command, when used wi values to of
G92.1 This command sets zero values to the g92 variables.
G92.2 This command suspends but does not z g92 variables.
G92.3 This command appl been suspended.
When the commands are used as described above, they will work pretty much as you would expect.
A user must understand the corr set based upon the location of each axis when the g92 command is in The NIST document is clear that, "To make the current point have the coordinates" x0, y0, and z0 you would use g92 x0 y0 z0. G92 does not work
om absolute machine coor
r
f
fset variables.
ies of
dinates. It works from current location.
th axis names, sets
ero out the
set values that have
f
ect ways that the g92 values work. They are
ed.
ok
v
8-6
SmithyCNC Programmer’s Reference Manual: Coordinate System
G92 also works from current location as modified by any other offsets that are in effect when the g92 command is invoked. While testing for differences between work offsets and actual offsets it was found that a g54 offset could cancel out a g92 and thus give the appearance that no offsets were in effect. However, the g92 was still in effect for all coordinates and did produce expected work offsets for the other coordinate systems.
It is likely that the absence of home switches and proper home procedures will result in very large errors in the application of g92 values if they exist in the var file. Many EMC users do not have home switches in place on their machines. For them home should be found by moving each axis to a location and issuing the home command. When each axis is in a known location, the home command will recalculate how the g92 values are applied and will produce consistent results. Without a home sequence, the values are applied to the position of the machine when the EMC begins to run.
8.4.2 Setting G92 values
There are at least two ways to set G92 values.
* right mouse click on position displays of tkemc will popup a window into which you can type a value.
* the g92 command
Both of these work f be applied.
Issuing g92 x y z a b c does in fact set values to the g92 variables such that each axis takes on the value associated with its name. These values are assigned to the current position of the machine axis. These results satisfy para­graphs one and two of the NIST document.
G92 commands work f to give the current axis position the value assigned by the g92 command. The effects work even though previous offsets are in.
So if the X axis is currently showing 2.0000 as its position a G92 x0 will set an
set of -2.0000 so that the curr
f
of
set of 0.0000 and the displayed position will not change. A G92
set an of X5.0000 will set an offset of 3.0000 so that the current displayed position becomes 5.0000.
f
rom the current location of the axis to which the offset is to
om curr
r
ent axis location and add and subtr
ent location of X becomes z
act correctly
o. A G92 X2 will
er
SmithyCNC Programmer’s Reference Manual: Coordinate System
8-7
SmithyCNC Programmer’s Reference Manual: Coordinate System
8.4.3 G92 Cautions
Sometimes the values of a G92 offset get stuck in the VAR file. When this hap­pens reset or a startup will cause them to become active again. The variables are named
5211 0.000000
5212 0.000000
5213 0.000000
5214 0.000000
5215 0.000000
5216 0.000000
where 5211 is the X axis offset and so on. If you are seeing unexpected posi­tions as the r position displays when you start up, look at these variables in the VAR file and see if they contain values. If they do, set them to zeros and the problems should go away.
With these tests we can see that reset returns g92 to the condition that it had when the interpreter started up lished ... that no write of these values occurs during a normal run so if no g92 was set at the startup, none will be read in during a reset.
It may be that this is the heart of the problem that some have experienced with differences between the old and the new interpreter. It may well be, but I leave it to others to test, that the old interpr
alues to the v
v
On the other hand, if G92 values existed in the VAR file when the EMC started up... starting the EMC with g92 values in the var file is that it will apply the val­ues to current location of each axis. If this is home position and home position is set as machine z
ished using r
l tion and issuing an axis home command, g92 commands and values work as advertised.
esult of a commanded move, or even unexpected numbers in the
. The r
le and then f
ar fi
erything wi
o ev
er
eal machine switches or moving each axis to a known home posi-
ound those values during a reset.
eader should note that we have estab-
ams immediately wr
eter and task pr
l be correct. Once home has been estab-
l
ogr
ote
8-8
SmithyCNC Programmer’s Reference Manual: Coordinate System
These tests did not study the effect of re-reading the var file while they contain numbers. This could cause problems if g92 offsets had been removed with g92.1 but the var file still contained the previous numbers.
It is this complexity that causes us to say that G92 values must be treated as temporary. They should be used to set global short term offsets. The G54-59.3 coordinate systems should be used whenever long lasting and predictable off­sets are needed.
8.5 Sample Program Using Offsets
This sample engraving project mills a set of four .1 radius circles in roughly star shape around a center circle. We can setup the individual circle pattern like this.
G10 L2 P1 x0 y0 z0 (ensure that g54 is set to machine zero)
g0 x-.1 y0 z0
g1 f1 z-.25
g3 x-.1 y0 i.1 j0
g0 z0
m2
We can issue a set of commands to create offsets for the four other circles like this.
y 0.5 inch)
sets g55 x v
G10 L2 P2 x0.5 (of
G10 L2 P3 x-0.5 (offsets g56 x value by -0.5 inch)
G10 L2 P4 y0.5 (offsets g57 y value by 0.5 inch)
G10 L2 P5 y
e put these together in the f
W
(a program for milling five small circles in a diamond shape)
G10 L2 P1 x0 y0 z0 (ensur
-0.5 (of
f
sets g58 y value by -0.5 inch)
f
alue b
am.
lowing pr
ol
e that g54 is machine zero)
ogr
SmithyCNC Programmer’s Reference Manual: Coordinate System
8-9
SmithyCNC Programmer’s Reference Manual: Coordinate System
G10 L2 P2 x0.5 (offsets g55 x value by 0.5 inch)
G10 L2 P3 x-0.5 (offsets g56 x value by -0.5 inch)
G10 L2 P4 y0.5 (offsets g57 y value by 0.5 inch)
G10 L2 P5 y-0.5 (offsets g58 y value by -0.5 inch)
g54 g0 x-.1 y0 z0 (center circle)
g1 f1 z-.25
g3 x-.1 y0 i.1 j0
g0 z0
g55 g0 x-.1 y0 z0 (first offset circle)
g1 f1 z
g3 x-.1 y0 i.1 j0
g0 z0
g56 g0 x-.1 y0 z0 (second of
g1 f1 z-.25
g3 x-.1 y0 i.1 j0
g0 z0
g57 g0 x
g1 f1 z-.25
g3 x-.1 y0 i.1 j0
-.25
-.1 y0 z0 (thir
d of
fset circle)
set circle)
f
8-10
g0 z0
g58 g0 x-.1 y0 z0 (fourth offset circle)
SmithyCNC Programmer’s Reference Manual: Coordinate System
g1 f1 z-.25
g3 x-.1 y0 i.1 j0
g54 g0 x0 y0 z0
m2
Now comes the time when we might apply a set of G92 offsets to this program. You'll see that it is running in each case at z0. If the mill were at the zero position, a g92 z1.0000 issued at the head of the program would shift every­thing down an inch. You might also shift the whole pattern around in the XY plane by adding some x and y offsets with g92. If you do this you should add a G92.1 command just before the m2 that ends the program. If you do not, other programs that you might run after this one will also use that g92 offset. Furthermore it would save the g92 values when you shut down the EMC and they will be recalled when you start up again.
SmithyCNC Programmer’s Reference Manual: Coordinate System
8-11
Programmer’s Reference Guide
Tool File & Compensation
Smithy CNC EZ-TROL SYSTEMS
9
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
TOOL FILE AND COMPENSATION
9.1 Tool File
The EMC uses a tool file that is read in when a machine control is started. In a standard release this file is named emc.var, generic.var, or sim.var and is used by the similarly named run file. The specific name of the file that will be used is set by the ini file that is read at startup.
A tool file is required. It tells which tools are in which carousel slots and what the length and diameter of each tool are. The Interpreter does not deal directly
th tool files. A tool file is read by the EMC system and the Interpreter gets the
wi tool information by making calls to canonical functions that obtain it.
The header l graphical interfaces, so it is suggested (but not required) that such a line always be included as the first line in the file.
Table 9-1:
ine shown in T
Typical Tool File
able [tbl:Tool_file1] is essential f
or some of the
POC FMS LEN DIAM COMMENT
1 1 1.565 0.250 Drill
2 2 1.000 0.247 Reground End Mill
3 3 1.125 2.00 Carbide Insert Face Mill
4 4 - -
5 5 - -
32 32 - -
Each data line of the file contains the data for one tool. Each line has five entries. The first four entries are required. The last entry (a comment) is option­al. It makes reading easier if the entries are arranged in columns, as shown in
ement is that there be at least one space or
the table, but the only f tab after each of the first three entries on a line and a space, tab, or newline at the end of the f to be put in each are as follows.
ourth entry
ormat r
equir
. The meanings of the columns and the t
ype of data
9-2
SmithyCNC Programmer’s Reference Manual: Tool File and Compensation
The "POC" column contains an unsigned integer which represents the pocket number (slot number) of the tool carousel slot in which the tool is placed. The entries in this column must all be different.
The
"FMS" column contains an unsigned integer whichrepresents a code num­ber for the tool. The user may use any code for any tool, as long as the codes are unsigned integers.
The
"LEN" column contains a real number which represents the tool length off­set. This number will be used if tool length offsets are being used and this pocet is selected. This is normally a positive real number, but it may be zero.
The
"DIAM" column contains a real number. This number is used if tool radius compensation is turned on using this pocket number. If the programmed path during compensation is the edge of the material being cut, this should be a pos­itive real number representing the measured diameter of the tool. If the pro­grammed path during compensation is the path of a tool whose diameter is nominal, this should be a small number (positive, negative, or zero) represent­ing the difference between the measured diameter of the tool and the nominal diameter used when the G-code f
The "
COMMENT" column may optionally be used to describe the tool. Any type
of description is OK. This column is for the benefi
or the part was written.
t of human readers only.
The units used for the length and diameter of the tool may be in either millime­ters or inches, but if the data is used b the units used for a tool in the file are the same as the units in effect when NC code that uses the tool data is interpreted.
The lines do not have to be in any particular order. Switching the order of lines has no effect. If the same pocket number is used on two or more lines, which should not normally be done, the data for only the last such line will persist and be used.
y an NC pr
ogram, the user must be sure
9.2 Tool Compensation
ool compensation can cause pr
T
ut it can be a powerful aid when used to help an operator get a part to size.
B
ting and r
y set
B sets can be made durring a production run that allow for variation in tool size, or for minor deviation from the programmed distances and size. And these changes can be made wi numbers in a pr
eseting length and diameter of tools in a single tool table, of
thout the oper
ogram file.
oblems f
or the best of nc code programmers.
ator ha
ving to search through and cange
-
f
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
9-3
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
Throughout this unit you will find ocasional references to cannonical functions where these are necessary for the reader to understand how a tool offset works in a specific situation. These references are intended to give the reader a sense of sequence rather than requiring the reader to understand the way that cannonical functions themselves work within the EMC.
9.3 Tool Length Offsets
Tool length offsets are given as positive numbers in the tool table. A tool length
fset is programmed using G43 Hn, where n is the desired table index. It is
of expected that all entries in the tool table will be positive. The H number is checked for being a non-negative integer when it is read. The interpreter behaves as follows.
1. If G43 Hn is programmed, A USE_TOOL_LENGTH_OFFSET(length) function call is made (where length is the value of the tool length offset entry in the tooltable whose index is n), tool_length_offset is reset in the machine settings model, and the value of current_z in the model is adjusted. Note that n does not have to be the same as the slot number of the tool currently in the spindle.
2. If G49 is programmed, USE_T tool_length_offset is reset to 0.0 in the machine settings model, and the value of current_z in the model is adjusted. The effect of tool length compensation is illustrated in the screen shot below. Notice that the length of the tool is sub­tracted f ting.† You should note that the effect of tool length compensation is immediate when you view the z position as a relative coordinate but it does affect actual machine posi
Test tool length program.
ool #1 is 1 inch long.
T
N01 G1 F15 X0 Y0 Z0 N02 G43 H1 Z0 X1 N03 G49 X0 Z0 N04 G0 X2 N05 G1 G43 H1 G4 P10 Z0 X3 N06 G49 X2 Z0 N07 G0 X0
rom the z setting so that the tool tip appears at the pr
tion until you program a z move.
OOL_LENGTH_OFFSET(0.0) is called,
ogrammed set-
9-4
Figure 9-1 Test Tool Length Program
SmithyCNC Programmer’s Reference Manual: Tool File and Compensation
The effect of this is that in most cases the machine will pick up the offset as a ramp during the next xyz move after the g43 word.
9.4 Cutter Radius Compensation
By Jon Elson
Cutter Diameter Compensation (also called Cutter Radius Compensation) is something that w demand of users, as it is VERY useful, but the implementation was poorly thought out. The purpose of this feature is to allow the programmer of the tool path program to 'virtualize' the tool path, so that the control can, at run time, determine the correct offset from the surface to be cut, based on the tools available. If you resharpen the side cutting edges of end mills, then they will end up smaller than the standard diameters.
The problem is to describe to the control whether the tool is going to be cutting on the outside of an imaginary path, or on the inside. Since these paths are not necessarily closed paths (although they can be), it is essentially impossible for the control to know which side of the l decided that there would only be two choices, tool 'left' of path, and tool 'right' of path. This is to be interpreted as left or right 'when facing the direction
ter motion'. The interpretation is as if you were standing on the part,
of cut walking behind the tool as i
as obviously added onto the RS-274D specification at the
ine it is supposed to offset to. It was
t progresses acr
oss the part.
9.4.1 Cutter Radius Compensation Detail
By Tom Kramer and Fred Proctor
ties of the interpreter enable the pro-
i
adius compensation capabi
The cut gr closed contour in the XY-plane composed of arcs of circles and straight line seg­ments. The contour may be the outline of material not to be machined away, or it may be a tool path to be followed by an exactly sized tool. This figure shows two examples of the path of a tool cutting using cutter radius compensation so that i
ter r
ammer to speci
es a triangle of material remaining.
v
t lea
y that a cutter should travel to the right or left of an open or
f
l
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
9-5
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
In both examples, the shaded triangle represents material which should remain after cutting, and the line outside the shaded triangle represents the path of the tip of a cutting tool. Both paths will leave the shaded triangle uncut. The one on the left (with rounded corners) is the path the interpreter will generate. In the method on the right (the one not used), the tool does not stay in contact with the shaded triangle at sharp corners.
Figure 9-2 Radius Compensation
9-6
e place whi
Z axis motion ma Portions of the contour may be skipped by retracting the Z axis above the part, following the contour to the next point at which machining should be done, and
e-extending the Z-axis. These skip motions may be performed at feed rate (G1)
r or at traverse rate (G0). Inverse time feed rate (G93) or units per minute feed rate (G94) may be used with cutter radius compensation. Under G94, the feed
l apply to the actual path of the cutter tip, not to the programmed con-
l
ate wi
r
.
tour
Programming Instructions
* To start cutter radius compensation, program either G41 (for keeping the tool to the left of the contour) or G42 (f tour). In Figure 7, for example, if G41 were programmed, the tool would stay left and mo tool would stay right and move counterclockwise around the triangle.
y tak
e clockwise ar
v
ound the triangle, and i
le the contour is being followed in the XYplane.
or keeping the tool to the right of the con-
ammed, the
ogr
f G42 wer
e pr
SmithyCNC Programmer’s Reference Manual: Tool File and Compensation
* To stop cutter radius compensation, program G40.
* If G40, G41, or G42 is programmed in the same block as tool motion, cutter compensation will be turned on or off before the motion is made. To make the motion come first, the motion must be programmed in a separate, previous block.
D Number
The current interpreter requires a D number on each line that has the G41 or G42 word. The value specified with D must be a non-negative integer. It repre­sents the slot number of the tool whose radius (half the diameter given in the tool table) will be used, or it may be zero (which is not a slot number). If it is zero, the value of the radius will also be zero. Any slot in the tool table may be selected this way. The D number does not have to be the same as the slot num­ber of the tool in the spindle.
Tool Table
ter radius compensation uses data from the machining center's tool table.
Cut For each slot in the tool carrousel, the tool table contains the diameter of thetool in that slot (or the difference between the actual diameter of the tool in the slot and its nominal v to put data into the table when using the stand-alone interpreter is discussed in the tool table page.
alue). The tool table is indexed by slot number
. How
Two Kinds of Contour
The interpr
* The contour given in the NC code is the edge of material that is not to be machined away. We will call this type a "material edge contour".
* The contour giv tool of exactly the correct radius. We will call this type a "tool path contour".
The interpreter does not have any setting that determines which type of contour is used, but the description of the contour will differ (for the same part geome­try) between the two t
ferent for the two types.
f
di
eter handles compensation for two types of contour:
en in the NC code is the tool path that would be f
ypes and the v
alues f
or diameters in the tool table wi
lowed b
ol
y a
l be
l
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
9-7
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
Material Edge Contour
When the contour is the edge of the material, the outline of the edge is described in the NC program. For a material edge contour, the value for the diameter in the tool table is the actual value of the diameter of the tool. The value in the table must be positive. The NC code for a material edge contour is the same regardless of the (actual or intended) diameter of the tool.
Example 1 :
Here is an NC program which cuts material away from the outside of the trian­gle in figure above. In this example, the cutter compensation radius is the actu­al radius of the tool in use, which is 0.5, The value for the diameter in the tool table is twice the radius, which is 1.0.
N0010 G41 G1 X2 Y2 (turn compensation on and make entry move)
N0020 Y
N0030 X-2 (follow bottom side of triangle)
N0040 X2 Y2 (follow hypotenuse of triangle)
N0050 G40 (turn compensation off)
This will result in the tool following a path consisting of an entry move and the path shown on the left going clockwise ar coordinates of the triangle of material appear in the NC code. Notice also that the tool path includes three arcs which are not explicitly programmed; they are generated automatically.
Tool Path Contour
When the contour is a tool path contour, the path is described in the NC pro­gram. It is expected that (except for during the entry moves) the path is intend­ed to create some part geometry. The path may be generated manually or by a post the interpr with the edge of the part geometry, as shown on the left side of Figure 7. If a path of the sort shown on the right of Figure 7 is used, in which the tool does not stay in contact with the part geometry all the time, the interpreter will
-1 (follow right side of triangle)
ocessor
-pr
, considering the part geometry which is intended to be made. F
eter to work, the tool path must be such that the tool sta
ound the triangle. Notice that the
or
ys in contact
9-8
SmithyCNC Programmer’s Reference Manual: Tool File and Compensation
not be able to compensate properly when undersized tools are used. For a tool path contour, the value for the cutter diameter in the tool table will be a small positive number if the selected tool is slightly oversized and will be a small negative number if the tool is slightly undersized. As implemented, if a cutter diameter value is negative, the interpreter compensates on the other side of the contour from the one programmed and uses the absolute value of the given diameter. If the actual tool is the correct size, the value in the table should be zero.
Tool Path Contour example
Suppose the diameter of the cutter currently in the spindle is 0.97, and the diameter assumed in generating the tool path was 1.0. Then the value in the tool table for the diameter for this tool should be -0.03. Here is an NC program which cuts material away from the outside of the triangle in the figure.
N0010 G1 X1 Y4.5 (make alignment move) N0020 G41 G1 Y3.5 (turn compensation on and make first entry move) N0030 G3 X2 Y2.5 I1 (mak N0040 G2 X2.5 Y2 J-0.5 (cut along arc at top of tool path) N0050 G1 Y-1 (cut along right side of tool path) N0060 G2 X2 Y-1.5 I of tool path) N0070 G1 X-2 (cut along bottom side of tool path) N0080 G2 X-2.3 Y of tool path) N0090 G1 X1.7 Y2.4 (cut along hypotenuse of tool path) N0100 G2 X2 Y2.5 I0.3 J-0.4 (cut along ar tool path) N0110 G40 (turn compensation off)
-0.5 (cut along arc at bottom right
-0.6 J0.5 (cut along ar
e second entry move)
c at bottom left
c at top of
e and two entry moves, and
This wi then f clockwise around the triangle. This path is to the right of the programmed path even though G41 was programmed, because the diameter value is negative.
Programming Errors and Limitations
The interpr involving cutter radius compensation.
1. Cannot change axis offsets with cutter radius comp
l
lowing a path sl
ol
eter wi
ll issue the following messages
ly inside the path shown on the left in Figure 7 going
ight
t in the tool making an al
esul
l r
ignment mo
v
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
9-9
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
2. Cannot change units with cutter radius comp
3. Cannot turn cutter radius comp on out of XY-plane
4. Cannot turn cutter radius comp on when already on
5. Cannot use G28 or G30 with cutter radius comp
6. Cannot use G53 with cutter radius comp
7. Cannot use XZ plane with cutter radius comp
8. Cannot use YZ plane with cutter radius comp
9. Concave corner with cutter radius comp
10. Cutter gouging with cutter radius comp
11. D wor
12. Tool radius index too big
13. Tool radius not less than arc radius with cutter
radius comp
14. Two G codes used from same modal group.
For some of these messages additional explanation is given below.
Changing a tool while cutter radius compensation is on is not treated as an error, although it is unlikely this would be done intentionally. The radius used when cut unti
When cutter radius compensa­tion is on, it must be ph possible f cle whose radius is the half the
d on line with no cut
adius compensation w
ter r
l compensation is turned of
ly
ysical
or a cir
-
Figure 9-3 Two Cutter Radius Compensation Errors
ter comp on (G41 or G42) command
l continue to be used
as first turned on wi
en though a new tool is actually being used.
, ev
f
l
9-10
SmithyCNC Programmer’s Reference Manual: Tool File and Compensation
diameter given in the tool table to be tangent to the contour at all points of the contour.
In particular, the interpreter treats concave corners and concave arcs into which the circle will not fit as errors, since the circle cannot be kept tangent to thecon­tour in these situations. This error detection does not limit the shapes which can be cut, but it does require that the programmer specify the actual shape to be cut (or path to be followed), not an approximation. In this respect, the inter­preter differs from interpreters used with many other controllers, which often allow these errors silently and either gouge the part or round the corner. If cut­ter radius compensation has already been turned on, it cannot be turned ona­gain. It must be turned off first; then it can be turned on again. It is not neces­sary to move the cutter between turning compensation off and back on, but the move after turning it back on will be treated as a first move, as described below.
It is not possible to change from one cutter radius index to another while com­pensation is on because of the combined effect of rules 4 and 11. It is also not possible to switch compensation from one side to another while compensation is on. If the tool is alr radius compensation is turned on, the gouging message is given when the line of NC code which gives the point is reached. In this situation, the tool is already cutting into material i
eady covering up the next XY destination point when cut
t should not cut.
ter
If a D word is programmed that is larger than the number of tool carrousel
n the current implementation, the number of
slots, an error message is giv slots is 68.
The err message used for many sets of G codes. As applied to cutter radius compensa­tion, it means that more than one of G40, G41, and G42 appears on a line of NC code. This is not allowed.
First Move
The algorithm used for the first move when the first move is a straight line is to draw a straight line from the destination point which is tangent to a circle whose center is at the current point and whose radius is the r the center of a cir nation point. This is shown in Figure 9. If the programmed point is inside the initial cross section of the tool (the circle on the left), an error is signalled.
or message. "two G Codes Used from Same Modal Group," is a generic
adius of the tool. The destination point of the tool tip is then f
cle of the same r
en. I
ound as
adius tangent to the tangent line at the desti-
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
9-11
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
If the first move after cutter radius compensation has been turned on is an arc, the arc which is generated is derived from an auxiliary arc which has its center at the programmed center point, passes through the programmed end point, and is tangent to the cutter at its current location. If the auxiliary arc cannot be constructed, an error is signalled. The generated arc moves the tool so that it stays tangent to the auxiliary arc throughout the move. This is shown in Figure 9-1.
Figure 9-4 First Radius Compensatin Move-Straight
Figure 9-5 First Radius Cutter Radius Compensation Move-Arc
Regardless of whether the first move is a straight line or an arc, the Z axis may also move at the same time. It will move linearly, as it does when cutter radius compensation is not being used.R
lowed wi
al
After the entry moves of cutter radius compensation, the interpreter keeps the tool tangent to the programmed path on the appropriate side. If a convex cor-
th cutter radius compensation, but using them would be very unusual.
otary axis motions (A, B
, and C ax
es) ar
e
9-12
SmithyCNC Programmer’s Reference Manual: Tool File and Compensation
ner is on the path, an arc is inserted to go around the corner. The radius of the arc is half the diameter given in the tool table.
When cutter radius compensation is turned off, no special exit move takes place. The next move is what it would have been if cutter radius compensation had never been turned on and the previous move had placed the tool at its current position.
Programming Entry Moves
In general, an alignment move and two entry moves are needed to begin com­pensation correctly. However, where the programmed contour is a material edge contour and there is a convex corner on the contour, only one entry move (plus, possibly, a pre-entry move) is needed. The general method, which will work in all situations, is described first. We assume here that the programmer knows what the contour is already and has the job of adding entry moves.
General Method
The gener moves. The entry moves given above will be used as an example. Here is the relevant code again:
N0010 G1 X1 Y4.5 (make aligment move to point C) N0020 G41 G1 Y3.5 (turn compensation on and make first entry move to point B) N0030 G3 X2 Y2.5 I1 (make second entry move to point A)
See Figure 11. The figure shows the two entry moves but not the align­ment move.
First, pick a point A on the contour wher entry arc. Specify an arc outside the contour which begins at a point B and ends at A tangent to the contour (and going in the same direction as it is planned to go ar The r than half the diameter given in the tool table. Then extend a line tangent to the arc from
al method includes programming an al
enient to attach an
t is con
e i
adius of the ar
v
ound the contour).
c should be larger
Figure 9-6 Cutter Radius Compenstion Entry Moves
ignment move and two entry
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
9-13
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
B to some point C, located so that the line BC is more than one radius long.
After the construction is finished, the code is written in the reverse order from the construction. Cutter radius compensation is turned on after the alignment­move and before the first entry move. In the code above, line N0010 is the alignment move, line N0020 turns compensation on and makes the first entry move, and line N0030 makes the second entry move.
In this example, the arc AB and the line BC are fairly large, but they need not be. For a tool path contour, the radius of arc AB need only be slightly larger than the maximum possible deviation of the radius of the tool from the exact size. Also for a tool path contour, the side chosen for compensation should be the one to use if the tool is oversized. As mentioned earlier, if the tool is under­sized, the interpreter will switch sides.
Simple Method
If the contour is a material edge contour and there is a convex corner some­where on the contour, a simpler method of making an entry is available. See
e 9-7.
Figur
First, pick a convex corner, D. Decide which way you want to go along the con­tour from D. In our example we ar and going next towards F. Extend the line FD (if the next part of the contour is an arc, extend the tangent to arc FD from D) to divide the area outside the con­tour near D into two regions. Make sure the center of the tool is currently in the region on the same side of the extended line as the material inside the contour near D. If not, move the tool into that
egion. I
r
epr
r of the center of the tool. Since it is on the same side of line DF as the shaded triangle, no additional move is needed. Now wri code that turns compensation on and moves to point D
n the example, point E
esents the curr
ent location
te a l
ine of NC
e keeping the tool to the left of the contour
Figure 9-7 Simple Radius Compensation Entry
9-14
N0010 G41 G1 X2 Y2 (turn compensation on and make entry move)
SmithyCNC Programmer’s Reference Manual: Tool File and Compensation
This method will also work at a concave corner on a tool path contour, if the actual tool is oversized, but it will fail with a tool path contour if the tool is undersized.
Other Items Where Cutter Radius Compensation is Performed.
The complete set of canonical functions includes functions which turn cutter radius on and off, so that cutter radius compensation can be performed in the controller executing the canonical functions. In the interpreter, however, these commands are not used. Compensation is done by the interpreter and reflected in the output commands, which continue to direct the motion of the center of the cutter tip. This simplifies the job of the motion controller while making the job of the interpreter a little harder.
Algorithms for Cutter Radius Compensation
The interpreter allows the entry and exit moves to be arcs. The behavior for the intermediate moves is the same, except that some situations treated as errors in the interpr
Data for Cutter Radius Compensation
eter are not treated as err
ors in other machine controls.
The interpreter machine model keeps three data items for cutter radius compen­sation: the setting itself (right, left, or off), program_x, and program_y. The last two repr pensation is on. When compensation is off, these both are set to a very small­number (10 -20 ) whose symbolic value (in a #define) is "unknown". The inter-
eter machine model uses the data items current_x and current_y to represent
pr the position of the center of the tool tip (in the currently active coordinate sys­tem) at all times.
Jon Elson's Example
All further system-specific information refers to NIST's EMC program, but much of it applies to most modern CNC controls. My method of checking these pro­grams is to first select tool zero, which always has a diameter of zero, so offset commands are essentially ignored. Then, I tape a sheet of paper to a piece of material that si pen in the spindle. This is a standar metal, in a 1/2" diameter steel housing. It has a spring that loads the pen against the front, and a 'collet' at the front that allows the pen to retract against the spring, but keeps it centered within a few thousandths of an inch. I run the
esent the X and Y posi
el in m
ts lev
tions which are given in the NC code while com-
y vise, as a sort of platen. I instal
lpoint pen refill cartridge made of
d bal
l a spring-loaded
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
9-15
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
program with tool zero selected, and it draws a line at the actual part's outline. (see figure below) Then, I select a tool with the diameter of the tool I intend to use, and run the program again. (Note that Z coordinates in the program may need to be changed to prevent plunging the pen through the platen.) Now, I get to see whether the G41 or G42 compensation that I specified will cut on the desired side of the part. If it doesn't, I then edit the opposite compensation command into the program, and try again. Now, with the tool on the correct side of the work, you get to see if there are any places where the tool is 'too fat' to fit in a concave part of the surface. My old Allen-Bradley 7320 was pretty forgiving on this, but EMC is a complete stickler. If you have ANY concavity where two lines meet at less than 180 degrees on the side that a tool of finite size cuts on, EMC will stop with an error message there. Even if the gouge will be .0001" deep. So, I always make the approach on the lead-in and lead-out moves such that they just nip the corner of the part a tiny bit, providing an angle just over 180 degrees, so that EMC won't squawk. This requires some careful adjustment of the starting and ending points, which are not compensated by cutter radius, but must be chosen with an approximate radius in mind.
The oper
G40 - Cancel Cutter compensation G41 - Cutter Compensation, T G42 - Cutter Compensation, Tool Right of Path
Here is a short fi cave arcs, and several straight cuts, too. It is to clamp a high speed drilling spindle to the side of the main Bridgeport spindle. Most of these commands are
aight from Bobcad/CAM, but lines N15 and N110 were added by me, and
str some of the coordinates around those lines had to be fudged a bit by me.
N10 G01 G40 X-1.3531 Y3.4 N15 F10 G17 G41 D4 X N20 X0. Y3.1875 N40 X0.5667 F10 N50 G03 X0.8225 Y3.3307 R0.3 N60 G02 X2.9728 Y4.3563 R2.1875 N70 G01 X7.212 Y3.7986 N80 G02 X8.1985 Y3.2849 R1.625 N90 G03 X8.4197 Y3.1875 R0.3 N100 G01 X9. N110 G40 X10.1972 Y3.432 (COMP LEAD OUT N220 M02
ative commands are :
le that cuts one side of a part wi
7 Y3.1875 (COMP LEAD IN)
-0.
ool Left of Path
th multiple convex and con-
9-16
SmithyCNC Programmer’s Reference Manual: Tool File and Compensation
Line 15 contains G41 D4, which means that the diameter of the tool described as tool #4 in the tool table will be used to offset the spindle by 1/2 the diame­ter, which is, of course, the tool's radius. Note that the line with the G41 com­mand contains the endpoint of the move where the radius compensation is interpolated in. What this means is that at the beginning of this move, there is no compensation in effect, and at the end, the tool is offset by 100% of the selected tool radius. Immediately after the G41 is D4, meaning that the offset is by the radius of tool number 4 in the tool table. Note that tool DIAMETERS are entered in the tool table. (Jon's tool diameter is about 0.4890)
But, note that in line 110, where the G40 'cancel cutter compensation' command is, that cutter compensation will be interpolated out in this move. The way I have these set up, the moves in lines 15 and 110 are almost exactly parallel to the X axis, and the difference in Y coordinates is to line the tool up outside the portion of the program where cutter compensation is in force.
Figure 9-9 Cutter Compensation
am starts with a G40, to turn off
ome other things to note ar
S any compensation that was in effect. This saves a lot of hassle when the pro­gram stops due to a concavity error, but leaves the compensation turned on. Also note in line 15 that G17 is used to select the XY plane for circular interpolation. I have used the radius form of arc center specification rather than the I,J f nates, and they must match at the beginning and end of the mo 10^-11 internal units, so you will have lots of problems with arbitrary arcs. Usually, if you do an arc of 90 degrees, centered at (1.0,1.0) with a radius of 1", everything will go fine, but if it has a radius that can not be expressed exactly in
orm. EMC is v
ery picky about the r
e that the pr
ogr
adius i
t computes f
rom I,J coordi-
e to within
v
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
9-17
SmithyCNC Programmer’s Reference Manual: Tool File & Compensation
just a few significant digits, or the arc is a strange number of degrees, then there will be trouble with EMC. The R word clears up all that mess, and is a lot easier to work with, anyway. If the arc is more than 180 degrees, R should be negative.
9.5 Tool Compensation Sources
This unit borrows heavily from the published works of Tom Kramer and Fred Proctor at NIST and the cutter compensation web page of Jon Elson.
Papers by Tom Kramer and Fred Proctor http://www.isd.mel.nist.gov/personnel/kramer/publications.html http://www.isd.mel.nist.gov/personnel/kramer/pubs/RS274NGC_22.pdf
http://www.isd.mel.nist.gov/personnel/kramer/pubs/RS274VGER_11.pdf
Pages by Jon Elson http://artsci.wustl.edu/~jmelson/ http://206.19.206.56/diacomp.htm
tp://206.19.206.56/lencomp.htm
ht
9-18
SmithyCNC Programmer’s Reference Manual: Tool File and Compensation
Loading...