Professional Documents
Culture Documents
This chapter describes new post writing techniques appropriate for use with modern posts, and also
lists changes made to recent releases.
Starting in Mastercam Version 8, all tool change NCI blocks must repeat the rapid position after the
tool change NCI Gcode 1000, 1001 and 1002 line. This resolves a problem with earlier NCI forms for
drill cycle and lathe threading toolpaths where no rapid appeared after the tool change NCI Gcode
1000, 1001 and 1002. These formerly were handled as special cases in the post customization file,
with the rapids being generated from within the postblocks called by the drill cycle or lathe threading
toolpath.
The table that follows lists the recall status of each valid motion postblock.
pmx no pedm
pmx1 no pedm1 no
pmx2 no pedm2 no
prapid no pedm3 no
pzrapid no prapid no
plin no pzrapid no
plin1 no plin no
plin2 no plin1 no
pz no plin2 no
pz1 no plin3 no
pcir no pz no
pcir1 no pz1 no
pcir2 no pcir no
mrapid no pcir1 no
mlin no pcir2 no
mcir no pcir3 no
lrapid no pcan1 yes
llin no pcan2 yes
lcir no pcan3 yes
pg32 yes pcan4 yes
pg76 yes pcan5 yes
pg92 yes pcan6 yes
pthrg32_1 yes pcan7 yes
pthrg32_2 yes pcan8 yes
pthrg32_3 yes
pthrg32_4 yes
pthrg92_1 yes
pthrg92_2 yes
pthrg92_3 yes
pthrg92_4 yes
pthdface yes
pdrill3 yes
pdrill5 yes
pdrill yes
ppeck yes
pchpbrk yes
ptap yes
pbore1 yes
pbore2 yes
pmisc1 yes
pmisc2 yes
mdrill yes
mpeck yes
mchpbrk yes
mtap yes
mbore1 yes
mbore2 yes
mmisc1 yes
mmisc2 yes
ldrill yes
lpeck yes
lchpbrk yes
ltap yes
lbore1 yes
lbore2 yes
lmisc1 yes
lmisc2 yes
If the postblock valid motion postblock is skipped, it is assumed that you are generating the NC output
from the tool change postblock. Don’t forget to do this with the null tool change postblock call.
Caution: Do not add this feature to an older post that was not written or modified for the “tool change
after” technique. In addition, if the rpd_typ_v7 numeric variable is set to 1 in the post customization
file, the technique should not be enabled until the post customization file logic to call back to tool
changes and output positions for rapid with drill and thread has been modified to work with tlchng_aft
set to 2 and rpd_typ_v7 set to 0. See rpd_typ_v7 in Volume 3, Numeric Variables.
Note: It is generally easier to modify a modern post than to alter an existing post processor.
In modern post customization files, separate user-defined output variables have been created (xabs, xinc,
etc.) for both the absolute output and the incremental output. This allows the post writer to keep the
absolute values intact while calculating the incremental values.
Incremental values can be calculated by subtracting the current value from the previous value. This is
done in a modern post by first copying the formatted absolute value for each X, Y, Z position into a
new user-defined variable (xia, yia, zia). Next, using the vector math function vsub, the previous X, Y
and Z are subtracted from the current X, Y, Z .
In MPFAN, there is a start calculations and an end calculations postblock. This allows you to make a
start and end call for incremental calculations from different locations in the post customization file.
The postblocks used in MPFAN are shown below.
#Incremental calculations
To allow the Mastercam user to select between absolute and incremental programming, a
miscellaneous integer is used. The miscellaneous integer is stored in the pre-defined variable absinc.
The absinc variable is now pre-defined and set automatically during subprograms, based on the
absolute/incremental setting. However, the absinc variable must be set for all output other than
subprograms, which is why the miscellaneous integer continues to be used.
X, Y and Z output
In a modern post, the method for outputting of the X, Y and Z values has changed. We no longer use
the x, y and z pre-defined variables for output. Modern posts create a common set of output variables,
which allows us to simplify the output routines, calculations, and helps with modality issues.
In MPFAN, the user-defined variables xabs, yabs and zabs are used for absolute output. The user-
defined variables xinc, yinc and zinc are used for incremental output. All motion output is done from the
pxout, pyout and pzout postblocks. This allows a common call to a set of postblocks for X, Y and Z
motion output for all output lines. In these postblocks the motion output will occur based on the absinc
setting. Samples of these postblocks are shown below.
pxout # X output
if absinc = zero, xabs, !xinc
else, xinc, !xabs
pyout # Y output
if absinc = zero, yabs, !yinc
else, yinc, !yabs
Forcing output
When you use this method, you must force output at a specific time. To do this you would normally
add the asterisk forced output character (*) to the variable, causing output to occur regardless of
modality. With the postblock method above, this would force output every time the pxout postblock
was called. To prevent this, a new set of output postblocks forces output when called, leaving the
original modal postblocks intact. Samples of these postblocks are shown below.
pfxout # Force X axis output
if absinc = zero, *xabs, !xinc # Output absolute X
else, *xinc, !xabs # Output incremental X
When making calls to the motion output postblocks, the pfxout postblock forces output and the pxout
postblock outputs based on modality. For example, you may want to force out the X, Y and Z rapid
position from a tool change while allowing modality to control output during the toolpath motion.
In the tool change postblocks, you can force output of X, Y and Z by calling the pfxout, pfyout and pfzout
postblocks as shown below.
pcan1, pbld, n, *sgcode, *sgabsinc, pwcs, pfxout, pfyout,
pfcout, *speed, *spindle, pgear, strcantext, e
pbld, n, "G43", *tlngno, pfzout, scoolant, next_tool, e
In the toolpath motion postblocks, you can allow modality to control output by calling the pxout, pyout
and pzout postblocks as shown below in plinout.
plinout #Output to NC of linear movement - feed
pcan1, pbld, n, sgfeed, sgplane, `sgcode, sgabsinc, pccdia,
pxout, pyout, pzout, pcout, feed, strcantext, scoolant, e
To provide a transition from a Mastercam Version 7 to Mastercam Version 8, the following items were
implemented.
strtool_v7
The strtool_v7 variable was introduced in Mastercam Version 7 when the tool name in Mill became
generic based on the tool type, and the tool definition index became the tool identifier. To allow the
tool description to appear as in Mastercam Version 6, this variable was added to capture the description
from the tool definition. The description is captured from the Tool Parameters Gcode 20001.
get_1004
Also introduced in Mastercam Version 7, get_1004 is required in older MP posts that used the Cancel
Cutter Compensation to indicate the end of a toolpath before the introduction of the ptoolend postblock.
The ptoolend postblock that exists in these posts is called by the internal function and the post code
testing for the nextop of 1004. This produces two calls where a single call is desired.
rpd_typ_v7
rpd_typ_v7 is a new variable for Version 8 that controls the following actions when it is set to 1 and
processing a Version 8 NCI file:
! 5-axis motion (Mill) Gcode 11 – The next contour flag variable nextcflg is taken from the old
contour flag (parameter 8).
! Contour flags (Mill) – the rev5 is NOT read.
! Contour Flags (Lathe) for rpd_typ are converted to Version 7 settings shown below. This is
important to add to a V7 Lathe post that used the lathe canned turning cycles generated in the post
file.
Note: drillcyc has 100 added internally with 5-axis drilling so it always appears in the 100s range.
! In Mastercam V7 drilling, there was no move after the tool change. Mastercam V8 NCI
specifications require a rapid move after all tool changes. Some posts do not expect the rapid
motion and rpd_typ_v7 skips the rapid move.
! rpd_typ_v7 skips the enhanced long code drilling calls if rotaxtyp is less than 6.
V9 changes
For information on changes specific to Version 9, pleased see Post Processors - What's New in v9.pdf
Troubleshooting upgrading
If you have trouble running a post from a prior Mastercam version:
2) Use the C-Hook RUNOLD, which allows you to produce an NCI file compatible with the
Mastercam version the post was written for. Use this C-Hook if you have a third party product that
is using the NCI file and was written prior to Mastercam V8. This can be made to appear seamless
by creating the surrogate post in the C-Hook RUNOLD.
Common problems
! When you attempt to run MP, if you get the error saying that the DLL could not be found, the DLL
named MPPARAM.DLL is missing or is not in the directory with the Mastercam executable.
Mastercam V8 and V9 produce an external operation file (.OPS). MPPARAM.DLL must be
present for MP to execute. Be aware that the 10000 series parameter information in the NCI file is
being phased out.
! String select errors in an MP post are almost always generated because of added options to the
selector variable. The post must be modified to accommodate the new functionality. Contact your
dealer for cost and additional information.
3-8 Mastercam Version 9 MP Post Processor Reference Guide June 2002
Volume 1 Chapter 3 Changes to the MP Post
V8.10r
! Break smcname (1050) into components smcname (MC8 name), smcext (MC8 Extension),
smcpath (MC8 path)
! Modified for fatal error reporting. Better error reporting.
! Added option for sub_level = -2 to ignore all subprogram NCI data.
! Added up_st_vecx, up_st_vecy, up_st_vecz and up_st_mode variables to Wire.
See Volume 3, Numeric Variables for more information.
! Updated for alternating thread.
V8.20r
! Modified for fatal error reporting.
! Modifications for network HASP (SIM module)
! Fixed bug: When bug2 was negative, NC output was written to the debug section.
! Allow the use of a suffix with a format statement (for example, fmt P 1 var1 S where P is
prefix, S is suffix).
V8.21
! Fixed problem with next_tool being 0.
V9.00r
! Added DLL versions for initial V9.0 release CD.
! Added error_msg variable for new .ERR file (error logging).
This is documented in the Post Processors - What's New in v9.pdf
and Volume 3, Numeric Variables
V9.02
! Added err_file variable to control when .ERR file is kept after processing.
This is documented in the Post Processors - What's New in v9.pdf
and Volume 3, Numeric Variables
V9.03
! A very important fix in this version DLL files corrects arc outputs in the
XZ and YZ planes. When posting toolpaths with arcs in the XZ and YZ planes
that were created by the filter, some of these arcs in rare cases would output as
a straight line move.
V8.0
Mill
Lathe
V8.1
All posts were updated for V8.1 based on changes made to Mastercam and MP.
V8.1.1
Mill
Lathe
Wire
V9.0
Mill
Lathe
Wire
Note: Not all Version 9 updated/new posts listed here are on the Version 9 installation CD. Your
Mastercam dealer can obtain copies for you.