You are on page 1of 17

MP APPLICATION GUIDES

Working with enhanced tool


tables
revision date: April 30, 2016

Contents
1. Introduction ...........................................................................................................................1

2. Implementing enhanced tool table processing in your post .............................2


A. Information that is available to ptooltable$ .............................................................4
Getting operation parameters from inside ptooltable$ .....................................9
Getting NCI data from inside ptooltable$ ............................................................9

B. Using the tt_ variables in any postblock ..................................................................9


C. Information that is available to puidlist$ ................................................................11

3. Using the t_list function ..................................................................................................12

4. Migrating an existing post to use the new tool tables .......................................15


MP Application Guide—Working with enhanced tool tables
Copyright © 2016 CNC Software, Inc.—All rights reserved
Terms of Use—Use of this document is subject to the Mastercam End User License Agreement.
A copy of the Mastercam End User License Agreement is included with the Mastercam product package.
The Mastercam End User License Agreement can also be found at: http://www.mastercam.com/en-us/Company-Info/Legal/LicenseAgreement/
rev. April 30, 2016 INTRODUCTION  1

1. Introduction Contents

Before Mastercam 2017, MP relied on an extensive set of pre-processing routines to


facilitate tool table processing. This process was characterized by the following
components:
 Initializing the tooltable$ variable to 1 or 3 enable pre-processing.
 Pre-reading the NCI file as a separate process before the normal NCI processing.
 Implementing the pwrtt$ postblock for as the starting point for your tool table
logic.
 Implementing the pwrttparam$ postblock to get operation parameters during
the pre-read process.
Beginning in Mastercam 2017, MP has access to a completely new set of routines that
allow access to tool table information while completely bypassing the traditional pre-
read process. This results in a much more efficient post and much simpler interaction
between the post and the NCI file. The new process is characterized by the following
components:
 New x_tooltable$ variable to initiate tool table processing. This is called from
within a postblock at the point where you wish to begin processing your tool
table.
 Elimination of the NCI pre-read process.
 New predefined postblock ptooltable$ as the starting point for tool table logic,
replacing pwrtt$.
 Use of opinfo function for additional operation parameters (plus fprm/
fprmtbl), replacing pwrttparam$.
 New function, t_list, gives you easy expanded access to complete tool list
information (including probes) at any time.
 New set of predefined variables, beginning with tt_. These are populated by the
new tool table routines so that you can keep those values separate from NCI
variables. For example, tt_gcode$ is populated by the tool table routines, while
gcode$ is populated by the NCI processing.
This guide is divided into the following sections:
 Implementing enhanced tool table processing in your post . . . . . . . . . . . page 2
 Using the t_list function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . page 12
 Migrating an existing post to use the new tool tables . . . . . . . . . . . . . . . page 15

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.

Working with enhanced tool tables


rev. April 30, 2016 IMPLEMENTING ENHANCED TOOL TABLE PROCESSING IN YOUR POST  2

2. Implementingenhancedtooltable Contents

processing in your post

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.

IMPORTANT: If you choose to use x_tooltable$, tooltable$ should not be used


anywhere in your post.

x_tooltable$ has two main applications:

 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$.

Table 1: x_tooltable$ processing modes


Value Processing routine
–2 Call puidlist$ for each 20601 entry (axis combination)
–1 Call puidlist$ for each 20600 entry (component)
0 Call ptooltable$ for current operation only (defined by current op_id$ value).
(This is the default value.)
1 Call ptooltable$ for each operation in the operation list.
2 Call ptooltable$ for each operation in the operation list whose type matches
posttype$ value.

Follow this general outline:


 Set x_tooltable$ to the desired mode by initializing it to a value from Table 1.
 Implement puidlist$ or ptooltable$ as appropriate for your intended
application.
 At the point in your post where you want processing to begin, place
x_tooltable$ on a line by itself as a command. This can be in any postblock,
but pheader$ is a common location for a typical tool table.
You can either initialize x_tooltable$ to a value in the header area of your post, or
assign a value to it inside a postblock before it is called.

Working with enhanced tool tables


rev. April 30, 2016 IMPLEMENTING ENHANCED TOOL TABLE PROCESSING IN YOUR POST  3

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

Working with enhanced tool tables


rev. April 30, 2016 IMPLEMENTING ENHANCED TOOL TABLE PROCESSING IN YOUR POST  4

tldia$ = rparsngl (sparameter$, 2)


# Output tool table line
"(", *tt_tool$, sdelimiter, pstrtool, sdelimiter, *tt_tlngno$
if tt_drlcycle$ = –1, # No stock with drill Contents
[
if comp_type > 0 & comp_type < 4,
[
sdelimiter, tt_offset$, sdelimiter, *scomp_type,
sdelimiter, *tldia$
]
if xy_stock <> 0 | z_stock <> 0,
[
sdelimiter, *xy_stock, sdelimiter, *z_stock
]
]
")", e$
]

