You are on page 1of 14

Whats New in Mastercam X posts 1

Whats New in Mastercam X posts


The following sections illustrate some of the key differences between Mastercam X post
processors and posts from Version 9 or earlier. These differences include new requirements
and standards that posts will need to meet going forward.

How your post is organized


New header line
A new header line is required to identify a post for Mastercam X. Do not delete or modify it.
[POST_VERSION] #DO NOT MOVE OR ALTER THIS LINE# V1.00 E1 P0 T1114629180
M10.00
Its components encode the following information:
V - Post update/edit version (1.00) (required)
E - Product used to edit post: 0-unknown, 1-updatepst, 2-GUI (future use)
P - Mastercam product: 0-Mill, 1-Router, 2-Lathe, 3-Wire, 4-Mill/turn (required)
T - Date Stamp [only used by UpdatePost utility - do not enter manually]
M - Mastercam version required to run the post (10.00) (required)
UpdatePost will automatically adds the header to the post when you convert an older post.

Numbered questions no longer used


Mastercam X replaces all of the numbered questions from earlier posts with settings in the
control definition. If you tell UpdatePost to create a control definition when it converts
your post, it will automatically transfer the settings from the numbered question to the
appropriate control definition setting.
Mastercam preserves the numbered questions in your converted post, but this is only for
your reference. MP will ignore them when you use the post.

New headers and organization for post text


Mastercam X introduces a new level of organization for your post text.
Post text that used to be stored in the .TXT file is now stored in the .PST file.
Each .PST file can have several different text sections, one for each control
definition that the post has been configured for.
Each .PST file can include a section of default text values that will be loaded
automatically when you create a new control definition with the post.
To take advantage of these new capabilities, Mastercam X includes a new post text header,
of the form
[CTRL_MACHINE|CONTROL FILE]

This identifies all the post text entries that are used for that control definition. Mastercam
writes a new header each time you configure the post for a new control definition, and
appends it to the .PST file followed by set of values. Within each section, Mastercam uses
the same category headers as earlier versions.
In the sample post, the text header reads
[CTRL_MILL|V9_POST]
2

The first part of the header comes from the Control type field in the Control Definition
Manager:

The second part of the header matches the name of the .control file in which the control
definition is stored:

The post text defaults are stored under a similar header with DEFAULT as the control name:
[CTRL_MILL|DEFAULT]

This lets you store a set of default text values for each control type.
When you convert a post with UpdatePost, Mastercam creates the control definition
header and copies the information from your original .TXT file to it. Your .TXT file is no
longer used and will not be copied to the destination folder. Mastercam also creates a
DEFAULT header populated with your original post text entries, so that they will be the
defaults for any new control definitions you create with the post.
To edit the post text, use the Text page in the Control Definition Manager.
Example 1: Typical post text sections created by UpdatePost
[CTRL_MILL|DEFAULT]
[misc integers]
1. "Work Coordinates [0=G50,1=HOME,2=G54's]"//2
2. "Can Cycle G101 - G103 [0=OFF, 1 and -1=ON]"
3. "Reference Return [0=G28, 1=G30]"
10. "Y axis, over center [0=OFF, 1=ON]"
[simple drill]
1. "Drill/Counterbore"
...
8. "Bld on"
9. "bLd off"
10. "Text10"
[CTRL_MILL|V9_POST]
[misc integers]
1. "Work Coordinates [0=G50,1=HOME,2=G54's]"//2
2. "Can Cycle G101 - G103 [0=OFF, 1 and -1=ON]"
3. "Reference Return [0=G28, 1=G30]"
10. "Y axis, over center [0=OFF, 1=ON]"
[simple drill]
1. "Drill/Counterbore"
7. ""
8. ""
Whats New in Mastercam X posts 3

Note: In the Work coordinates lines, the //2 at the end of the line is a default value.
See the online help for the Misc Int/Real Values page in the Control Definition Manager
to learn more.

Syntax and standards


