| Issue 76 |
Summer 2008 |
Copyright 2008, CNC Concepts, Inc. |
|
|
|
June 23, 2008
Dear Subscribers,
Welcome to issue 76 of The Optional Stop
newsletter. We appreciate your continued support.
It’s hard to believe I’ve been publishing
this newsletter for nearly twenty years. Over the years, we’ve
received countless suggestions and comments that have made this
newsletter better. And again, we appreciate your interest.
So don't hesitate to let us know your thoughts and ideas!
In this issue, we’ve included a custom macro
for face milling on a CNC machining center. It actually serves
two purposes. First, it’s a great little macro – and should be
helpful to anyone that performs face milling operations. But
second, it should make a good way of testing the custom macro
features of our
NCPlot
software product.
Enjoy!
Mike Lynch
|
|
|
|
Product Corner:
NCPlot helps custom macro B users
NCPlot has been the topic of previous Product Corner
articles. We’ve explained that NCPlot is a tool path
plotter that you can use NCPlot to verify G-code level
CNC programs. But it’s such a great tool path plotter –
easy to use, effective, and flexible – we haven’t said
much about some of its other important features. Some of
the more neglected features are related to custom macro
B users – so if you use custom macro B on a regular
basis, read on – you’ll surely find some points of
interest in this edition of Product Corner.
Our first point is that NCPlot allows the tool path
plotting of programs that contain custom macro B
commands. Very few tool path plotters can plot custom
macro B programs – and none we know of are available at
the price of NCPlot. Just about anything the
custom-macro-B-equipped CNC machine will execute can be
executed in NCPlot. (About the only exception has to do
with certain system variables that provide internal
control manipulation – like the offset setting and
input/output signal system variables.) This means you
can use NCPlot to verify custom macro B programs in the
same way you can use it to verify normal G code programs
– and in turn – eliminate the machine downtime normally
needed for custom macro verification.
If you’re incorporating custom macro commands in the
main program, as is commonly the case with part family
applications, simply load the program into the NCPlot
editor and execute it. It will display all motions –
including those affected by your input variable
arguments.
If you’re developing separate custom macros and
activating them with a G65 (or G66) command, as is
commonly the case with a user created canned cycle
applications, you load all programs into the NCPlot
editor, with the main program first. When you activate
the tool path plotter, NCPlot will start at the first
command in the editor (the main program’s first command)
and work through the program in the normal manner until
an M30 or M02 (end of main program) is seen – at which
point it will stop.
In both cases – and as is the case when plotting normal
G code programs without custom macro commands, NCPlot
will show the destination point for each motion in all
axes. This is especially helpful for spotting mistakes,
as would be the case when a calculated position is
incorrect.
Like the CNC control, when a G65 or M98 (custom macro or
subprogram calling command) is executed, NCPlot will
jump to the beginning of the subprogram or custom macro
and execute through the M99. It will then return to the
main program and to the command after the calling M98 or
G65.
You can, of course, modify the values of any input
variables (in the G65 command or at the beginning of the
part family program) to confirm that the custom macro
will work for all conditions of the call statement. When
you find a mistake, you can use the single step function
to step through the program just as you would on the CNC
control with single block.
Speaking of mistakes, NCPlot provides much more help for
diagnosing problems than your CNC control does. With the
“Show Variables” feature activated (found in the “Calc”
menu), you’ll be able to see the current state of all
variables in a dynamic fashion. This means you’ll be
able to single step through the program – one command at
a time, including calculation and logic commands – and
see the changing values of each variable as you execute
the program.
On the “Show Variables” page, you’ll also see the custom
macro source command as well as the CNC command that it
renders. For example, the source command may look
something like:
The CNC command it renders may be:
NCPlot also provides an “Expression Calculator” (again,
under the “Calc” menu) to help you develop and verify
your custom macro calculation commands. You’ll be able
to see and confirm the results of calculation commands
before you place them into your custom macro programs.
One last important custom-macro-related feature we’ll
mention is “Macro Translator”. This valuable feature
gives you the ability to convert custom macro B programs
into normal G-code programs. This means you can take a
saved custom macro program (or main program that calls
custom macros) – with all input variables set the way
you want them – and have NCPlot create another program
(and save it) that contains only hard-and-fixed CNC
commands (no custom macro commands). You can, of course,
then use NCPlot to verify the motions in the created G
code program. In essence, this is like having a
self-created computer aided manufacturing (CAM) system
that creates G code programs from your custom macros.
You may be questioning why this is such an important
feature – and when it could be helpful. Admittedly, at
first glance this may not seem like a very important
feature. While not everyone will have need of this
feature, there are at least two times when this feature
is priceless.
The first has to do with machines that don’t have custom
macro B. You probably have a collection of very helpful
custom macros – maybe even some that do things not
possible (or easy to do) with your CAM system. Examples
might include thread milling, taper tread milling,
grooving, and pocketing. But if one or more of your CNC
machines does not have custom macro B, of course, these
custom macros can’t run in them.
With NCPlot, you can still use your custom macros even
with machines that don’t have custom macro B. Simply
call up the program in NCPlot’s editor, and use “Macro
Converter” to convert it to a standard G code program
that can be run on machines that don’t have Custom Macro
B.
While this does eliminate the on-the-fly ability to
quickly modify programs at the machine, for applications
for which you have no other feasible way to create the G
code, “Macro Translator” can be a life-saver.
A second time “Macro Translator” can be invaluable is
related to custom macros that are weighed down with
calculation and logic commands. You know that any time
you make the control think, it takes time. The control
doesn’t actually think, of course, but what it does
during the execution of calculation and logic commands
does resemble thinking.
Consider a taper thread milling custom macro that
requires the control to calculate each point through
which the thread milling cutter will move on its path to
form the spiral motion needed for taper thread milling.
With the resolution set to one degree, 360 motions will
be necessary. If resolution is set to 0.1 of a degree,
3,600 motions will be necessary. If set to 0.01, 36,000
motions will be necessary. And so on.
Even with current model CNC controls, at some point the
machine will get bogged down, not being able to keep up
with the required motions at the desired feedrate. This
will caused increased cycle time and possibly inadequate
surface finish on the threads – and may keep you from
using custom macro B for this kind of application.
With “Macro Translator”, you can have NCPlot convert
your taper thread milling custom macro (or any
calculation- and logic-heavy custom macro) to normal G
code containing only simple G01 commands to form the
tiny motions around the tapered thread. There will be no
thinking for the control to do and it will execute the
motions without dwells or delays – and of course – at
the desired feedrate.
If you consistently use custom macro B, you may find
that the custom macro B features of NCPlot alone justify
its purchase price of only $299.00. When combined with
everything else it can do, NCPlot is an outstanding
value!
By the way, we provide a face milling custom macro in
the Macro Maven article of
this issue of The Optional Stop. It makes a great way
for you to test the custom macro features of NCPlot.
Simply
download the trial version of NCPlot from our
website and then copy and paste the main and custom
macro programs from this newsletter into the editor of
NCPlot.

