Professional Documents
Culture Documents
Contents
1. Introduction ...........................................................................................................................1
1. Introduction Contents
NOTE: The enhanced tool table routines are designed to complement the new
parameter access routines, as described in the Working with tool and operation
parameters application guide. However, they are separate concepts and either can
be used independently of the other.
2. Implementingenhancedtooltable Contents
The new tool table routines are triggered by the x_tooltable$ variable and command
word. Use x_tooltable$ instead of the tooltable$ variable that has been traditionally
used in Mastercam posts.
When it is set to –1 or –2, it will trigger calls to the puidlist$ postblock. This
postblock will be executed for each 20600 line (–1)or 20601 line (–2) in the NCI.
You can use this to build lists of all the component IDs or axis combo IDs.
When it is set to 0 or higher, it will trigger calls to the ptooltable$ postblock.
This postblock is run for each toolpath operation—in other words, each
operation that creates an 1000/1001/1002 line in the NCI file.
You are free to combine both uses in the same post so that you process both puidlist$
and ptooltable$; all you need to do is assign a new value to x_tooltable$, and then
call it again.
The table below details each mode for x_tooltable$.
Typically x_tooltable$ will be set to 1 for normal tool table processing; however note
the following values for special applications:
value 0—call ptooltable$ for single operation only.
value 2—filter mill/lathe operations for use in mill/turn posts. Contents
You can call x_tooltable$ from anywhere in your post to initiate tool table processing
and execute the ptooltable$ postblock. Note that if you do this from a postblock after
MP has begun processing the NCI file, there is no impact at all on the NCI processing:
MP’s internal “pointer” will remain exactly where it was when you called x_tooltable$,
since the new tool table routines do not rely on reading the NCI file.
Note also that even though you can call x_tooltable$ before the NCI file is read, if you
want to output tool table records to your NC file, you still must wait until the NC file has
been opened. For example, you cannot write tool table output from pprep$. For most
tool table applications, pheader$ is the most practical choice.
Example
Implementing enhanced tool table processing
The following code shows how the new tool table routines might be implemented in
a typical Mill post. The tool table routines are called directly from pheader$,
immediately after it has output several header lines to the NC file.
Notice that the ptooltable$ postblock uses the new tt_ variables, instead of the
normal NCI variables (see next section). The normal NCI variables have not been set
(since the NCI has not yet been processed), so the tt_ variables are used.
This example also references the tldia$ value, which is a traditional NCI variable.
Since the NCI has not yet been read, the post gets the 1013 line from a parameter
table. The next section discusses this in more detail.
fprmtbl 101 5 # Operation - tool table
1013 sparameter$
10010 xy_stock
10068 z_stock
15346 comp_type
20001 strtool$
pheader$ # Call before start of file
"%", e$
"(DATE=DD-MM-YY - ", date$, ")", e$
"(MCX FILE - ", *smcpath$, *smcname$, *smcext$, ")", e$
"(NC FILE - ", *spathnc$, *snamenc$, *sextnc$, ")", e$
"(MATERIAL - ", *stck_matl$, ")", e$
x_tooltable$ = 1 # Process all operations in order
x_tooltable$ # Call the tooltable
ptooltable$ # Tooltable output
if tool_info > 1 & tt_count$ = 1,
[
# Copy prefix string
s_t_pre_tt = s_t_pre$, s_d_pre_tt = s_d_pre$,
s_h_pre_tt = s_h_pre$
# Get the data from parameter lookup
result = fprm (101, 0, 0)
# Tool diameter from 1013 string
Many of the tt_ variables listed below have enumerated lists of values; in most cases
(with a couple of exceptions), these will be the same as the regular MP variable. All the
values can be found in the MP reference documentation; they are not duplicated here.
Table 2: Variables for use with enhanced tool table processing Contents
1 Operation ID tt_op_id$
5 Stream ID tt_stream$
49 Offset tt_offset$
51 Indicates whether this tool is the first tool, last tool, or tt_state$
neither.
70 Speed tt_speed$
Recall that you can use opinfo in this way to access NCI lines numbered 950 and higher,
including the NCI 20000+ lines that are encapsulated in the tool change NCI block.
See the Working with tool and operation parameters application guide for complete
information and more examples.
Recall that parameters 3 & 4 on the 20600 line are the absolute and incremental axis
labels for the component. If you need these strings inside the puidlist$ postblock, you
can get them easily with the uidinfo function:
puidlist$
s_abs_label = uidinfo(1, prmcode$)
s_inc_label = uidinfo(2, prmcode$)
See the Working with tool and operation parameters application guide for complete
information about the uidinfo function. Note also that suser_label$ is a new string
introduced in Mastercam 2017.
Beginning with Mastercam 2017, MP includes new routines that make it easier for you to
access information about the tools used in your part program. This includes a redesigned
tool list. The new tool list includes the following features:
It includes probes in addition to standard tools.
It is built and maintained outside of the NCI pre-read processes that have
traditionally been the source of tool information, so you can access it anywhere
in your post independently of which operation is currently being processed.
A new function, called t_list( ), has been introduced which lets you access the tool
list. You can use t_list( ) to query regular tools, probes, or both, whichever is
appropriate for your application.
MP builds the new tool list automatically when you initiate posting. Because it is
independent of the NCI pre-read process, you don’t need to rely on the pwrtt$ postblock
to access it. This makes the t_list( ) function an ideal complement to the new tool
table techniques described in the earlier sections of this document.
The general form of the function is:
return = t_list(mode, status, index)
where:
return = a numeric variable to store the return value. For most of the function
modes this is the number of a specific tool or probe, but see Table 4 for a complete
list.
mode = the function state (0–16) that tells MP exactly what you are searching for.
These are described in Table 4 below.
status = a coded value that provides additional context about the value that is
returned. This is a “license plate” value where each digit describes a specific
property. These are described in Table 5 below.
index = the position within the tool list of the selected tool or probe. This gets used
in two ways:
When you call t_list( ), in most function modes this will determine where
in the tool list to begin searching.
When t_list( ) returns, this will be set to the position of the tool or probe
that has been found.
For all function modes, index is optional. Its value is set just prior to the
ptlchng1002$ postblock call. If you do not include index, the search will begin by
default with the operation that is currently being processed by the NCI. If you are
calling the t_list( ) function before the NCI has begun processing (for example,
in pheader$), MP will simply start at the beginning of the tool list.
The following table describes the status codes that are set by the t_list( )
function. Note that values 0 through –3 are not “license plate” values, but are
ordinary integers; you can implement simple logic in your post to test for these
error states before trying to evaluate the other values.
Contents
Table 5: codes for “status” digits
Value of “status” What it means
–3 Error scanning the tool list; the beginning of the list was overrun.
–2 Error scanning the tool list; the end of the list was overrun.
–1 Error scanning the tool list; no tool/probe was found.
0 A tool or probe number was returned successfully, but no other information.
nnnnn1 The returned tool number was the first in the list.
nnnnn2 The returned tool number was the first of its type (standard tool or probe) in
the list.
nnnn1n Only non-probing tool changes were scanned.
nnnn2n Tool changes including probing were scanned.
nnn1nn The tool change for the returned tool number was the last in the list.
nnn2nn The tool change for the returned tool number was the last of its type (standard
tool or probe) in the list.
nn1nnn The returned tool number was the last in the list.
nn2nnn The returned tool number was the last of its type (standard tool or probe) in the
list.
1nnnnn The returned tool number is a probe.
Follow this general outline for converting an existing post to the new tool table routines.
1. In the section of your post where you initialize your variables, find and remove
the line that initializes tooltable$.
2. Find the location in your post where you wish to begin writing the tool table.
Much of the processing logic inside pwrtt$ will most likely still be applicable
to ptooltable$.
In many of the standard posts from CNC Software, pwrtt$ calls a user-
defined postblock named ptooltable. Typically, the logic inside the user-
defined ptooltable can simply be moved to ptooltable$, or you can
rename ptooltable to another user-defined postblock name.
4. Inside the pwrtt$ postblock—and all postblocks that it calls—find all references
to NCI variables and replace them with either:
References to the new tt_ variables from Table 2 on page 5.
Calls to opinfo to get the data from the proper NCI lines.
5. Remove pwrtt$.
Rewrite the parameter calls to use the opinfo function (or mdinfo/cdinfo/
groupinfo, as appropriate).
Typically you can just move the logic to ptooltable$. Or, you can rename
pwrttparam$ as a user-defined postblock, and call it from ptooltable$.
7. Remove pwrttparam$.
8. Find any instances in the post where tooltable$ is used as a command word.
Typically, these can simply be changed to x_tooltable$. Otherwise, they
should be removed—no references to tooltable$ should be in the post.
As a best practice, always explicitly set x_tooltable$ to the desired mode
before calling it.
9. Test your post thoroughly!
IMPORTANT: Always make a backup copy of your post before making edits!