Pre-defined variable and post block names end with $
Mastercam X posts require that all pre-defined variables and postblocks end with a $
symbol. For example, arctype becomes arctype$. UpdatePost will automatically
append it to your variable and post block names when it converts your post.
skp_lead_flgs$ : 1
#Do NOT use v9 style contour flags
get_1004$ : 1
#Find gcode 1004 with getnextop?
rpd_typ_v7$ : 0
#Use Version 7 style contour flags/processing?
strtool_v7$ : 2
#Use Version 7+ toolname?
tlchng_aft$ : 2
#Delay call to toolchange until move line
cant_tlchng$ : 1
#Ignore cantext entry on move with tlchng_aft
newglobal$ : 1
#Error checking for global variables
getnextop$ : 0
#Build the next variable table

e$ required at end of output lines


Mastercam X posts require that all output lines end with , e$. In earlier versions of
Mastercam, this was often assumed. In Mastercam X you must explicitly include it.
UpdatePost will automatically add , e$ where it thinks it is appropriate.
pcomment2 #Comment from manual entry
scomm$ = ucase (scomm$)
if gcode$ = 1007, "(", scomm$, ")"
else, "(", scomm$, ")", e$

Fewer characters allowed in variable and post block names


UpdatePost will automatically convert plus signs "+", minus signs "-", and periods "." to
underscores "_" in variable and post block names, since these characters are no longer
allowed. In Mastercam X, the only valid characters allowed in a variable or post block name
are letters and numbers:
az
AZ
09
Sometimes this will result in an error when UpdatePost cant interpret the rest of the line.
The error will be reported in the log file. Mastercam will insert a ? or ?? in the line where
the error occurred and terminate processing the rest of the line. It inserts ? if it expects a
real variable, or ?? if it expects a string.
4

The following sample shows two variables with illegal characters. UpdatePost was able to
process sg54.1, converting it to sg54_1, but was unable to process G54.1P1, so it wrote
?? and reported an error.
Original line from Version 9.1 post:
sg54.1 G54.1P1
# Work coordinate system G code #7

Output from UpdatePost:


sg54_1 ??
# Work coordinate system G code #7
#CNC<<CONVERT>>sg54.1 G54.1P1
# Work coordinate system G code #7
#CNC<<MSG-ERROR(220)>> Illegal character(s) encountered

Numeric constants
Use the := operator to initialize a variable to a fixed value. Variables initialized with := will
not be allowed to be modified during run time. Typically, this is used to create numeric
constants like pi that can be more easily referred to by their names.
The following example creates constants for inch/metric conversion factors, as well as pi
and the diameter of a rotary table:
pi := 3.141592654 # pi constant value
me := .03937 # Metric to English conversion
em := 2.54 # English to Metric conversion
rot_dia := 1243.34978674 # Rotary Table
Diameter.

pcalculate
cir = pi * dia
mcir = me * cir #Convert to English
ecir = em * mcir #Convert back to Metric

Formulas
Formulas can now be embedded in a postline with output. For example:
n$, x = 10, y=20, x, y, e$

Line Continuation
There have been many modifications to allow line continuation for formulas in postlines.
However, some restrictions still apply.

In this situation this happens.


The current line ends The line continues if, on the second line, the
with an operator, and variable is not immediately followed by = .
the next line continues For example, these two lines are a valid
with a variable. continuation:
x = 2 +
y * 4

These lines are not a valid continuation,


because y is immediately followed by =:
x = 2 +
y = 4
Whats New in Mastercam X posts 5

In this situation this happens.


The current line ends The line continues. For example:
with a variable and the X = 2
next line begins with + y * 4
an operator.
The current line ends The first line ends, and the lines are
with a variable and the processed as two separate lines. For
next line begins with a example:
variable. X = y # This line ends
Z + 2 # This line produces
# an error

Changes to functions and variables


Support for machine definitions, control definitions,
and machine groups
New commands, variables and postblocks have been added to MP to allow the post writer
to read the parameters from the machine definition, control definition, machine group.
The NCI & Post Parameter Reference describes how to use these in greater detail.