Top of page
|
|
Instructor Note:
Explaining the importance of knowing your machine
I’ve often said
that machinists make the best CNC programmers. A
machinist already knows what they want the machine to do
– it’s a relatively simple matter for a machinist to
learn how to tell the machine what they want it to do.
It can be
frustrating for instructors to teach people that have
limited – or no – basic machining practice experience to
setup and run CNC machine tools – let alone to teach
them how to write programs. I equate this to trying to
learn how to fly an airplane without a basic
understanding of aerodynamics and flight. Just as the
aspiring pilot must understand how an airplane flies, so
must an aspiring CNC person know what a CNC machine is
designed to do.
I like to begin by
explaining that there are some CNC machines that have
been designed to replace existing equipment. These tend
to be the easiest machines to learn because it’s
possible that the student has a working knowledge of (if
not hands-on experience with) the conventional machine
being replaced. The newcomer can draw on this previous
knowledge when learning the CNC machine.
Two great
examples are CNC machining centers and CNC turning
centers. Machining centers, of course, have been
designed to replace drill presses and milling machines.
Turning centers have been designed to replace all kinds
of manual lathes, including engine lathes, turret
lathes, and screw machines.
Since most people have at least seen a drill press – if
not the opportunity to work with one – it is pretty easy
to introduce students to CNC machining centers.
Explain that
like drill presses, CNC machining centers have the
ability to perform all kinds of hole machining
operations. I’ll test the waters at this point in an
attempt to learn how much students know. I’ll ask what
kinds of hole machining operations must be performed on
workpieces.
Almost everyone
– including novices – will first name drilling. Almost
everyone has drilled a hole or has seen it done. So I’ll
explain that one very common operation performed on CNC
machining centers is drilling. I may mention the kinds
of drills available (twist drills, spade drills,
inserted drills, etc.).
I’ll push to
find out if they know what other kinds of hole machining
operations can be performed and why they are required.
At the completion of this discussion, I’ll be sure to
have mentioned reaming (to improve hole finish and size
after drilling), boring (to straighten holes and
improved finish and size after drilling), tapping (to
machine threads in holes), and counter-boring (to open
up a current hole to a larger diameter to a specified
depth).
I’ll also see
whether any students can name other operations that can
be performed on the kinds of machines that a CNC
machining center is replacing. Someone may know about
milling operations – and this will open the discussion.
We’ll cover the reasons why milling operations are
required as well as what kinds of milling operations can
be performed (slot milling, pocket milling, face
milling, etc.).
We’ll then do
the same for turning operations performed on CNC turning
centers, as well as a variety of CNC machine types (like
CNC turret presses, press brakes, plasma cutters,
water-jet machines, and vertical E.D.M machines). The
point of this, of course, is to stress that entry level
people must know their CNC machines are designed to do.
It’s likely that you’re only trying to cover one type of
machine in your class, so you must eventually narrow the
focus to address processes performed on your machine in
detail.
Before ending
this discussion, I do like to point out that there are
certain types of CNC machines that have been designed to
perform new and unique processes. These ground-breaking
machines are doing things not previously possible before
the advent of CNC, and include CNC wire E.D.M. machines,
laser cutting machines, coil winding machines, and
soldering machines. These machines tend to be more
difficult to learn because there is no conventional type
of machine being replaced – and no chance that the
student has previous experience. Not only must the
student learn the CNC-related functions of the machine,
they must additionally learn the processes that the
machine has been designed to perform.

