|
CNC stands for Computer Numerical Control
and refers to the operation of a machine tool via motors, switches, and so
on, with a computer controlling the whole shebang. The tool itself may be
as small as a benchtop lathe or as large as the gantry mills used to
machine airplane wing spars. If you really needed an answer to this
question, then you probably won't be very interested in the rest of this.
CNC programs are usually made up of word
addresses. These start with a letter and are usually followed by
a numeric value. A word is usually referred to by its letter, hence the
word X3.5 (specifying an X axis position) would be called an "X-word"
and the word F15.0 (specifying a feedrate) would be called an "F-word"
(really!). "G-words" specify things called Preparatory Function Codes
and have come to be called "G-codes". (Do not refer to "G-words" in
earshot of a CNC programmer. "F-words" are generally ok to use.) G-codes
often trigger machine movement - actually to be technically proper, they
often trigger slide or axis movement. However, improperly used they
sometimes cause machine movement.)
Think of these as 26 counters labeled A
through Z inside the CNC controller.
G0 is generally used to
denote a rapid traverse. For example, the command G0 X5.0 Z3.5 would cause
the tool to move to an X position on 5.0 and a Z position of 3.5 as
quickly as possible.
G1 is used to move the tool
in a straight line at a feedrate you specify. This is a bit more
complicated than it might first appear since moving from point A to point
B at a specific rate often involves moving 3 machine axes at three
different rates. G1 is usually called linear interpolation. The command G1
X4.5 Y3.0 Z-2.5 F20.0 would cause the tool to move to the specified XYZ
position at a rate of 20 inches or millimeters per minute.
G2 is where things can
start to get more complicated. It's always used to make an arc, moving
clockwise at a rate you specify. The G2 format you'll see most creates an
arc in the XY plane and specifies the arc center incrementally - for
example G2 X-0.26 Y1.14 I0.5 J0.0 means "Starting from where the tool is
now, move clockwise in an arc. The center of the arc has an X value 0.5
greater than the current position (from I0.5) and the same Y value as the
current position (J0.0). Stop when you get to X-0.26 and Y1.14. Travel at
whatever feedrate I last specified."
Things get more complex if you need an arc that's not
parallel to the XY plane. Some machines allow G2 commands in the YZ and ZX
planes, in which case Z axis center references are handled by the K-word.
Some machines will create a helix with a G2. Some will create a circle
with one G2, others may be limited to less than 90 degrees.
You can usually assume that a controller's G2 command
makes a clockwise arc, but not that it will be specified as
described above. Some controllers require absolute center coordinates
rather than relative, and some require an arc radius rather than a center,
and some use all of these methods in various combinations. The EIA
standards specify incremental centers but early lobbying by some folks
(the Postprocessor Writer's Guild?) appears to have created a
situation whereby there are actually several ways to define a circle
center.
If you really
need to know more, click here.
G3 is like a G2, just think
counterclockwise.
G4 is like some
folks we've all worked with. It does nothing for a specified time. It just
dwells - you'll have to check your controller manual to see what
follows the G4. Some use X, F, or P words in milliseconds, some allow an S
word to specify spindle revolutions, and some allow nothing at all and
default to about a half second.
G5 thru
G89 will be dealt with as time permits. For now, the important
ones to look up somewhere else are G17, G18, and G19. These have a
dramatic effect on G2 and G3. Also, G53 thru G59 can transform your whole
program (pun intended) and those in the G80 range can make a "hole" lot of
difference.
G90 indicates that
programmed values are to be treated as absolute, or actual
coordinate values. If the programs issues a G1 X5.0 Z 2.0 , then the tool
moves to that position. A venerable German tool maker once told us how he
remembers that G90 means absolute - he said that the German word for
absolute is obsolute and that the "o" looks like the "0" in G90.
Actually, the German word for absolute starts with an "a", so either he
couldn't spell (possible) or we misunderstood (likely). Either way, it's a
good way to remember.
G91 indicates that
programmed values are to be treated as incremental, or relative coordinate
values. If the programs issues a G1 X5.0 Z 2.0 , then the tool moves
five units in the positive X direction and two in the positive Z
direction. The same tool maker (see G90) said that the "i" in the German
inkrement looked like the "1" in G91.
As usual, there's more than one answer - even for the
abbreviation. Some say it's Direct Numerical
Control (the original wording) and some say Distributed
Numerical Control. All definitions include
computer to machine tool communication, or what could be termed "tape
elimination". Then they differ based on including or excluding some or all
of the following capabilities:
- Drip feeding a controller
- Accepting data from a controller
- Storing and organizing libraries of CNC programs
- Operating as a network
Originally, "DNC" defined an ambitious approach that
involved controlling multiple machine tools directly from a central
computer. This was during the "NC" days prior to CNC and was really a kind
of hybrid CNC/DNC approach. The central computer was connected directly to
machine servos. Eventually, as more and more tape elimination systems were
developed, "DNC" was adopted to describe them instead, especially since
the central computer approach was not very successful.
The short answer, which you probably don't really care
to know, is that serial communications is a bit by bit data transfer
method. In a computer, each character is made up of a group of "bits", an
abbreviation for binary digits. In most computers,
each character contains 8 bits. When communicating via a serial link, a
couple of additional bits are tacked on for various reasons. If a computer
is transferring data to a CNC controller at a speed of 9600bps (bits per
second) and each character requires 10 bits to transfer, then 960
characters per second can be sent down the wire. Seven bit character codes
are also widely used, so the "divide by 10" method is slightly pessimistic
for these. This is different from parallel communications, where each bit
in a character has its own data path and the whole character gets sent in
one shot. On PC's, printer ports use parallel methods and comm ports use
serial methods.
The long answer, which you may well need to know, is
complicated enough that we gave it it's own page - see the table of
contents.
XModems are used to transfer "X Files". (See serial
communications)
Several
methods are used. The most basic method is to simply do the necessary
geometric calculations with a calculator and write the program directly
using G-codes, M-codes, and so on. The program is then keyed directly into
the controller (usually called MDI, for Manual Data Input) or keyed into a
computer and transferred to the controller via punched tape or some other
medium.
Some controllers can be programmed using a
"conversational" method offered by the controller vendor. This may involve
a more advanced language or hitting buttons with symbols on them.
(Screaming at the control is not "conversational programming").
Specialized languages such as APT and COMPACT II have
been available since the sixties and continue to be used. These create a
controller-neutral tool path, usually called a CL File (Cutter Location or
Center Line - take your choice), which is then converted to a CNC program
acceptable to a given CNC control. A separate postprocessor is generally
used for each CNC control or control family. Actually, COMPACT II uses
different terminology but the concept is similar. APT will perform complex
geometric calculations and has provided "modern" features like tool path
associativity since its inception.
Graphically oriented
CAD/CAM systems for design and NC programming became generally available
in the late seventies. Like APT, they usually create a neutral file
usually called a CL File although their CL File format is generally far
different from traditional APT CL File formats.
Parametric programs are used for family of parts
programming and these can be written in any programming language. APT,
Fortran, BASIC, C, whatever...
< Unbounded Enthusiasm Mode >
It stands for Automatically Programmed
Tool, it's a programming language, and to some extent it's an
architecture. An Association of Computing Machinery document states that
it is the oldest programming language of any kind still in use. (It
resulted from a study done at the MIT Servomechanism Laboratory in 1952
under the sponsorship of the Air Materiel Command. A prototype ran on the
Whirlwind computer in 1955. We believe that the first commercially
available version was released by IBM in 1958 for the IBM 704 computer.)
It has been listed in most dictionaries for decades. It offered tool path
associativity, macros, transformations, pocketing, five axis tool control,
complex surface definition and machining, complex tool shapes, and many
other modern features before any CAD/CAM system (as defined today) even
existed. The shelf life of an APT program far exceeds that of any other
archival storage method. It defined an API back in the sixties. It's
still hard to beat for point to point programming and production
machining. A knowledge of APT capabilities and architecture helps
you evaluate other CNC programming methods and some basics can be found
under APT Language and
APT Architecture.
< / Unbounded Enthusiasm Mode >
APT methods did not adapt well to a graphics world and
most people consider it obsolete, but APT remains a very powerful, and in
some cases the best, tool for repetitive programming tasks.
A CL file is a CNC program in a neutral format that is
created by a CAD/CAM system, APT, or some other type of NC programming
system. It is considered neutral because it is not formatted for any
particular machine tool. There is no single standard CL file format, and
there is no single standard even for CL file contents. Two common formats
of "ASCII" CL files are shown here - each describes the same tool path. A
traditional APT CL file is discussed after the table.
PARTNO
ABIRD
CUTTER/.0$$S14
GOTO/.0,.0,5.0$$S15
RAPID
GOTO/-1.50,1.250,5.0$$S17
FEDRAT/15.0$$S18
GOTO/-1.50,1.250,-.20$$S19
GOTO/-1.251350,1.250,.0$$S20
MOVARC/CENTER,-.750,1.250,.0,AXIS,.0,.0,1.0,RADIUS,.50090$$S21
GOTO/-.256223,1.163192,.0
GOTO/-.488339,.107357,.0$$S22
MOVARC/CENTER,.0,.0,.0,AXIS,.0,.0,-1.0,RADIUS,.50$$S23
GOTO/.446479,-.225070,.0
GOTO/1.303521,1.475070,.0$$S24
MOVARC/CENTER,1.750,1.250,.0,AXIS,.0,.0,1.0,RADIUS,.50$$S25
GOTO/2.171831,.981562,.0
GOTO/.421831,-1.768438,.0$$S26
MOVARC/CENTER,.0,-1.50,.0,AXIS,.0,.0,-1.0,RADIUS,.50$$S27
GOTO/-.482340,-1.631711,.0
GOTO/-1.233209,1.118052,.0$$S28
GOTO/-1.50,1.250,-.20$$S29
RAPID
GOTO/-1.50,1.250,.30$$S31
RAPID
GOTO/.0,.0,5.0$$S33
END
FINI |
PARTNO
ABIRD
CUTTER/ .0
LOADTL/ 1.0
SPINDL/ 2000.0,CLW
COOLNT/ ON
FROM/ .0,.0,5.0
RAPID
GOTO/ -1.50,1.250,5.0
FEDRAT/ 15.0
GOTO/ -1.50,1.250,-.20
GOTO/ -1.25180,1.250,-.20
INDIRV/ .027273,.999628,.0
TLON,GOFWD/ (CIRCLE/ -.750,1.250,.0,.50090),ON,(LINE/ -.750,$
1.250,.0,-.254332,1.171790,-.20)
GOTO/ -.488339,.107357,-.20
INDIRV/ -.183921,-.982941,.0
TLON,GOFWD/ (CIRCLE/ .0,.0,.0,.50),ON,(LINE/ .0,.0,.0,.446479,$
-.225070,-.20)
GOTO/ 1.303521,1.475070,-.20
INDIRV/ .477749,.878497,.0
TLON,GOFWD/ (CIRCLE/ 1.750,1.250,.0,.50),ON,(LINE/ 1.750,1.250,$
.0,2.171831,.981562,-.20)
GOTO/ .421831,-1.768438,-.20
INDIRV/ -.562248,-.826969,.0
TLON,GOFWD/ (CIRCLE/ .0,-1.50,.0,.50),ON,(LINE/ .0,-1.50,.0,$
-.482340,-1.631711,-.20)
GOTO/ -1.233209,1.118052,-.20
GOTO/ -1.50,1.250,-.20
COOLNT/ OFF
RAPID
GOTO/ -1.50,1.250,.30
SPINDL/ OFF
RAPID
GOTO/ .0,.0,5.0
END
FINI |
A traditional APT CL file is not human readable without
translating from an internal integer and floating point format into
numbers and letters. The data itself is similar, but an APT CL file
contains more information, especially regarding circles. If the files
above are used with a machine tool that does not support circular
interpolation (that is, has no G2 or G3 command) then the postprocessor
must generate the short linear moves made to form the arcs. With an APT CL
file, this would not be necessary. For each arc, the APT CL file would
contain a type 3000 record containing the coordinates of the center
and the tool axis vector (angle), the radius, as well as the linear
moves needed to make the arc if they are needed. For each actual move
generated by a motion statement, a type 5000 record would be present
containing all points necessary to complete the motion.
For the statement reading
GOTO/ -1.50, 1.250, 5.0 in the CL files above (which would probably result in
G0X-1.5Y1.25) the type 5000 record would contain the following:
5
5000 5 bb 0 -1.5 1.25 5.0
broken down as:
5 = Record number
5000 = Record type
5 = Code for 'First or only record in
this move'
bb = Geometry name used to create
motion - blank in this case
0 = Subscript applied to name, if any
-1.5 = X
1.25 = Y
5.0 = Z
A postprocessor is a program that reads a CL file and
produces a CNC program for a specific machine tool. Some "posts" are
custom written for a specific tool/controller combination and others are
generated via systems provided by postprocessor vendors. There are also
generic posts that support, for example, 3 axis machining centers with
many specific features customized using tables.
A postprocessor should be able to produce correct output
for automatic tool changers, cycles, tool offsets, origins, circular and
other interpolation, and other features specific to a tool/controller
combination. The output from a postprocessor should be usable in the
controller without further modification.
Creating a postprocessor using specialized packages is a
fairly simple task. Writing custom posts has always been somewhat of a
black art practiced by folks with a bizarre love of terms like "tool axis
vector", "linearization", "zero-suppression", and "modality".
This is a term often used to describe a CL file that
actually consists of APT statements. Typically, they contain no geometry
definitions, but consist mainly of postprocessor commands, linear moves (
GOTO/ X,Y,Z
) and possibly some arcs. Since they're in APT format, they
can be processed by APT (creating yet another CL file) or in may cases,
directly by a postprocessor.
Dumb APT programs are created by CAD/CAM systems (and
even some APT processors), not by dumb APT programmers. They are called
"dumb" simply because they describe the tool path directly and contain no
part geometry. An APT program written by a human would almost always
describe at least some of the part geometry.
Possibly because they commonly apply to two different
aspects of CNC programming.
In a CNC program (the one with the G and M codes)
I, J, and K are used to specify the center of an arc or circle and refer
to positions on the X, Y, and Z axes - as in G2 X3.0 Y4.5 I0.5 J0.3125.
In a CL file or in APT, they are used to position the
tool axis vector - as in GOTO/X,Y,Z,I,J,K .You can think of the tool axis
vector as a tool centerline (think mill here, not lathe or punch press)
that is exactly one unit long - say, one inch. That makes it a "unit
vector". I, J, and K are used here to describe how the tool is tilted with
respect to the Z axis. I, J, and K simply define the other end of
the unit vector along X, Y, and Z. On a three axis machine, the tool
doesn't tip, so the tool centerline stays parallel with Z - therefore I,
J, and K will always be 0, 0, 1 because (using the tool tip as a
reference) you can find the other end of the vector by moving 0 in X, 0 in
Y, and 1 in Z.
If you are programming a five axis machine in a CAD/CAM
system, position the tool at X=2, Y=3, and Z=4 and tip the tool five
degrees around the Y axis you'll probably see the CL file output as
GOTO/ 2.0, 3.0, 4.0, 0.0872, 0.0,
0.9962 . Here, we moved the top of the unit vector a
bit in X and, of course the Z component got a bit smaller as a result. A
postprocessor would read this and probably output G1 X2.0 Y3.0 Z4.0 A90.0 B5.0 -
not an I, J, or K in the whole block!.
Enough already. The short answer is that you see I, J,
and K in CNC programs as circle centers and in CL files and APT programs
(and math texts) as unit vector components.
Feedrate refers to the various was of specifying the
rate at which the tool moves through the material. It's usually specified
in a CNC program via an "F-word", as in F30.0. For simple milling, the
rate is usually expressed in millimeters or inches per minute. Although
this is conceptually simple, it gets complicated if you think about it.
For a machine tool to drive the cutter from one point in space to another
at the rate you specify, each axis probably needs to move at a different
speed. In a curve, the edge of the cutter will be feeding at a different
rate than the center.
 If
you have a rotary axis on your machine, you may get to enjoy using the
exciting inverse time feedrate method. Here, you need to know what
"units per minute" feedrate you need and the distance the cutter will
traverse in the move you're working on. (This can get complicated for
rotary moves and programmers often ignore that detail - usually ok to do).
Once you have the distance, multiply it by 60 and divide it into the
desired UPM feedrate. Put that number in the F-word. Do this for each move
involving linear and rotary motion. Now you know why almost all multi-axis
(more than 3) programs are written using APT or a CAD/CAM system, and you
have an interesting question to ask your postprocessor vendor - "How
does it handle inverse time feedrates?"
APT and many CAD/CAM systems create a FEDRAT/ statement
in the CL file (e.g. FEDRAT/30.0,IPM ) which is usually translated by the
postprocessor to an F-word.
|