Functions
New parameters for fstrsel tables
String select tables now include two additional parameters.
The first new parameter is an integer which tells MP how many of the values in the
table are to be used. This lets you use only a portion of the values in the table if you
wish.
The second is a -1, 0, 1 code which tells MP how to handle underflow or overflow
values. Previously, these would have resulted in an error condition.
UpdatePost will automatically set the first parameter to the number of values in the table,
and the second parameter to -1.
# -----------------------------------------
# General G and M Code String select tables
# -----------------------------------------
# Motion G code selection
sg00 G0 #Rapid
sg01 G1 #Linear feed
sg02 G2 #Circular interpolation CW
sg03 G3 #Circular interpolation CCW
sg04 G4 #Dwell
sgcode #Target for string
fstrsel sg00 gcode$ sgcode 5 -1

Buffer type parameter for fbuf


The define buffer declaration has been modified to add a fifth parameter which is used to
define the buffer type. In previous versions, a buffer defined with a record size of 80 implied
a string buffer. The 5th parameter will set the buffer types as follows:
0 or missing = real buffer
1 = string buffer
If no value is supplied, 0 is assumed.
6

Table size not required for flktbl, fprmtbl


The table size is now optional and not needed. MP will calculate the table size.

Changes to user-defined question definitions (fq)


Use a double forward slash, //var//, when displaying a user-defined question to trim
white space and display only the actual variable text.
Also, you can also display # as part of the string displayed when it is enclosed in quotes
#.

New pre-defined variables


Mastercam X includes several sets of new pre-defined variables. These new variables
extend sets of variables that are already present in earlier versions of Mastercam.

Metric tolerance variables


Metric tolerance variables are used to maintain a separate set of tolerance values for metric
use. They are in addition to the current tolerance variables, which should now be used only
for inch values. Use linktolvar$ to link these new tolerance variables to the existing
tolerance variables.

Table 1: Metric tolerance variables


Name Description
met_mtol$ Metric mtol variable.
met_chord_tol$ Metric chord_tol variable.
met_vert_tol$ Metric vert_tol variable.
met_ltol$ Metric ltol variable.
met_arc_tol$ Metric arc_tol variable.
met_helix_tol$ Metric helix_tol variable.
met_minarc$ Metric minarc variable.
met_minrad$ Metric minrad variable.
met_maxrad$ Metric maxrad variable.
met_xtol$ Metric xtol variable.

Lathe canned cycle variables


Lathe canned cycle variables are in addition to the current canned cycle variables, which
should now be used only for mill/router operations. Use linklvar$ to link these new
lathe variables to the existing mill variables.

Table 2: Lathe canned cycle variables


Name Description
usecan_lathe$ When enabled (usecan_lathe$ : 1) the
settings for the following lathe drill cycles are
used.
lusecandrill$ Use lathe canned drill cycle.
lusecanpeck$ Use lathe canned peck cycle.
lusecanchip$ Use lathe canned chip break cycle.
lusecantap$ Use lathe canned tap cycle.
lusecanbore1$ Use lathe canned bore 1 cycle.
lusecanbore2$ Use lathe canned bore 2 cycle.
lusecanmisc1$ Use lathe canned misc 1 cycle.
lusecanmisc2$ Use lathe canned misc 2 cycle.
Whats New in Mastercam X posts 7

Arc variables
Mastercam X includes two sets of variables for supporting arcs. These provide support for
plane-specific values, and for dedicated variables for lathe use:
Plane-specific arc output variables are in addition to the current arc output
variables, which should now be used only for arc output in the XY plane.
Lathe arc type variables are in addition to the current arc type variables, which
should now be used only for Mill and Router operations.

Table 3: Arc type variables


Name Variable
arctypexz$ Arc center type setting for XZ plane arcs.
(arctype$ used for XY)
arctypeyz$ Arc center type setting for YZ plane arcs.
(arctype$ used for XY)
larctype$ Lathe arc center type setting for XY plane
arcs. (same settings as arctype$)
larctypexz$ Lathe arc center type setting for XZ plane
arcs. (same settings as arctype$)
larctypeyz$ Lathe arc center type setting for YZ plane
arcs. (same settings as arctype$)

Table 4: Arc output variables