Top of page
|
|
Manager's Insight:
Do your people understand the implications of on-line
(internal) and off-line (external) tasks?
What may be
obvious to one person may not seem so to another. This
is why – as a manager – you must understand and be
willing to teach good machine usage practices to setup
people and operators.
When it comes
to setup, an on-line (internal) task is one that adds to
the amount of time a machine is down between production
runs. Indeed, setup time is the sum-total of all on-line
tasks. Examples of tasks that are commonly performed on
line include mounting workholding devices and loading
cutting tools into the machine.
In similar
fashion, on-line (internal) production running tasks
include any tasks that add to the length of time it
takes to complete a production run. And again,
production run time is the sum-total of on-line tasks.
While these two
statements are at the heart of any setup or cycle time
reduction program, I’m not going to dive too deep into
setup and cycle time reduction principles. Instead, I
simply want to relate some pretty obvious tasks that
setup people and operators commonly perform on line that
could easily be performed off line. While they may seem
obvious, I’m often surprised as I walk the shop floor in
many companies. If you carefully watch your people, you
may be too.
In one shop I
visited, for example, I was watching an operator run a
vertical machining center. When the cycle ended, he
removed the workpiece from the vise. Then he cleaned it
off with a rag, picked up the deburring tool and began
deburring. About three minutes later, he put it into the
completed workpiece bin. Only then did he go back to the
machine and clean the vise. He then picked up the next
workpiece to be machined from the raw material basket.
But before loading it into the machine, he cleaned it
and de-burred it with a file. Finally, he clamped it in
the machine vise, closed the door, and started the next
cycle.
What’s
(obviously) wrong with this picture? Everything just
described was done while the machine was down. They were
all on-line tasks. Yet four of these tasks (cleaning the
completed workpiece, deburring the completed workpiece,
cleaning the next workpiece, and deburring the next
workpiece) could have been done off-line – while the
machine is in cycle. This assumes, of course that the
cycle time for the job is longer than the time it takes
to perform all the related tasks, which in this
particular case, it was.
As you walk
your own shop floor, do you ever see setup people and
operators performing tasks on line that could be done
off line? Unless your company has been involved in setup
and/or cycle time reduction programs, I’ll bet you do.
A setup time
example includes gathering components for the next setup
during a lengthy production run. If the setup person
waits until the current production run is completed to
begin gathering, all of the gathering time will be on
line. If gathering is done for future setups while the
machine is still in production, setup time will be
reduced by the time it takes to do the gathering.
Whenever you
move a task from on line to off line, of course, you
reduce the time it takes to complete the setup or
production run. While this may sound like a very basic
statement, I’m always amazed by how often I see tasks
that could be done off line being done on line. In many
cases, just a little explaining from the management side
can have a big impact on productivity.