A. Information that is available to ptooltable$


To support the enhanced tool table processing routines, a new class of data objects has
been created. Legacy tool table processing (in other words, tooltable processing triggered
by the tooltable$ variable) relied on NCI variables that were populated during the NCI
pre-read. Since the enhanced tool table routines do not use the NCI pre-read, the
traditional NCI variables are not available, so new data objects have been created that
can be used instead.
The enhanced tool table processing has access to a set of 106 data objects, as listed in
Table 2 on page 5. While some of these are still only for internal use, most of them have
been exposed to the post writer through new predefined variables whose names begin
with tt_. Most of these correspond to traditional NCI variables; the difference is that the
tt_ variables are set from the new tool table routines, while the traditional variables are
set from reading the NCI data.
Having the two sets of values in different sets of variables means that you do not need to
worry about the tool table data overwriting the NCI data, and vice versa. Any of the
variables in Table 2 can be used freely in the ptooltable$ postblock.
If you do need access to one of the new data objects for which a predefined variable has
not been created—for example, one of the misc ints or reals—you can use the opinfo
function to get it. Use a statement of the following form
var = opinfo(n, 0)
where var is the name of a numeric variable to store the value, and n is the number from
the table below. For example, to get the value of misc integer 4, use a statement like this:
my_mi4 = opinfo(33, 0)
See the Working with tool and operation parameters application guide to learn more.
Table 2 lists all of the 106 possible settings. Not all of them are useful. They have been
exposed to the post writer as a group, but some of them are only relevant to MP’s internal
processing, as noted below.

Working with enhanced tool tables


rev. April 30, 2016 IMPLEMENTING ENHANCED TOOL TABLE PROCESSING IN YOUR POST  5

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

Value for Variable name


Description
opinfo queries (if any)

1 Operation ID tt_op_id$

2 Xform operation ID tt_xform_op_id$

3 (internal use only)

4 (internal use only)

5 Stream ID tt_stream$

6 Post type tt_posttype$

7 Toolpath operation code tt_tool_op$

8 Axis combo tt_axiscombo$

9 (internal use only)

10 (internal use only)

11 (internal use only)

12 pointer to tool plane view matrix (1014 data); can be


useful with opmatrix function.

13 pointer to WCS view matrix (1027 data); can be useful


with opmatrix function.

14 Coordinate of max motion extent (X)

15 Coordinate of max motion extent (Y)

16 Coordinate of max motion extent (Z)

17 Coordinate of min motion extent (X)

18 Coordinate of min motion extent (Y)

19 Coordinate of min motion extent (Z)

20 Value of misc real 1

21 Value of misc real 2

22 Value of misc real 3

23 Value of misc real 4

24 Value of misc real 5

25 Value of misc real 6

26 Value of misc real 7

Working with enhanced tool tables


rev. April 30, 2016 IMPLEMENTING ENHANCED TOOL TABLE PROCESSING IN YOUR POST  6

Table 2: Variables for use with enhanced tool table processing

Value for Variable name


Description
opinfo queries (if any)
Contents
27 Value of misc real 8

28 Value of misc real 9

29 Value of misc real 10

30 Value of misc int 1

31 Value of misc int 2

32 Value of misc int 3

33 Value of misc int 4

34 Value of misc int 5

35 Value of misc int 6

36 Value of misc int 7

37 Value of misc int 8

38 Value of misc int 9

39 Value of misc int 10

40 Current cutting plane tt_plane$

41 (internal use only)

42 Cutter compensation code tt_cc_pos$

43 Program number tt_progno$

44 Gcode for previous tool change prv_tt_gcode$

45 (internal use only)

46 (internal use only)

47 Tool number tt_tool$

48 Tool station number tt_tool_station$

49 Offset tt_offset$

50 Length offset tt_tlngno$

51 Indicates whether this tool is the first tool, last tool, or tt_state$
neither.

52 If the tool is used multiple times, indicates which tt_count$


instance is this operation.

53 Work offset tt_workoffs$

54 Spindle direction tt_spndl_dir$

Working with enhanced tool tables


rev. April 30, 2016 IMPLEMENTING ENHANCED TOOL TABLE PROCESSING IN YOUR POST  7

Table 2: Variables for use with enhanced tool table processing

Value for Variable name


Description
opinfo queries (if any)
Contents
55 Is CSS active? tt_css_actv$

56 Type of rotary conversion tt_rot_conv$

57 Axis of rotation tt_rot_axis$

58 Rotary axis substitution direction tt_axis_subs_dir$

59 Rotary axis vector (X coordinate)

60 Rotary axis vector (Y coordinate)

61 Rotary axis vector (Z coordinate)