Name Description
arcoutput$ Converted from user-defined to pre-defined.
0=IJK, 1=Radius, 2=Signed Radius.
arcoutputxz$ Arc output setting for XZ plane arcs.
(arcoutput$ used for XY)
arcoutputyz$ Arc output setting for YZ plane arcs.
(arcoutput$ used for XY)
larcoutput$ Lathe arcoutput setting for XY plane arcs.
(same options as arcoutput$)
larcoutputxz$ Lathe arcoutput setting for XZ plane arcs.
(same options as arcoutput$)
larcoutputyz$ Lathe arcoutput setting for YZ plane arcs.
(same options as arcoutput$)

Possible arctype values now include 5 (radius) and 6 (signed radius), which allow you to not
use arcoutput$. These are converted to arcoutput(s) for backward compatibility.
The arc output variables use the same values that are defined in mpfan.pst:
0 = I-J-K
1=Radius
2=Signed Radius
If arctype$ is 4 or less, arcoutput$ is set to zero.
Use linkplnvar$ to link these new arc variables to existing variables.

Link variables
For each expanded set of new variables, Mastercam provides a linking variable that you can
use to propagate the value of the original variable to each new variable in its set. Because
MP uses all the new variables, and these were not present in posts before Mastercam X, the
8

linking variables ensure that the new variables have correct settings and allow for
backward compatability with earlier posts. The new variables will have whatever value was
assigned to the original variables with a = statement.

Table 5: Link variables


Name Description
linklvar$ When initialized to one, links the new lathe
canned cycle variables (variables with l
prefix) to the original variables.
linkplnvar$ When initialized to one, links the new arc
plane variables (variables with xz or yz
suffix) the original variables.
linktolvar$ when initialized to one, links the new
tolerances (variables with met_ prefix))
variables to the original variables.

For example, if the assignment arctype$ = 1 is found in the post, and linkplnvar$ is
active (linkplnvar$ : 1), then the arctypexz$ and arctypeyz$ variables are also
assigned the value 1the same value that was assigned in the arctype$ = 1 assignment.

Other variables
The following variables have also been added or modified:

Table 6: Other variables


Name Description
last_tool$ Hold tool number of the last tool used in the
NCI file.
ntools$ ntools has been changed to report the
actual number of tools and not tool changes.
z_pstblock Post switch used to skip calls to Z only
postblock calls and use normal motion
postblocks.
Updating posts created before Mastercam X 9

Updating posts created before Mastercam X


Updating posts from earlier versions of Mastercam to work with Mastercam X is typically a
multi-step process, since in Mastercam X the post processor must coordinate with the
machine and control definitions:
The post processor itself needs to be converted and updated.
Machine and control definitions need to be identified or created and linked to the
post processor.
Settings which once were stored exclusively in the post processorfor example,
numbered questionsneed to be transferred to the control definition.
Fortunately, the UpdatePost utility can do most of this work automatically, as described in
the following sections.

Using the UpdatePost utility


Use the UpdatePost utility to convert posts from earlier versions of Mastercam so that they
can be used with Mastercam X. As part of this process, you can also choose to have
Mastercam automatically create a machine and/or control definition based on the original
posts settings. The converted posts will retain the name of the original post. The original
post will be saved with a backup extension.
UpdatePost runs as a C-Hook and is installed by default in your C-Hooks folder.
The following table lists the input and output files for different post types

Table 7: UpdatePost input and output files


Input files Output files
Mypost.pst, Mypost.pst, Mypost.pst_v9
Mypost.txt
Optional: UpdatePostX.log, Mypost.mmd,
Mypost.control
Mypost.pst, Mypost.psb, Mypost.pst, Mypost.pst_v9
Mypost.txt Mypost.psb, Mypost.psb_v9
Optional: UpdatePostX.log, Mypost.mmd,
Mypost.control
Mypost.psm, Mypost.psm, Mypost.psm_v9
Mypost.txt
Optional: UpdatePostX.log, Mypost.mmd,
Mypost.control

Router posts will output .rmd files instead of .mmd. Lathe posts will output
.lmd files.

Running UpdatePost

IMPORTANT: This procedure is only valid for MP-compatible posts.

1 Organize the posts that you wish to convert.