Top of page
|
|
G Code Primer:
When are plane selection commands required?
There are three
basic plane selection commands:
-
G17 – XY
plane selection
-
G18 – XZ
plane selection
-
G19 – YZ
plane selection
When you first
power up a Fanuc-controlled CNC machining center, G17 is
automatically selected, meaning the machine will be in
XY plane selection mode unless you select a different
plane by commanding G18 or G19.
There are
several CNC functions that are affected by your plane
selection choice. But frankly speaking, almost
everything commonly done on a machining center requires
the selection of the XY plane, so there aren’t many
times when you’re required to switch planes. But let’s
discuss a few of the times when plane selection is
necessary.
Circular interpolation
As you know,
G02 and G03 are used to specify clockwise and
counter-clockwise circular motions. When milling in the
XY plane, as is commonly required, it is the X and Y
axes that are moving during the circular motion. And by
the way, we evaluate the direction (cw or ccw) by
looking at the motion from the plus side of the
uninvolved (Z) axis.
Again, most
circular motions require the X and Y axes to be moving
to form the motion. But consider placing an end mill in
a right angle head, maybe one that points the tool in
the X minus direction (tool facing to the left on a
vertical machining center). In this case, a circular
motion will require a YZ motion and prior to making such
a motion, the YZ plane (G18) must be selected. If the
right angle head points the tool along the Y axis, the
tool will be machining in the XZ plane, and G19 must be
commanded prior to this motion.
Another time
plane selection must be considered with circular motions
is when using a ball end mill. It’s possible that a
circular motion with a ball end mill will be in the XZ
or YZ plane, and the appropriate plane selection G code
must be commanded prior or within the circular motion
command.
Canned cycles
Most
holes are machined in the Z axis with CNC machining
centers. That is, the hole centerline coordinates are
specified with positions along the X and Y axes. But
again, consider placing a hole machining tool (drill,
tap, reamer, etc.) in a right angle head that is
pointing the tool in the X minus direction. This tool
will have the ability to machine holes along the X axis
– and believe it or not – using the appropriate plane
selection command (G18 for YZ plane selection in this
case) will allow you to use canned cycles (G81, G82,
G83, etc.) to machine the holes. This dramatically
simplifies the task of programming.
When this is
done, the canned cycle-related letter addresses will
change in meaning. If YZ plane selection is chosen
(drilling along X), The hole center will be specified
with Y and Z. The rapid plane will still be specified
with R. But the hole bottom position will be specified
with X.
What about odd
angles?
With G17, G18,
and G19, the planes are, of course, ninety degrees
apart, which is why these commands can be helpful with
right angle heads on standard three-axis machining
centers. But these commands won’t help with other planes
– those that are not at right angles with the three axes
of the machining center (X, Y, or Z).
There are,
however, machines that have the ability to machine in
any plane. Five axis machining centers can machine in
planes other than just XY, XZ, and YZ. For this reason,
most five axis machining centers come with a special
feature called user-defined plane selection. With this
feature, the programmer can define any plane – and still
use circular interpolation, canned cycles, and other
coordinate manipulation features (like rotation and
mirror image) in any defined plane.

