Professional Documents
Culture Documents
Fast turnaround in production is the most significant benefit of family of parts macros.
More time is often needed to develop macro than a standard program.
When to program parametrically
Large number of parts that are same shape but different in dimensions
Large number of parts that are similar in shape
Parts that repeat fairly frequently
Parts that contain repetitive tool path
Various machining patterns
Parametric program is never a replacement for other methods- it only enhances them.
There could be a significant investment in time spent on parametric macro program
development. The resulting benefits are must be tangible and measurable, in order to be
economically efficient.
Example:
To stress what can be done with parametric programming, we show a simple example written in
custom macro B for a machining center application. It will machine a mill a hole of any size at
any location. Notice how similar this program is to a program written in BASIC.
Program
O0001 (Program number)
#100=1.0 (Diameter of end mill)
#101=3.0 (X position of hole)
#102=1.5 (Y position of hole)
#103=.5 (Depth of counter bored hole)
#104=400 (Speed in RPM)
#105=3.5 (Feed rate in IPM)
#106=3.0 (Tool length offset number)
#107=2.0 (Diameter of counter bored hole)
G90 G54 S#104 M03 (Select abs mode, coordinate system, start spindle)
G00 X#101 Y#102 (Rapid to hole center)
G43 H#106 Z.1 (Instate tool length compensation, rapid to approach Z position)
G01 Z-#103 F [#105 / 2]
Y [#102 + #107 / 2 - #100 / 2] F#105
G02 J-[#107 / 2 - #100 / 2]
G01 Y#102
G00 Z.1
M30
There are 3 types of variables - Local, Common and System variables.
Local variables are "local" to the program that is currently executing. They can be set and read
only in that program. As soon as control is passed to another program, such as when a
subprogram is called, that program has its own set of local variables which can be set, read, etc.
When control passes back to the original program, its set of local variables is restored. For
instance, if you set variable #1 to 100 in the main program, then call a subprogram, var #1 is now
empty. You can set and use var #1 in the sub without overwriting the value of #1 in the main.
When you return to the main program, var #1 retains its original value of 100. This is useful
because you can use local variables at will within subprograms without having to keep track of
the local variables you are using in other programs for fear of overwriting them. If you watch the
macro variable screen as programs execute, you can see the local variable sets change as control
is passed from one program to another. You can pass a value to a local variable when calling a
subprogram with the G65 command.
Common variables are "common" to all programs. Set the variable in one program and all of the
other programs see the same value. They are retained even after program execution stops. They
can be set within a program or by the operator on the macro variable screen. You can even create
screen labels for some of them to make it easier for operators to set values. One of the things that
we use them for is when we have a choice of profiles on a part. The operator can set variable
500, which may have a screen label of "PROFILE#", to the desired profile number and then the
program uses this to select the correct tool, spindle, cutter comp and height offset.
System variables are special variables that represent values in various registers of the control.
For instance, when you call H14, you are referring to offset register 14. The value of offset
register 14 can be read or set by accessing system variable #2014. Some system variables are
read only and cannot be set. There are system variables for reading the absolute X, Y, or Z
position of the machine (read only). We sometimes use this set of variables to read the machine
position if we need to come back to that exact same point after a series of calculated moves
which may have introduced rounding errors when executed.
All of this should be in your operator manual. If you don't have one, get one! The book is not
always clear in its descriptions, so write a lot of little test programs until it is clear just how
things work. Always start out simple and work up to the complicated stuff.
The present invention relates to the field of robotically-automated
production lines. More specifically, the present invention relates to
providing flexibility to a robotically-automated production line through
parametric programming techniques.
Over the past thirty years, machine automation has become an important
aspect of every product's assembly or manufacturing line. Computer
numerical control (CNC) machines are one type of common automated
machinery. CNC machines can be directed by a computer program to perform
any task that an operator could make a conventional machine perform,
including welding, drilling, laser cutting, and bending. For example, a
drill press operator who needs to drill three holes in a metal sheet no
longer has to bring the press toward the sheet. Instead, the operator
simply places the sheet on the drill press and a computer program commands
the press to drill holes in the correct locations.
Until recently, CNC machines required individual programs for each specific
task. For example, two distinct programs were needed in order to command a
drill press to drill four holes in the middle of one metal sheet and four
holes along the perimeter of another metal sheet. Therefore, an operator
was required to place the first metal sheet in the press, load the first
program, remove the first metal sheet, place the second metal sheet in the
press, and load the second program. Thus, while CNC automated a machine's
individual functionality, it did not automate multiple independent tasks.
As a result, programmers consistently had to edit one CNC program to make
another, no matter how closely related the tasks.
Parametric programming has been developed to overcome the need for discrete
programs for each independent task that a machine performs. Parametric
programming is a technique that allows a CNC programmer to vary the
parameters of the task within one program, instead of writing an entirely
new program each time the parameters are varied. In other words,
parametric programming allows programs to be written using
variable-designated parameters instead of fixed numbers. These variables
can be changed each time the program is called. For example, if a
parametric program is stored in a machine's memory to drill a bolt hole,
the program can be used with any corresponding data file to drill any size
hole in any location. Parametric programming also includes structures for
conditional and unconditional program branching, repetitive looping and
mathematical equations. There are several parametric programming languages
including CUSTOM MACRO B™, USER TASK™, Q ROUTINE™ and ADVANCED
PROGRAMMING LANGUAGE™. As a result, a programmer simply may develop one
program for a certain machine, for example a drill press. The parametric
program queues the operator to put in data sets for each individual task
that the drill press must perform. The operator then tells the machine
when to begin each task, instead of loading a new program each time.
Therefore, programming efforts are reduced significantly.
The present invention provides a system and method for creating products of
varying characteristics on an automated production line. The system
includes one or more production line devices, for example robots and
machines. Each robot and machine is operated by a parametric computer
program that may be stored locally with the production line devices. The
system also comprises one or more data source(s) coupled to the production
line devices. The data source provides characteristics of a desired
product to the production line devices. The data source may be a local
terminal or a remote terminal connected to the production line via the
Internet, for example. In one embodiment, the system further comprises a
computer coupled to the production line devices and to the data sources.
The computer may route the inputted characteristics to each of the
production line devices in a logical order. The computer also may convert
the characteristics into a formatted file readable by the parametric
computer program, for example a machine data file (MDF).
FIGS. 5A and 5B are an exemplary MDF for use with the present invention for
the manufacture of an electrical transformer tank.
Cell control computer 101 is coupled to terminal server 103, laser cutter
106, and master programmable logic controller (PLC) 105. Cell control
computer 101 may be connected to master PLC 105 and terminal server 103
using LAN technology, for example an Ethernet system operating on TCP/IP
protocol. Terminal server 103 is coupled to robot A 106, robot B 107, and
robot C 111. Master PLC 105 is coupled to the devices in cell one 112,
cell two 113, and cell three 114. Cell one 112 houses laser cutter 106 and
robot A 107. Cell two houses embossing machine 108 and robot B 109. Cell
three houses robot C 111 and stud welder 110. Although not shown, it
should be appreciated that manufacture of the electrical transformer tank
may include additional cells housing additional robots and machines. In
this application the term "robot" refers a material moving device, and
"machine" refers to a device that operates on and manipulates a workpiece.
The terminology is consistent with that which is used in the art.
FIG. 4A provides a sample table indicating the machines and tools needed to
perform a desired task. Each part number has a corresponding list of
machines and tools necessary to create the desired part (i.e., feature). A
tool is a subcomponent of a machine on the manufacturing line. As shown in
FIG. 4A, machine M04 and tool T03 may be used to create part number
2A16023F01, which corresponds to the two oil fill holes specified by data
source 102. Stated differently, part number 2A16124F01 may require the use
of a plasma cutting head tool (e.g., T03) located in laser cutting machine
106 in order to create an oil fill hole. This process is repeated for each
individual characteristic until a list of the necessary machines and tools
is created as shown, for example, in FIG. 4A. Once the machines and their
tools have been selected, a MDF may be created.
Referring back to FIG. 2, in step 203, cell control computer 101 parses the
MDF into discrete file packets and transfers the packets to master PLC
105, terminal server 103 and laser cutter 106. Each file packet
corresponds to a particular robot and machine. Unlike the other robots and
machines, cell control computer 101 is coupled directly to laser cutter
106. This is due to the added complexity of laser cutter 106 and
consequent volume of information that must be processed by laser cutter
106. In addition, because of the complexity of laser cutter 106, it may
include a computer (not shown) that processes the MDF routed by cell
control computer 106. The connection between laser cutter 104 and cell
control computer 101 may be an RS-422 serial connection, for example.
In step 204, cell control computer 101 sends the parsed MDF for robots A
107, B 109, and C 111 to terminal server 103. Terminal server 103 then
sequences the parsed MDF for the operation of robot A 107, robot B 109,
and robot C 111 in accordance with the manufacturing line's process. In
step 205, cell control computer 101 sends the parsed MDF for machines 106,
108 and 110 to master PLC 105. Master PLC 105 then sequences the parsed
MDF for each of machines 106, 108 and 110 in accordance with the
manufacturing line's process. For example, as shown FIG. 4B, hole cutting
machine M04 and tool T03 will be operated before bending machine M05 and
tool T243. In step 206, robots A 107, B 109, and C 111 receive relevant
MDF from terminal server 103 in a logical sequence. In step 207, machines
106, 108 and 110 receive the relevant MDF from master PLC 105 in a logical
sequence. Each of the machines and the robots receive the MDF into their
resident parametric programs.
In step 208, a computer internal to robots 107, 109, and 111 converts the
parametric program with the inputted MDF into a format readable by the
individual robots, for example CNC programming instructions. In step 209,
a computer internal to machines 106, 108 and 110 convert the parametric
program with the inputted MDF into a format readable by the individual
machines, for example CNC programming instructions. The robots and the
machines participate in the manufacturing, as commanded by the CNC
programming instructions and to output the final product in step 210.
Because the resident parametric program is a shell that integrates the
entire functionality of the robots and machines, the parametric program is
written for each production line device just once. The inputted MDF is the
mechanism that instructs the production line devices to perform
differently depending on the particular characteristics of the desired
product.
While the present invention has been particularly shown and described with
reference to the presently preferred embodiments thereof, it will be
understood by those skilled in the art that the invention is not limited
to the embodiments specifically disclosed herein. Those skilled in the art
will appreciate that various changes and adaptations of the present
invention may be made in the form and details of these embodiments without
departing from the true spirit and scope of the invention as defined by
the following claims.
A custom macro for tool change format. (CNC Tech Talk).
Even if you program with a computer aided manufacturing (CAM) system, you must consider
how difficult it is for operators to run your programs. The techniques we show will simplify
programming (especially for manual programmers), ensure consistency for tool changing
commands, make your programs more fail-safe and make it easier for setup people and operators
to rerun tools.
First, consider a typical series of commands that are needed when you make a tool change on a
vertical machining center. Of course, the specific commands for your particular machine(s) will
vary. Similar commands will be required for turning centers (or any multi-tool CNC machine
tool).
N065 G91 G28 Z0 M19 (return to tool change position, orient spindle)
N075 G90 G54 S500 M03 T03 (Select absolute mode, fixture offset, start spindle and select next
tool)
N085 G43 H02 Z0.1 (Instate tool length compensation, rapid to first Z position)
Note that the structure of these commands will remain the same for every tool change you make.
Only the values of the numbers in bold italics will change from tool change to tool change.
Again, these commands are redundant and tedious to write. It's easy for manual programmers to
forget key words or commands. Consider this custom macro call statement that can be used to
invoke a special tool change custom macro.
N060 G65 P1000 T02 S500 X1.5 Y2.0 Z0.1 (Make tool change)
When the custom macro (O1000) is executed, it will cause the machine to do everything done in
the previous series of tool change commands. In our call statement, T represents the tool to be
placed in the spindle. Our macro will assume that the tool to be used after this one follows in
sequence (tool three in this case). If it does not, a W word (for waiting station) can be included in
this command to specify which tool is coming up next in the program. We've left W out, so we're
letting the custom macro assume that the next tool will be station three. S specifies the spindle
speed, and X, Y and Z specify the tool's first approach position.
#23 = #20 +1 (Set next waiting station tool to next number in sequence)
G90 G54 S#19 M03 T#23 (Select absolute mode, fixture offset, start spindle and select next tool)
G43 H#20 Z#26 (Instate tool length compensation, rapid to first Z position)
We've taken the set of tool change commands and replaced those hard-and-fixed values that
change from tool change to tool change with local variables (T is represented by #20, W by #23,
S by #19, X by #24, Y by #25 and Z by #26). We have also set a default value for W (#23) if it's
left out of the call statement. Look at the first two commands of the custom macro. If W is left
out of the call statement (as it is in our example), the result of the IF statement will be false (W is
vacant), and the next command (the default setting command) will be executed. #23 will be set to
a value of whatever T (#20) is plus 1. If W is included in the call statement, #23 will have a value
(#23 will not be vacant), the IF statement will be true and the default setting command will be
skipped.
Though our example custom macro doesn't show it, you could also include words and commands
in the tool change format custom macro to make your programs more fail-safe. For example, you
could include G80 and G40 in line N1 (when the coolant is turned off) to ensure that canned
cycles and cutter radius compensation have been canceled. Most manual programmers will not
do this, because they assume they've programmed correctly. Right after the tool change
command (M06), you could include some safety commands to confirm that certain modes are
still in their initialized states. Consider these commands.
G17 G20 G40 (Set XY plane, inch mode, cancel cutter radius compensation)
G64 G69 G50.1 (Set normal cutting mode, cancel rotation, cancel mirror image)
G80 G94 (Cancel canned cycle, select feed per minute mode)
Again, these commands can be placed in the custom macro right after the tool change and will
ensure that the machine is in appropriate states. This is most important for the first tool the first
time the program is run.
What about rerunning tools? One important task that CNC setup people and operators must
perform on a regular basis is rerun tools. Our tool change format custom macro still allows
rerunning tools. Actually, it will simplify the task. The restart block for rerunning tools is simply
the call statement (G65 command) for each tool change. Everything required for restarting tools,
including a movement to the appropriate tool change position, is included in the custom macro.
Also, if your setup people and operators are currently restarting tools by scanning to the T word,
they have to scan twice (assuming you have a machine with a double arm tool changer). The first
time they scan, they find the command in which the tool is being placed in the waiting station.
The second time, they find where it is actually being placed in the spindle. With the tool change
custom macro, only one scan is required.
(SUBprogram)
N100 (THIS LINE HERE IS USES AS A MARKER)
#105=0 (INIT)
N101 X[COS[#105]*#100+#103] Y[SIN[#105]*#100+#104] (REMEMBER YOUR G81
CODE IS MODAL)
#105=#105+[360/#101]
IF [#105 LT 360] GOTO 101 (IF #105 < 360 -> NEXT ROUND)
GOTO #102
3. Thread Milling
(3/4-16 thread milling)
G0 X0 Y0 (rapid to location)
Z.1
G01 Z-1.020 F50.0
(your finish location will vary depending on conditions always start with a
smaller cut until you establish exact finish location)
G91 G01 X.1275 F3.0 (incremental move to finish location speeds and feeds
will vary with materials being cut)
G03 Z.0625 I-.1275 F4.0 (incremental 3 axis move creates right hand thread
to establish Z movement divide 1 by thread pitch)
( 1 divided by 16 = .0625)
G90 G01 X0 F20.0 (absolute move back to start location)
G01 Z-1.020 (absolute move down to starting Z location)
G91 G01 X.1275 F6.0 (incremental move to finish location)
G03 Z.0625 I-.1275 F6.0 (incremental 3 axis move)
G03 Z.0625 I-.1275 F10.0 (optional free pass to remove any burrs)
G90 G01 X0 F20.0 (absolute move back to start location)
G0 Z3.0
M2
The canonical documentation for O-words is in the emc2 documentation: [1]. As clarifications
and documentation improvements made on this page are incorporated in the official
documentation, they should be removed from this page.
2. Notes
• Each of these control blocks begins with an Onnnnn word. That makes easier
for the parser to know what it is doing and isn't a problem for the user. I have
to admit, though, that writing "call sub Onnnnn" seems more natural than
writing "Onnnnn call sub".
• Note that each block must start and end with the same Onnnnn word. So if
you start with o100 the block ends at the next o100
• Subroutine declarations may NOT be nested.
• Subroutines may be called anywhere (but must be declared before they are
called. They may be called from other subroutines, and may be called
recursively if it makes sense.
• while and if may be nested. They may not overlap without nesting.
• When the interpreter scans a sub block, it remembers the location of the next
line in the file and associates it with the "O" number. It continues scanning,
skipping lines until it sees the matching Onnnnn endsub.
• When the interpreter scans a callsub, it pushes (saves) the current location in
the input file (on a stack). It then goes to the location in the file associated
with the Onnnnn and starts interpretation there.
• When the interpreter scans a return, it pops the stack and continues
interpretation where it left off. When it interprets an endsub, it treats it like a
return.
• When the interpreter scans a while, it remembers the location of the Onnnnn.
If the expression is true (values close to zero are treated as zero), it continues
execution. If the expression was not true, it skips execution of all of the
blocks until it finds the matching Onnnnn.
• When the interpreter scans an endwhile, it restarts interpretation at the
location of the remembered Onnnnn. (Assumng it wasn't skipping. If it was
skipping, it ignores the endwhile).
• if is treated exactly as while.
• The matching endif is ignored if the interpreter was skipping. Interpretation is
turned back on (skipping is ended).
3. Sample Programs
These sample programs are offered without any warranty as to their suitability for
any task whatsoever! Use these or model your program after these at your own risk.
#14 = 360
#11 = 1
g0 x[#1+#3] y#2
g0 z#6
o1001 while [#11 LE #5]
#10 = [#14 * #11 / #5]
#12 = [#1 + [#3 * cos[#10]]]
#13 = [#2 + [#4 * sin[#10]]]
g1 x#12 y#13
#11 = [#11 + 1]
o1001 endwhile
g0 z#7
o1000 endsub
(call it like this)
f10
o1000 call [0] [0] [1] [2] [200] [-1] [2]
m2
#12=#6
#13=#7
o200 do
#14=[#12 mod #13]
#12=#13
#13=#14
o200 while [#13 NE 0]
(#12 is now the gcd)
3.4. Sample 4, a subroutine for helical hole milling using radius comp
o100 sub
(helical hole milling, load tool and set feed first, then use like so:)
(o100 call [x pos] [y pos] [safety height] [hole depth] [hole dia] [tool
dia])
(tool dia doesn't have to be specified exactly.)
#7=[#6/2] (#7 is depth per circle = half of tool diameter)
#8=#7 (#8 is current depth step)
g0 z#3
(start above and right so we make a convex corner for entry to the ccw arcs)
g0 x[#1 + [#7 * 2]] y[#2 + [#5 / 2]]
g41 g0 x#1 y[#2 + [#5 / 2]]
o101 while [#8 LT #4]
(down toward the specified depth a bit at a time)
g3 x#1 y[#2 + [#5 / 2]] i0 j[0 - [#5 / 2]] z[0 - #8]
#8=[#8 + #7]
o101 endwhile
(down to the actual depth)
g3 x#1 y[#2 + [#5 / 2]] i0 j[0 - [#5 / 2]] z[0 - #4]
(full circle at the actual depth)
g3 x#1 y[#2 + [#5 / 2]] i0 j[0 - [#5 / 2]]
(nice quarter-circle helical exit move)
g3 x[#1 - [#5 / 2]] y#2 i0 j[0 - [#5 / 2]] z#3
g40
o100 endsub