After you run UpdatePost, the Mastercam X post will retain the original file
name, and the original post will be renamed with a backup extension (for
example, Postname.pst_v9). You may wish to copy your original posts to a
temporary folder or to your Mastercam X posts folder before running
UpdatePost.
10

Make sure you include any .TXT files used by the original post.
UpdatePost can convert several posts at once, but only if they are the same
machine type (e.g. Mill, Lathe, Router, Mill/Turn). If you have many posts to
convert, you may wish to sort them by machine type.
Consider whether you will need to create a machine and/or control definition
for each post, or whether you will use the new posts with existing definitions.
UpdatePost will work with posts from Mastercam Version 4 or later, including
binary posts.
2 Start the UpdatePost utility.

From the menu, choose Settings, Run User Application, and select
UpdatePost.dll.
3 Enter your conversion settings:

Choose the version number and type of the original posts.


Specify the target directory for the converted posts.
Tell Mastercam whether you need to create a machine and/or control
definition for each converted post.
4 Click Select Post(s) to select the individual posts.

Use Shift+click and Ctrl+click to select multiple posts.


They must all be the same type and version. You can select posts from different
folders, but they will all be saved in the same target folder.
For each post, select only the .PST/.PSM file. However, all the files associated
with the post (for example, the .TXT file or .PSB file) must be in the same
directory as the .PST/.PSM file.
5 Select your log file options. Creating a log file is strongly recommended; it will list
every error generated during the conversion, plus any other instance where
Mastercam could not unambiguously figure out how to convert the original post.
6 Click OK to convert the posts and close UpdatePost, or click Apply to convert the
posts and leave UpdatePost open so you can convert more posts.
7 Review the log file (if you created one) for errors and other notes.

If UpdatePost encounters any errors, it will not stop the conversion process,
and will create a finished post. All errors will be noted in the log file and flagged
in the converted post. It is important that you review these and make the
appropriate corrections to ensure that the converted post contains no critical
errors.
If you think you will need to refer to the log later, make sure that you print it out
or save a copy to a different file. Mastercam overwrites the log each time you
run UpdatePost.

Automatically creating machine and control


definitions from posts
Users who are upgrading from earlier versions of Mastercam can use the UpdatePost utility
to automatically generate a machine and control definition from their existing post
processor. The machine and control definitions will be automatically configured to use the
converted post. When you are running the utility, simply select the Machine Definition
and/or Control Definition options in the Create Files section of the UpdatePost dialog box.
Mastercam will automatically transfer information from your current post to the new
machine and control definition. For any information that is not read from the post,
Updating posts created before Mastercam X 11

Mastercam will use system default values. Typically, most of the values read from the post
will be written to the control definition, while most of the values in the machine definition
will be default values.
The control and machine definitions will each have the same name as the post. For
example, if you convert a mill post called HAAS_VR8.PST, Mastercam will create
HAAS_VR8.CONTROL and HAAS_VR8.MMD in addition to the post file itself. The machine
definition will be automatically configured with the HAAS_VR8.CONTROL and
HAAS_VR8.PST.
Mastercam will convert all of the post numbered questions into control definition settings.
However, you will still see the numbered questions in the converted post. This is for your
information only Mastercam will ignore them and use the control definition settings.
The new machine and control definitions will be automatically saved to your
CNC_MACHINES folder.
If you wish, you can use the CD_Compare utility to examine the new control
definition and see exactly which control definition settings have been read from
the post and which are system defaults. From the Settings menu, choose Run
User Application, open the CD_Compare folder, and choose CD_Compare.

Machine definitions created by UpdatePost


