Every
CNC programmer and most of CNC machine operators have a simple chart of all
common G-commands (G-codes) and M-functions (M-codes), usually tucked away
somewhere under the lid of their tool box or they have them posted on any
convenient machine side or cork board. This chapter covers most of those
G-codes that are either uncommon, seldom used, special, or outright mysterious.
Keep in mind that machine manufacturers often add G-codes and M-codes of their
own. These special codes or functions cannot be covered in a general
publication, such as this handbook.
Miscellaneous
functions (M-functions) are not covered here at all, as they are often very
much dependent on the machine tool manufacturer - for that reason, they are not
part of this chapter. The situation is much different with various G-codes,
some standard, some optional - they are covered here.
These
special and less frequently used G-codes are as important as those used on a
daily basis, even if only as accepting them for possible future use.
Programmers often forget that there are many preparatory commands available
that are not used very frequently. In this chapter, the focus will be on those
G-codes that may sometimes become the key to solving a particular problem or
achieving a particular programming goal. Some of these preparatory G-codes have
a direct relationship with each other, in which case, all related commands will
be considered together and explained together.
Divided
into seven groups, seventeen preparatory commands covered in this chapter are:
Of
course, the words
'rarely'
and
'seldom'
are very subjective and rather relative. A
preparatory command listed here as 'seldom used' may be used daily by some
programmers. The opposite is true as well - commands not listed in this chapter
are considered common - or at least
more
common - yet, some programmers
may not use them at all.
In
this conclusion of the 'special' G-codes subject, just a few brief notes
relating to those G-codes that could be listed here but were not:
Tool Length Offset Negative - G44
It
is virtually impossible to consider G44 without considering the related command
G43. Let's look at their standard definitions first:
The
G44 command is (almost) never used in daily CNC programming. Think of the G44
command as the
exact
opposite of G43 command,
and at the same time think of some reasonable and practical applications for
this command - most likely, you will find none. In order to use G44 over G43,
there must be a benefit that is not found in the G43 application - then the G44
may be justified..
Tool Length Offset Cancel - G49
This
is one command that asks a simple question -
to use it or not to use it
? It has its firm adherents and its equally
determined opponents - both camps claim that their approach is better. Without
prejudice, let me state this - you programmers in both camps are right - up to
a point, at least. In that respect, G49 becomes a rather strange command,
perhaps even a bit foggy. Its single purpose is also a simple purpose - to
cancel the tool length offset
, initialized by the G43 (or G44) command,
usually programmed at the beginning of each tool. So what is all the fuss
about?
A
lot depends on the part program itself - how it is written, particularly in
terms of its structure. Program structure determines the
order
and
placement
of various commands and
functions within the program body at the most convenient locations,
particularly before and after the many machining sequences. In my
CNC Programming Handbook
, I have promoted a program structure that has
been proven to work for the majority of programming situations. Here is its
generic format:
G21
G17 G40 G80 T01
M06
G90 G54 G00 X.. Y.. S.. M03 T02
G43 Z2.0 H01 M08
G01 Z-... F…
<... machining
commands ...>
G00 Z2.0 M09
G28 Z2.0 M05
M01
No
G49 at all. Why? Because the program structure is designed to
allow
its omission. What is a seldom known fact is
that the G28 (machine zero return) command
automatically cancels
the tool length offset. This statement should
satisfy the opponents of programming G49. I plead guilty here.
Like
a coin with two sides, there are also two sides of this argument, and fair is
fair. If you wish to include the G49 in the part program, why not? Go for it.
The above structure can be modified in two places, just by adding the G49
command:
N1 G21
N2 G17 G40 G49 G80 T01
(G49 USED)
N3 M06
N4 G90 G54 G00 X.. Y.. S.. M03 T02
N5 G43 Z2.0 H01 M08
N6 G01 Z-5.0 F…
<... machining
commands ...>
N27 00 Z2.0 M09
N28 G49 G28 Z2.0 M05
(G49 USED)
N29 M01
If
that is not
much
ado about nothing
, then what
is? While both approaches are very acceptable, and the program structure is
followed - where is the catch? There is none -
providing the structure
is
followed!
The most important part of the program structure
is the call of G43, before the machining sequences take over. Now consider this
- what will happen
if
the G43 block is forgotten,
simply missing for the next tool. It should not happen, but what if it
does
happen? There are two possibilities:
-
Possibility #1 ... G49 is used in the
program
-
Possibility #2 ... G49 is
not
used in the program
Going
from one tool to another within a single program always means repeating many
commands, even if they are modal. This is a very worthwhile practice and saves
many headaches later. So, here is a program structure for two tools, where G49
is used, but G43 is
'forgotten'
for the second tool:
(=== G49 IS USED IN THE PROGRAM ===)
N1 G21
N2 G17 G40 G49 G80 T01
(G49 USED)
N3 M06
N4 G90 G54 G00 X.. Y.. S.. M03 T02
N5 G43 Z2.0 H01 M08
N6 G01 Z-5.0 F…
<... machining
commands for T01 ...>
N27 G00 Z2.0 M09
N28 G49 G28 Z2.0 M05
(G49 USED)
N29 M01
N30 T02
N31 M06
N32 G90 G54 G00 X.. Y.. S.. M03 T03
<... missing G43
block … >
(N33
G43 Z2.0 H02 M08
missing
)
N34 G01 Z-5.0 F…
<... machining
commands for T02 ...>
N52 G00 Z2.0 M09
N53 G49 G28 Z2.0 M05
(G49 USED)
N54 M01
Apart
from a relatively minor problem of losing the coolant function, the
consequences of the G43 omission for the second tool are far more severe. This
is what will happen (correct setup is assumed) for
Possibility #1
(G49 is used in the program):
G49 IS Programmed
The
first tool will machine the part just fine. Then, the next tool - T02 - is brought
into the spindle and moves to the first XY location. So far, all goes as
planned. The block after N32 should be G43 block, etc., - but that block is
missing!
There will be no alarm, no message - no
notification whatsoever - in fact, there will be
no warning
. The control system will simply interpret the
Z-axis motion in block N34 as originating from machine zero - there is no tool
to be considered, there is no tool length to be considered. Because of that,
the point at the spindle gage line (spindle reference point at machine zero)
will act as the tool tip and will try to move to the Z-5.0 location. That may
not present a problem,
if
the spindle were empty
. Of
course, that is not the case at all - the spindle is
not
empty - there is a real tool - set and
designated as T02 - and this tool has a length that reaches far below the
spindle gage line. Situations such as this one provide good reasons for real
worries, because without an alert reaction of the CNC operator, a disaster is
ready to strike.
G49 IS NOT Programmed
What
about the other alternative - the one where G49 is
not
included in the program? Is it a better
alternative? Does it solve the problem? Should you prefer it?
Evaluate
the following program - it is the same one as above, but no G49 is programmed.
(=== G49 IS NOT USED IN THE PROGRAM ===)
N1 G21
N2 G17 G40 G80 T01
N3 M06
N4 G90 G54 G00 X.. Y.. S.. M03 T02
N5 G43 Z2.0 H01 M08
N6 G01 Z-5.0 F…
<... machining
commands for T01 ...>
N27 G00 Z2.0 M09
N28 G28 Z2.0 M05
N29 M01
N30 T02
N31 M06
N32 G90 G54 G00 X.. Y.. S.. M03 T03
<... missing G43
block … >
(N33
G43 Z2.0 H02 M08
missing)
N34 G01 Z-5.0 F…
<... machining
commands for T02 ...>
N52 G00 Z2.0 M09
N53 G28 Z2.0 M05
N54 M01
To
answer the earlier questions - yes,
this
is
a better alternative to the
previous version, and no, it
does
not
solve the problem. Whether
you should prefer this version largely depends on the major consideration,
described next. Don't make too many assumptions here and don't think that all
is clear - the situation is still potentially dangerous, but
a lot less
dangerous than in the previous example. How much
is less? Actually 50% less - and here is why.
Again,
the first tool will perform flawlessly, as before. This time, there is no G49
tool length cancellation transferred to the next tool (T02), so the current
tool length will still be in effect. In this case, the tool length offset for
the tool T02 will be exactly the same as the tool length offset for tool T01.
Not exactly an ideal situation, but a situation that has a chance to succeed.
The
benefit of
not
programming the G49 is based on the rather
dubious chance of 50/50 in case of a program error. If the
actual
physical length of T02 is shorter the
actual
physical length of T01, no collision will take
place - and no machining will take place either. Of course, this is not the
expected activity, but at least it is an activity that does no harm.
Corrections to the program still have to made, but under friendly overall
conditions.
If
the program does include G49 and the situation is equal to the one described,
the potential for a
collision
is much greater. Please, do not make the mistake of thinking that 50/50 chance
is better - it
is
not. Both examples create problems and are potentially dangerous situations.
The focus of this section
was
to come to a single conclusion:
As
you see from the demonstration, even an apparently insignificant missing of a
single G-code often
makes
a great difference in the final results. So what is the moral of this section …
?
Conclusion
Other
G-codes can be added to this chapter, depending on the exact interpretation of
the term
'seldom
used G-codes'
. In my
CNC Programming Handbook
, subtitled
A Comprehensive Guide to Practical CNC Programming
, most G-codes were explained in great detail,
such as coordinate rotation G68 and G69, data input G10, scaling commands G50
and G51. Also included were some G-codes that are not used very often or not
used any more, such as position compensation codes G45 through G48. Fanuc Macro
B related G-codes G65 through G67 and the whole subject of macros are covered
in a separate book,
Fanuc
CNC Custom Macros
, with the
subtitle
Programming
Resources for Fanuc Custom B Users
.
Both books have been published by Industrial Press, Inc., New York, NY, USA.
In
this handbook, a special chapter has been set aside for the plane selection
commands G17 through G19, containing many details, techniques and special
applications.
Copyright © 2006
Industrial Press Inc.