Top of page
|
|
Macro Maven: A
face milling custom macro
Suggested by Glenn J. Doutrich Sr.
of Inside Development Systems, Inc.
I’ve had several
requests recently for this custom macro – so, here it
is! This custom macro performs a face milling operation
and allows the percentage of overlap to be specified. It
provides for two methods of milling, climb milling
(assuming a right hand cutter is used) and zig-zag
milling in both directions.
The letter address M
specifies which type of milling will be done. Leaving M
out of the G65 command – or setting it to M1.0 will
cause the machine to climb mill. Setting M to M2.0
will cause the machine to zig-zag mill back and forth
until the milling is complete. This custom macro assumes
the X length of the workpiece is longer than the Y
length. That is, it makes passes along the X axis only.
The illustration
shows the variable meanings:

Here is an example
calling program followed by the custom macro.
-
O0001 (EXAMPLE
MAIN PROGRAM)
-
N005 T01 M06 (4"
FACE MILL)
-
N010 G54 G90 S500
M03
-
N015 G00 X0 Y0
-
N020 G43 H01 Z2.0
-
N025 G65 P1000 X0
Y0 Z0 C0.15 M2.0 U40.0 V33.0 D4.0 Q20.0 F15.0
-
N030 G91 G28 Z0
M19
-
N035 M30
Line N025 calls the
face milling custom macro. X and Y specify the lower
left corner. Z specifies the surface to be milled. C
specifies the amount of clearance for the cutter
(approach and escape distance). U and W specify the
length and width of the part to be milled. D specifies
the cutter diameter. Q specifies the overlap percentage
(percentage of cutter diameter for overlap). F specifies
the feedrate.
-
O1000 (FACE
MILLING CUSTOM MACRO)
-
-
#120 =
#7*[[100-#17]*.01] (effective cutter size)
-
#121 =
[2*[#7-#120]] + #22 (TOTAL STOCK INCLUDING OVERLAP)
-
#100 = 1 (CURRENT
PASS [COUNTER])
-
#101 =
FUP[#121/#120] (NUMBER OF PASSES)
-
#102 =
#25+#22+[#7-#120]-#7/2 (CURRENT Y)
-
#103 = [#121-#7]
/ [#101-1] (Y STEP AMOUNT)
-
#104 = #102-#103
(TESTER FOR "ZAG MOTION)
-
-
IF[#13 EQ
2.0]GOTO 20 (TEST IF ZIG-ZAG)
-
-
(CLIMB MILLING)
-
N1 IF[#100 GT
#101] GOTO 99
-
G00
X[#24-#3-#7/2] Y#102
-
Z#26
-
G01
X[#24+#21+#3+#7/2] F#9
-
G00 Z[#26+1.0]
-
#100 = #100 +1
(STEP COUNTER)
-
#102 = #102 -#103
(STEP CURRENT Y POSITION)
-
GOTO 1 (GO BACK
TO TEST)
-
-
(ZIG-ZAG MILLING)
-
N20 IF[#100 GT
#101] GOTO 99
-
G90 G00
X[#24-#3-#7/2] Y#102
-
Z#26
-
G01
X[#24+#21+#3+#7/2] F#9
-
IF[[#25-[#7-#120]+#7/2]-0.02 GT #104] GOTO 25 (TEST
IF ZAG PASS IS NEEDED)
-
G00 G91 Y-#103
-
G90 G01
X[#24-#3-#7/2]
-
N25 #100 = #100 +
2 (STEP COUNTER)
-
#102 = #102
-#103*2 (STEP CURRENT Y POSITION)
-
#104 = #102-#103
(TESTER FOR "ZAG" MOTION)
-
GOTO 20 (GO BACK
TO TEST)
-
-
N99 G00
Z[#26+1.0]
-
M99

Top of page
|
|
Parameter
Preference: Two Parameters related to measurement
systems
As you probably
know, current model CNC machines can be used with two
measurement systems – the Imperial (inch) measurement
system and the Metric (millimeters) measurement system.
A parameter setting controls which measurement system is
automatically selected at the machine’s power-up,
meaning you can have the machine default to your
measurement system of choice.
The parameter
that controls the current (and initialized) measurement
system can be found on the setting page and can be
modified without activating the parameter write enable
(pwe) function. You need only be in the manual data
input (MDI) mode to change this setting.
There could be
a second, little known, parameter that is related to
your measurement system choice. It determines what
happens when you switch measurement systems. This
parameter controls whether a true conversion of all data
will take place (this is the desired setting) or whether
the decimal point for all values will simply shift one
place. If available, you’ll find documentation about
this parameter in the measurement system selection
section of your Fanuc Operators manual.
Again, the
desired setting causes a true conversion of all numeric
data, including position displays, tool offsets, and
fixture offsets. On the position display page, for
example, say a value of 10.0000 inches is currently
shown for the X axis. When you switch to the Metric mode
(by setting parameter or by commanding a G21), the X
position display should be updated to 254.000 mm. If
instead, it shows a value of 100.000 millimeters, the
decimal point is simply being shifted one place to the
right.
The true
conversion is especially important if you’ll be running
jobs in both measurement systems. When you go from job
to job, it is likely that at least some of the tooling
from the previous job will be used in the next job –
after the measurement system change. Having the control
convert all values between the measurement systems is
important. It will keep the setup person from having to
re-measure tools used in the previous job.
Top of page
|
|
Safety First: When
not to use a dwell command!
As you know, G04 is used to specify a
dwell – or pause – in your CNC program’s execution. With
Fanuc controls, the format for the dwell command can
vary based upon what character you choose to specify the
period for the dwell. The commands
-
G04 X0.5
-
G04 U0.5
-
G04 P500
all specify a half second dwell
(assuming dwell is specified in time and not the number
of spindle revolutions).
While the dwell command is necessary
when you wish to relieve tool pressure – as would be the
case just after plunging an end mill into a surface and
before starting to mill a pocket in XY – there are
certain times when you should not use a dwell command.
The first time has to do with
programming around machine problems. I’ve seen, for
example, programmers that include a dwell command in
their programs to allow time for the coolant system to
kick in. Maybe there’s a bad check-valve in the coolant
system – and the programmer wants to allow time for the
coolant to be flowing at its maximum before allowing the
machining operation to start. While this may be a
reasonable temporary fix, the better long term solution
is to fix the machine. In my opinion, this is an
inappropriate use of the dwell command.
While it may be inappropriate, at
least it isn’t dangerous. And there are times when I’ve
seen some pretty dangerous applications for the dwell
command. In one instance, for example, the programmer
was trying to provide time for the operator to polish
the workpiece during the CNC cycle. To this end, they
included a twenty-second dwell in the program right
after the finish turning operation. During this dwell,
the operator was supposed to open the door and perform
the manual polishing operation.
The obvious (and dangerous) problem
with this technique, of course, is that if the operator
didn’t finish the polishing during the twenty seconds,
the machine would continue anyway, indexing the turret
and bringing the next tool into position for the next
machining operation. And of course this would be very
dangerous for the operator.
Never use a dwell command to allow
time for the operator to do something during the CNC
cycle. Always consider the worst that could happen if
they don’t finish what it is you intend them to do
during the dwell. If it is at all dangerous, don’t use
the dwell technique.

Top of page
|
|
|
|
|
|
The Optional Stop newsletter
is published quarterly by CNC Concepts, Inc. and is distributed
free of charge to people subscribing to our (email) distribution
list and to those downloading it from our website (www.cncci.com).
Information is aimed at CNC users and instructors teaching live
CNC classes. All techniques given in this newsletter are
intended to help CNC people. However, CNC Concepts, Inc. can
accept no responsibility for the use or misuse of the techniques
given.
To subscribe:
Simply email us (newsletter@cncci.com) and let us know
you'd like to be added to our distribution list.
To
unsubscribe: Respond to this email, typing REMOVE in
the subject. Please accept our apologies if we have
disturbed you.
|
|
|
|