When you run UpdatePost and automatically generate a machine and control definition,
virtually all of the custom information contained in your current post is written to either
the control definition or the converted post. The machine definitions created by
UpdatePost are, for the most part, copies of Mastercams generic machines that are
renamed and that load your control definition and post. These machine definitions will:
Have a standard axis layout and orientation.
Include a tool changer group with automatic tool changer.
Mills and routers will include A/B/C rotary axes with counterclockwise rotation.
Lathes will include left/right spindles and upper/lower turrets, plus steady rest
and tailstock.
Routers will include sample aggregate heads and drill blocks.
However, it is important to understand that, if your current post includes settings that are
different from the default machine components, your converted post willby designuse
your converted settings and not the default machine definition components. This is
because the primary goal of the conversion process is maintaining maximum
compatibility with your current parts and jobs so you can be up and running as quickly as
possible.
For example, if you are running an HMC, most likely your post has the switch vmc=0. When
you run UpdatePost, your new machine definition will show the X-Y-Z axes aligned for a
VMC, but your converted post will still have vmc=0, so your part will post the same way as
before.
To take full advantage of the machine definition in your post, first edit the machine
definition with the proper axis orientation and topology, and delete any unnecessary
components. Then use the pmachineinfo$ postblocks to access the machine definition
settings via parameters. (For example, axis orientation information is available to your post
as parameters 1739017396.) See Machine definition, control definition, and machine
group parameters on page 29 to learn more and see specific examples.
12

Finding and fixing conversion errors


The UpdatePost utility incorporates several features that make it easy to identify and fix
errors and areas of concern in the converted post. Because of the great variety in
techniques used to customize Mastercam posts, and because version X incorporates
several important structural changes, it is impossible for UpdatePost to predict with 100%
accuracy the intent of the post writer.
You need to be concerned about two types of situations:
UpdatePost could not reliably convert a line or object in a way that conforms to
Mastercam X standards, and recorded an error condition instead of a complete
line of code.
There were several possible Mastercam X conversion solutions, and UpdatePost
was not sure which to use. This means that the converted post will work, but might
not produce the output that you expect.
The most important tool in evaluating the conversion results is the UpdatePost log.

Mastercam writes this to the file UPDATEPOSTX.LOG in the destination directory where
you are saving the converted posts. (Each time you run the UpdatePost utility and save
posts to the same directory, the log is overwritten.)
In the log file, an error looks like this:
22 - 20 Apr 2005 01:12:59 PM - PST LINE (1200,1200) - Label has
not been defined[*30]
The LINE (x, y) block tells you the location of the error in the original and converted
post; in this case, line 1200 in each.
When you open the converted post, Mastercam displays the affected code as a block of
three lines:
The first line is the actual line of code created by UpdatePost.
The second line is the original line, commented out, and preceded by the phrase
CNC<<CONVERT>>.
The third line reproduces the error message from the log, formatted as a comment,
and preceded by the phrase CNC<<MSG ... >>.
The following code shows a typical conversion error. In this example, Mastercam knows
that the line is supposed to be an else command, but it cannot convert the other word
because it has not been properly defined:
else, #'nobrk' emulation option
#CNC<<CONVERT>> else, p_nobrk_emul #'nobrk' emulation option
#CNC<<MSG-ERROR(1200,1200)>> Label has not been defined[*30]

There is a one-to-one correspondence between messages embedded in your code and


messages in the log file. Before using a converted post, you should always review the log
and the corresponding message in the post and make any necessary corrections.
Updating posts created before Mastercam X 13

Uncertain variable type errors


Mastercam X is much more strict than earlier versions of Mastercam in enforcing the type
of a variable, whether it is a string or real variable. When UpdatePost expects a variable to
be a string but it finds a real, or vice versa, it inserts a question mark in the code following
the variable name. It inserts a single question mark ? when it expects a real variable, and a
double question mark ?? when it expects a string variable.

IMPORTANT: Because UpdatePost cannot properly process the expression which


contains the variable, these lines will not produce the output that you intend.
Review and correct each instance before running the post.

Converting setup sheets


Since a setup sheet (.set) file is basically a type of post processor, you can also use the
UpdatePost utility to convert .set files to Mastercam X format.
Start the UpdatePost utility by selecting Settings, Run User Application from the menu
and choosing UpdatePost. Then follow the same procedure as for converting posts.

Note: After clicking the Select Post(s) button, select All files (*.*) from the Files of type
list so that you can select the .set files.

Setup sheets in Mastercam X still use the .set extension, so your new setup sheet will have
exactly the same name as the old one. Mastercam will create a backup copy of your original
file with a different extension.
14

You might also like