62 Diameter for axis substitution tt_axis_subs_dia$

63 Transform subprogram flag

64 Drill cycle tt_drlcycle$

65 (internal use only)

66 (internal use only)

67 Planes collection ttplane$

68 The type of rotary selection made in the Rotary Axis tt_rotary_type$


dialog box.

69 Rotary axis orientation in terms of the current tool plane tt_rotary_axis$

70 Speed tt_speed$

71 Home position (X coordinate)

72 Home position (Y coordinate)

73 Home position (Z coordinate)

74 (internal use only)

75 (internal use only)

76 (internal use only)

77 (internal use only)

78 (internal use only)

79 (internal use only)

80 Lathe canned cycle type

81 Flag to indicate if this is a finish profile

82 Coordinate of cycle start (X)

Working with enhanced tool tables


rev. April 30, 2016 IMPLEMENTING ENHANCED TOOL TABLE PROCESSING IN YOUR POST  8

Table 2: Variables for use with enhanced tool table processing

Value for Variable name


Description
opinfo queries (if any)
Contents
83 Coordinate of cycle start (Y)

84 Coordinate of cycle start (Z)

85 Coordinate of cycle end (X)

86 Coordinate of cycle end (Y)

87 Coordinate of cycle end (Z)

88 Cycle direction vector (X)

89 Cycle direction vector (Y)

90 Cycle direction vector (Z)

91 Force toolchange flag

92 Validated tool change Gcode tt_gcode$

93 Probe active flag

94 Probe NCI flag

95 Feed rate tt_fr_pos$

96 Is IPR active? tt_ipr_actv$

97 The sequence number of this operation within the overall


sequence of operations. This is defined as operations that
have an NCI 1000/1001/1002 line.

98 The sequence number of this operation within the overall


sequence of operations as determined by list of NCI 999
lines. This is broader than setting 97, since some
operations (such as probing) have an NCI 999 line but not
a 1000/1001/1002 line.

99 The number of this operation within the set of operations


that have the same operation ID.

100 The total number of operations that have the same


operation ID as this operation.

101 Flag indicating if this operation has a tool change

102 Does this op use rotary axis substitution? tt_axis_subs$

103 Spindle number tt_spindle_no$

104 Turret number tt_lturret$

105 Nesting operation ID tt_nesting_op_id$

106 (internal use only)

Working with enhanced tool tables


rev. April 30, 2016 IMPLEMENTING ENHANCED TOOL TABLE PROCESSING IN YOUR POST  9

Getting operation parameters from inside ptooltable$


In addition to the data objects in Table 2, the ptooltable$ postblock can access
operation parameters. Use either of these techniques:
Contents
 Define parameter tables, then populate them with fprm statements in
ptooltable$.
 Use the opinfo function to query them directly. Using the opinfo function also
lets you get parameters for previous/next operations.
 Similar to opinfo, use the mdinfo, cdinfo, or groupinfo functions to get
parameters from the machine definition, control definition, or machine group.
See Implementing enhanced tool table processing on page 3 for a example of this.
See the Working with tool and operation parameters application guide for complete
information about using these functions.

Getting NCI data from inside ptooltable$


If the data that you need for your tool table is not available as one of the data objects in
Table 2, you can use the opinfo function to directly access tool change NCI lines. The
opinfo function will typically return an entire line of NCI parameters as a single string
which would need to be parsed with rparsngl to extract the desired value. For example:
ptooltable$ # Tooltable output
# Tool diameter from 1013 string
tldia$ = rparsngl (opinfo(1013, 0), 2)

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.

B. Using the tt_ variables in any postblock


Technically, the tt_ variables can be used in any other postblock in your post, not just
ptooltable$— even though, for most practical purposes, the traditional NCI variables
are the more appropriate choice. It is important to understand that the values of the tt_
variables will not be automatically set by MP outside of the ptooltable$ postblock.
However, MP gives you several techniques for populating their values outside of the
ptooltable$ postblock and ensuring that they have meaningful values relative to the
operation that MP is currently processing.
The most important tool for doing this is the opchng function. This function is
introduced in Mastercam 2017. Use it to update the tt_ enhanced tool table variables
anywhere in your post outside of the ptooltable$ postblock. You can use the opchng
function to update the tt_ variables to any operation in the operation list, not just the
current one.
Importantly, the opchng function will also update the previous values of the tt_
variables ( prv_tt_ ) to the tt_ values for the previous operation. So if you use opchng
function more than once, please understand that the prv_tt_ values will behave
differently than you might expect.

Working with enhanced tool tables


rev. April 30, 2016 IMPLEMENTING ENHANCED TOOL TABLE PROCESSING IN YOUR POST  10

The general form of the function is


return = opchng( n )
where
Contents
return is a numeric variable to store the success/fail code.

 –2 = no values could be obtained.


 –1 = the prv_tt_ values could not be obtained.
 0 = the tt_ values could not be obtained.
 1 = both sets of values were obtained successfully.
n indicates the operation for which you want to populate the tt_ variables. Use 0 to
specify the current operation; any other value (positive or negative) is interpreted as
an offset from this. For example, a value of 2 would look ahead two operations,
while –1 would indicate the previous operation.
When opchng updates the prv_tt_ variables, these will automatically be relative to
whatever operation you select. For example, if you use opchng( 3 ) to get values
for three operations ahead, the prv_tt_ variables will be set to the values for two
operations ahead.
As an alternative to opchng, if you are using the opinfo function to access the enhanced
tool table data, you can update the tt_ values at the same time with opinfo. Use the
optional third argument in the opinfo function to do this. Set the 100s digit to 1 to
populate the tt_ variables. For example:
next_misc_int = opinfo(33, 1, 100)
In this example, opinfo will update all of the enhanced tool table data to values from the
next operation in the list, and then capture parameter 33 (the value of misc integer 4)
from that operation.

Working with enhanced tool tables


rev. April 30, 2016 IMPLEMENTING ENHANCED TOOL TABLE PROCESSING IN YOUR POST  11

C. Information that is available to puidlist$


The puidlist$ postblock is used to cycle through the 20600 NCI entries for individual Contents
components (x_tooltable$ = –1) or the the 20601 NCI entries for axis combinations
(x_tooltable$ = –2). As a convenience, the following variables are automatically
populated from each 20600/20601 entry as puidlist$ is being executed:

Table 3: Information available to puidlist$


Variable/string …is set to: Position on the 20600/20601 line
prmcode$ the numeric entity ID of the component or Param #1
axis combination
sparameter$ the string ID of the component or axis Param #1
combination
suser_label$ the name of the component or axis 20600: param #5
combination 20601: param #4

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.

Working with enhanced tool tables


rev. April 30, 2016 USING THE T_LIST FUNCTION  12

3. Using the t_list function Contents

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.

Working with enhanced tool tables


rev. April 30, 2016 USING THE T_LIST FUNCTION  13

Table 4: t_list function states


Function How ‘index’ is used: How ‘index’ is used: Contents
Return value
state when function is called when function returns
0 The tool number of the first tool Start position for search. The value of index will be set
or probe. to the postion of the tool or
probe.
1 The tool number of the first Start position for search. The value of index will be set
standard tool (in other words, to the postion of the tool.
not a probe).
2 The number of the first probe. Start position for search. The value of index will be set
to the postion of the probe.
3 The tool number of the next tool The next tool or probe after The value of index will be set
or probe. the index value. to the postion of the tool or
probe.
4 The tool number of the next The next tool after the index The value of index will be set
standard tool (in other words, value. to the postion of the tool.
not a probe).
5 The number of the next probe. The next probe after the index The value of index will be set
value. to the postion of the probe.
6 The number of the tool or probe The next tool change after the The value of index will be set
referenced in the next change. index value. to the postion of the tool or
probe.
7 The number of the tool The next tool change after the The value of index will be set
referenced in the next standard index value. to the postion of the tool.
(non-probe) tool change.
8 The number of the next probe. The next tool change after the The value of index will be set
index value. to the postion of the probe.
9 The tool number of the last tool Start position for search. The value of index will be set
or probe in the tool list. to the postion of the tool or
probe.
10 The tool number of the last Start position for search. The value of index will be set
standard tool (in other words, to the postion of the tool.
not a probe).
11 The number of the last probe. Start position for search. The value of index will be set
to the postion of the probe.
12 The total number of tools and Not used. Unchanged.
probes in the tool list.
13 The total number of standard Not used. Unchanged.
(non-probe) tools in the tool list.
14 The total number probes in the Not used. Unchanged.
tool list.
15 The index position in the tool list Not used. Unchanged.
of the tool used in the operation
that is currently being
processed from the NCI file.
16 The status code (see Table 5) The index position to query. If Unchanged.
of the tool at the referenced not present, MP will query the
index position. current tool.

Working with enhanced tool tables


rev. April 30, 2016 USING THE T_LIST FUNCTION  14

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.

Working with enhanced tool tables


rev. April 30, 2016 MIGRATING AN EXISTING POST TO USE THE NEW TOOL TABLES  15

4. Migrating an existing post to use Contents

the new tool tables

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.

a. Set x_tooltable$ to the desired processing mode.


b. Place it on a line by itself inside a postblock to initiate tool table processing.
x_tooltable$ = 1 # Select normal tool table mode
x_tooltable$ # Begin processing

3. Find the pwrtt$ postblock and migrate the logic to ptooltable$.

 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$.

6. Search for the pwrttparam$ postblock.

 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!

Working with enhanced tool tables

You might also like