You are on page 1of 26

Volume 1 Chapter 2 Introduction to MP Post Processors

2 Introduction to MP Post Processors

This section presents an overview of the MP post processing language. It is intended to provide
direction for someone who wants to modify an existing MP post processor. It is not intended to teach
you how to write a post processor.
To be able to modify a post processor and understand the material in this Reference Guide, you should
have a basic understanding of how a computer program is structured and operates. As a minimum, you
should understand:
! how the syntax of a programming language affects program operation
! the use of variables to store and pass information
! branching within a program based on conditional and Boolean expressions
! jumping within a program through subroutine calls
! mathematical expressions and formulas
! nesting in formulas and a program language structure
! general debugging techniques
In addition, you must be familiar with Mastercam and have a thorough understanding of NC code
(Gcode) and the specific requirements of the machine tool and control for which you want to create a
post processor.
Note: This Reference Guide does not describe “legacy posts”, also called family posts, which are no
longer supported by Mastercam. These posts are MS-DOS® based can be identified by their use of
.COM executable files.

What is an MP post?
An MP (Mastercam Post) post processor is a combination of three files:
! the post processor customization file (.PST)
! the post processor customization text file (.TXT)
! the post processor executable file (.DLL)

The MP post processor customization file (*.PST) is written in CNC Software, Inc.’s proprietary
scripting language, the MP language, which is a simple programming language designed to enable
someone with limited programming experience to customize a post processor for use with Mastercam.
The MP post processor executable (*.DLL) is a program that interprets the MP post customization file,
processes the Mastercam intermediate file (*.NCI) and produces the NC output file (*.NC).
The MP post processor is a combination of a configuration-type post, where all output is controlled in
the post executable by a series of questions the user answers to control output, and a language-based
post. Although a language-based is more difficult to use than configuration-type post , it is also more
powerful because there are no restrictions placed on the post writer by the capability of the post
executable. Using the MP language, the post writer can accomplish practically any task in the post
processor.
June 2002 Mastercam Version 9 MP Post Reference Guide 2-1
Chapter 2 Introduction to MP Post Processors Volume 1

The MP post processor needs three main files:


! A post customization file (.PST), which is an ASCII text file containing MP language instructions
that define exactly what NC code will be produced and its format.
! A post executable file (.DLL), which can be considered the “engine” of the post processor. It
reads the post customization file (.PST), reads the intermediate file (.NCI) and writes the NC file.
You do not modify the post executable file but you can control some of its behavior through the
post customization file.
! The Mastercam intermediate file (.NCI), which is the generic NC file format generated from the
toolpaths that are created in Mastercam. Continuing the analogy, this is the fuel for the engine.
The information that is read from the NCI file is converted by the post process operation into NC
code.

How does an MP post work?


Each operation you create in Mastercam generates a toolpath. The operation contains, in addition to
the toolpath motion, parameter information such as tool descriptions, speeds and feeds, and more. This
information is written to an intermediate file, the ASCII NCI file, when an operation is posted.
For more information on the NCI, see The NCI File. For a detailed description of each NCI Gcode, see
Volume 3, The NCI file.
What happens when you post an NCI file in Mastercam, in simple terms, is:
! The post executable file first reads the currently active post’s customization file for instructions.
(The currently active post is the post that is active when Mastercam starts, the post associated with
the currently active configuration file (*.CFG), or the post selected specifically by the user. )
! The post executable file then reads the NCI file, translates the NCI data into NC output based on
the instructions it obtained from the post customization file
! The post executable writes the NC output to an NC file and transmits this NC program to the
machine tool’s control to drive the machine tool.

Post processing in greater detail


What actually happens during the post process operation is:
! Mastercam first opens the post executable file.
! The post executable builds lists of variables and labels that are predefined in the post executable
itself.
! The post executable opens and reads the post customization file and converts the MP language,
which is coded in a human-readable form, into an instruction list that is readable by the post
executable.
! The post executable adds user-defined variables and labels to the lists of predefined variables and
labels.
! Once these tasks are complete, the post executable is able to perform the instructions contained in
the post customization file.

2-2 Mastercam Version 9 MP Post Reference Guide June 2002


Volume 1 Chapter 2 Introduction to MP Post Processors

Reading the NCI file


The post executable next opens the NCI file and begins reading two lines of the NCI file at a time
(parsing the NCI file). This starts a process of reading two-line sets from NCI file and producing
corresponding calls to the instruction list retained in the computer’s memory in order to generate the
NC output.
The first line in the two-line set is the NCI Gcode. This line contains a single value. It is the key to
how the next line is interpreted and how the information is processed by the post executable. The
second line in the two-line set contains parameters (for example, the X, Y, Z position, feed rate) that
complete the data to be passed with the NCI Gcode.
Actual NCI line set for a linear move at rapid feed rate:
0
0 2.375 2.375 2.5 –2. 0

Definition:
g (NCI Gcode)
1 2 3 4 5 6 (six parameters)

Where:
g
123456
g 0: Linear Move at Rapid Feed Rate (NCI Gcode)
1 Cutter Compensation
2 Final X position
3 Final Y position
4 Final Z position
5 Feed rate settings
6 Contour flag

The post executable applies these parameter values to the appropriate predefined MP variables,
performs additional calculations to generate values for other predefined variables that are commonly
used for the NCI Gcode type being processed, and performs any routines enabled by the post
customization file appropriate for the NCI Gcode type. (An example of such a routine is breaking an
arc at its quadrants.)
Next the post executable begins executing MP instructions, which are contained in postblocks.

Postblocks
A postblock is an MP language mechanism - a named series of lines of MP statements, called postlines,
that can perform calculations, call other postblocks, and produce NC output. Based on the value of the
NCI Gcode in the two-line set it is parsing, the post executable calls a specific predefined postblock.
For more information on the correlation between NCI Gcodes and predefined postblocks, see
Postblocks and The NCI file.

June 2002 Mastercam Version 9 MP Post Reference Guide 2-3


Chapter 2 Introduction to MP Post Processors Volume 1

A predefined postblock called as a result of an NCI Gcode is an entry postblock because it is the
starting point in the post customization file where the instructions in the postblock are executed. There
are other types of predefined postblocks, which will be described later.
The post executable file interprets each postline, following the flow of the logic defined by the
postblock. Each postline is interpreted by examining the MP language statements contained in the line
in order from left to right. Depending on the statement type, a character string may be assembled that
becomes a line of NC output (although not all postlines result in output).
When the post executable determines that an NC output line is complete, it writes the line to the NC
output file. The post executable then continues processing postlines in the entry postblock until the
final instruction is processed. When all statements according to the logic flow of one postblock have
been processed, the post executable reads another two-line set from the NCI file. This produces a call
to another entry postblock and the process repeats. The posting process continues in this way until the
entire NCI file has been read.
The following diagram illustrates MP post processor flow.
Mastercam starts or user changes the post processor
selection.

Mastercam reads numbered system questions in .PST


file and text from .TXT file.

Mastercam sets values and modifies menus and


dialog boxes according to post numbered system
questions and .TXT file.

User prepares Mastercam job.

User posts Mastercam job (one or more operations).

Mastercam writes ASCII NCI file.

Mastercam launches MP.DLL, MPL.DLL, or


MPWIRE.DLL.

Post .DLL reads and parses active PST file.

Post executes pre-process and preparatory functions


and postblocks.

A Post reads the ASCII NCI file, two lines at a time.

Based on first line Gcode, passes parameters as


variables, executes associated internal routines.

2-4 Mastercam Version 9 MP Post Reference Guide June 2002


Volume 1 Chapter 2 Introduction to MP Post Processors

Based on first line Gcode, calls a predefined entry


postblock.

Post interprets postline statements and writes NC


output line(s).

Post returns to A to continue reading NCI line sets


until the end of the .NCI file.

What files do I need for the posting process?


The post customization file (*.PST)
The post customization file is the file you select when you chose a post processor in Mastercam. You
can use or modify an existing customization file, or write a new post customization file to generate NC
code for your particular machine tool requirements. Mastercam comes equipped with an extensive
library of post customization files. In addition, your Mastercam dealer can assist you in developing or
modifying a post customization files to meet your needs.

The post text file (*.TXT)


With each post customization file, there can also be a post text file. The post text file is an optional file
that allows you to replace the text displayed in certain menus and dialog boxes in Mastercam. It’s
purpose is to customize Mastercam text based on the post customization file. The post text file must
have the same file name as the post customization file but with the .TXT extension and resides in the
same directory as the post customization file.
See Using the Post Text File for more information on the post text file.

The post executable file (*.DLL)


The post executable file is located in the Mastercam Chooks directory. There is an MP post executable
file for each Mastercam product - MP.DLL for Mill, MPL.DLL for Lathe, and MPWIRE.DLL for
Wire. Mill/Turn applications can use either MP.DLL or MPL.DLL for the post executable file
The post executable file must have two additional files:
! The post executable text file (also *.TXT). This text file has the same file name as the post
executable file but with the .TXT file name extension. It contains the warning and error messages
that are displayed if there are problems during the posting process. It must be located in the same
directory as the post executable (Chooks directory).
! If the post executable file was compiled since the release of Mastercam V8.0, MPPARAM.DLL
must be located in the directory with the Mastercam executable. This DLL is loaded into the post
executable file to read the operation parameter file. The operation parameter file is a binary file that
contains all the information that was entered in the Operation Parameters pages in Mastercam.
See Volume 3, Parameter Information for more information on parameters.

June 2002 Mastercam Version 9 MP Post Reference Guide 2-5


Chapter 2 Introduction to MP Post Processors Volume 1

What are the components of the MP language?


Note: The MP_EZ post, which is supplied with Mastercam Mill V9, will be used to illustrate the MP
language and typical post construction. You can find the MP_EZ.PST file in the Posts folder
within the MCAM9\MILLl product folder. Having a copy of the MP_EZ.PST file available for
reference will make it easier to understand the MP language discussions that follow.
See Sample Post: MP_EZ.PST later in this chapter for excerpts from this file.
The MP language offers the following features, which are explained in the sections that follow:
! Predefined variables and strings
! User-defined variables and strings
! Predefined postblocks
! User-defined postblocks
! Bracketed or nested postblocks
! Conditional branch statements (while, if, else)
! Math operators
! Formula functions for trigonometric functions
! Formula functions for string manipulation
! Formula functions for file manipulation
! Formula functions for vector math
! Formula functions for intersecting geometry
! User prompts, which are displayed in Mastercam when the post is run. The user can enter
information to the post with this feature.
! Post comments
! String select function, lookup tables and buffer files
! Support for subprograms and Lathe canned cycles
! Support for drilling canned cycles and drilling long code
! System numbered questions, also called numbered questions, which can be used to alter specific
Mastercam functions and settings to work with the post processor.

Variables
Variables are labels given to specific values or strings the post processor uses. The variables may
represent numeric values (numeric variable) or character strings (string variable). They can be
parameters passed from the NCI, values calculated within the post executable file, or switches that are
used to enable or disable posting options. Variables allow the post processor to pass and manipulate
information by using the variable label to represent the value or string itself.
Variables may be predefined or user-defined.
Predefined variables are variables that exist in the post executable file. They do not need to be
declared in the post customization file except to apply an initial value to them or to format them for
output.

2-6 Mastercam Version 9 MP Post Reference Guide June 2002


Volume 1 Chapter 2 Introduction to MP Post Processors

User-defined variables must be declared in the post customization file. User-defined numeric variables
must be initialized and/or formatted before they can be used in the post customization file. User-
defined string variables must also be declared before they are used. String variable labels always begin
with the letter “s”, for example, scoolant.
Using variables to construct output
The post processor constructs a line of NC output by assembling a series of variables found on a
postline. To be output, a variable must simply appear on a postline, but it must not be part of a formula
or conditional expression. For example, the following line would output the values and strings for the
variables, n, scoolant, and next_tool. ‘e’ creates a carriage return/line feed at the end of the line:
n, scoolant, next_tool, e
Note: Modality and Variable Modifiers affect whether a variable is actually output to the NC file.
See Numeric Variables for a description of modality.

String literals
The MP language also supports string literals, which are characters contained within quotes, for
example, “M00”. Literal strings are converted to a string variable internally when they are found on a
postline. They are output exactly as you see them in the post customization file.

Command variables
A special type of predefined numeric variable in the MP language is the command variable. This type
variable starts a process or action that is part of the post executable. They are normally used alone on a
postline. MP language command variables include, for example, comment, which buffers and outputs
comments where the post writer would like them, and fleader, which writes leader and trailer characters
for punched tape.
See Numeric Variables for information on the declaration and use of variables. For a full description of
predefined variables, and for a complete listing of commands, see Volume 3, Numeric Variables.

Postblocks
A postblock is a labeled series of postlines containing MP statements that produce NC output,
conditionally branch, perform calculations, call other postblocks and trigger routines in the post
executable. A postblock label, which declares a postblock, usually begins with the letter “p” and
begins in the first column. Postblock labels can also begin with “l” or “m”, normally for mill/turn
applications. The postblock label must be on a separate line before the postlines included in the block.
There are several kinds of postblocks. An entry postblock is one that is called as a result of the NCI
code. Another is the bracketed postblock, which is a user-defined postblock nested within another
postblock. Bracketed postblocks are implied postblocks. By using the open and close brackets ([,]) to
surround the postlines, the post executable interprets this as a separate block of instructions. Bracketed
postblocks are used to make the post customization file more readable and are normally used with
conditional branching.

June 2002 Mastercam Version 9 MP Post Reference Guide 2-7


Chapter 2 Introduction to MP Post Processors Volume 1

Postlines
Postlines can start in any column except the first. Use consistent indentation to make the organization
of the post clear. All postlines that are not nested within a bracketed postblocks are considered part of
the preceding labeled postblock until a label in the first column is encountered. This label can be
another postblock label, a variable label or post function declaration. Post comments are ignored and
do not end the postblock.
There are three types of postlines:
! Formula postline
! Boolean postline
! Output postline

Formula postlines
Formula postlines are used for assignments or equations. The equal sign (=) after a result variable as
the first item on the postline is what identifies the formula postline. A formula postline can be
considered a postline statement called a formula statement. A formula statement is limited to one line
and cannot continue over multiple lines in the post customization file. It can be part of a Boolean
postline but cannot be included in an output postline.
For example, this is a formula postline and a formula statement:
speed = abs(ss)

Boolean postlines
Boolean postlines begin with a conditional branching statement.
This is a formula statement in a Boolean postlines:
if speed > maxss, speed = maxss

Boolean postlines are very similar to formula postlines except, instead of using an equal sign with a
result variable, a Boolean postline uses the conditional operators ‘if’, ‘else’ or ‘while’ as the first entry
on the postline. In addition, a formula in the conditional branching statement can continue over several
lines until a comma (,) that is not part of a formula function is encountered. Both the conditional
operator and the Boolean formula are considered a postline statement.
For example:
This is a Boolean postline and a conditional branching statement:
if speed > maxss,

This is also a Boolean postline and a conditional branching statement:


else,

Following the comma delimiter in the Boolean postline, it is legal to have any statement type except
another conditional branching statement.

2-8 Mastercam Version 9 MP Post Reference Guide June 2002


Volume 1 Chapter 2 Introduction to MP Post Processors

Output postlines
“Output postline” is a misleading term because the statements allowed on this type of postline can
imply that a variable will necessarily be output. However, output postlines can perform any or the
following tasks:
! modify variable attributes with or without variable output
! call a command routine
! output a string literal
! output an ASCII character
! prompt the user
! call a postblock
All of these statements are called output statements.
What identifies an output postline is the fact it is not interpreted as a formula postline, formula
statement or Boolean postline by the post executable. Each of the output statements listed above can
occur in an output postline and must be separated by a comma (,). Statements that are legal for an
output postline are also valid as statements following the conditional branching statement in a Boolean
postline. For example, this is a Boolean postline with output statements:
if speed <> 0, n, speed, next_tool, pblockcall, e

An output statement that contains another postblock name performs a call to the named postblock.
Similar to an entry postblock, this type of postblock passes control to the position of the called
postblock declaration. When the output statement contains more than one postblock name, each
postblock name passes control to its postblock in turn. When all instructions in the called postblock(s)
have been completed, control returns to the calling output statement.
See Postblocks for more information.

Conditional branching
The MP language supports the conditional operators (if, else, while). These are used with conditional
branching statement in the MP language to control what instructions are processed in the post
customization file.
See Postblocks for more information on conditional branching.

Mathematical operators
The MP language supports a large number of operators, including the common mathematical operators
(open and close parentheses, +. -, *, /), comparison operators (=, <>, <, >, <=, >=), Boolean or logical
operators (&, |, not). (& is the Boolean ‘and’ operator and | is the Boolean ‘or’ operator.)
See Volume 3, Formulas for a complete listing of MP language operators.

June 2002 Mastercam Version 9 MP Post Reference Guide 2-9


Chapter 2 Introduction to MP Post Processors Volume 1

Formula functions
An MP formula function performs a defined routine using one or two passed arguments and returns
some result, which is applied or assigned to the variable on the left of the equation, for example, gear =
frange (one, speed) or string2 = lcase (string). Formula functions are part of the MP language; you cannot
define your own functions. The MP language provides a Math Library that includes the following
types of functions:
! arithmetic
! trigonometric
! 2D intersection
! vector/matrix
! string and file manipulation
See Volume 3, Formulas for a complete listing of MP language functions.
Note: Some formula functions are designed to take the left value and assign it to the argument that is
the right value. This is contrary to normal convention.

User prompts
You can display prompts or questions in the Mastercam prompt area at the bottom of the Mastercam
application screen. A unique method is used to trigger a user prompt. The post function for user
prompt (fq) is declared and a trigger placed on a postline in the post customization file. The trigger is
not a variable but is a combination of the letter ‘q’ and the matching number of the post function for
question; for example, q1. When the trigger is encountered as an output statement, the post processor
pauses, displays the prompt text in Mastercam and waits for the user’s response.
See How Prompt Questions Work for more information.

Post comments
A post comment is used to document in the post customization file any information the post writer may
feel is needed. The pound symbol (#) marks the start of a comment. However, because the comment
ends at the end of the line in the post customization file, it is not possible to nest comments or insert
them in between postline statements. All comments are ignored when the post customization file is
parsed by post executable file.

String select function


The string select function is a powerful feature of the MP language that allows the post processor to
assign a string variable from a list of string variables to a target string variable based on the value of a
numeric variable used in this selection function.
A frequent use of the string select function is to output a motion NC code to the NC file based on the
NCI Gcode read from the NCI file. Based on the NCI Gcode, a string variable is selected and placed in
the target string variable for output.
One advantage of this function is the output of the string variable is controlled by the modality of the
numeric variable. For example, if the NCI Gcode read by the post executable is 0, then output might be
G0 if the variable’s modality dictates output, or nothing if it doesn’t.

2-10 Mastercam Version 9 MP Post Reference Guide June 2002


Volume 1 Chapter 2 Introduction to MP Post Processors

See Numeric Variables for more information on modality and its effect on output.
The MP_EZ post provides string selects for the following:

! Motion Gcode (G0, G1, G2, G3, or G4)


! Work plane Gcode (G17, G18, or G19)
! English or metric code (G20 or G21)
! Reference return code (G28 or G30).
! Cutter compensation Gcode (G40, G41, or G42)
! Canned drill cycle Gcodes
! Absolute or incremental Gcode (G90 or G91)
! Canned drill cycle reference height (G98 or G99)
! Spindle Mcode (M3, M4 or M5)
! Coolant Mcode (M8 or M9)
See Post Functions for more information on defining and using string select tables.

Lookup tables
Lookup tables are essentially two-column tables that associate a value in the first column with a value
or variable in the second column. There are two types of lookup tables:
! Lookup tables used to associate an input value with an output value
! Lookup tables used to associate an operation parameter Gcode with a numeric or string variable

Lookup tables are normally of the type that associates an input value with an output value. Spindle
gear selection is a good example of this type of lookup table. The spindle speed is passed as an
argument and matched to the second column. The value in the second column is then compared to the
entry in the first column and the value from the first column is returned.
Lookup tables are declared in the post customization file. The MP_EZ.PST post provides a lookup
table (lookup table 1) to select a gear range based on spindle speed.
See Post Functions for more information.

Buffer files
Buffer files are temporary files used to store and retrieve numeric or string data. They normally exist
only while the post is running. You can convert them to text files or open existing text files as a buffer
files.
Note: MP_EZ.PST does not contain an example of buffer files.
See Volume 2, How Buffer Files Work for more information.

Support for subprograms and canned cycles


Mastercam Version 8 provides methods to generate subprograms and canned cycles for lathe. These
are supported for Fanuc-type controls in the MPFAN.PST and MPLFAN.PST files. MP_EZ.PST does
not provide this support and should not be referenced for this functionality. Drilling canned cycles are
supported in the MP_EZ.PST file.

June 2002 Mastercam Version 9 MP Post Reference Guide 2-11


Chapter 2 Introduction to MP Post Processors Volume 1

See Volume 2, How Subprograms Work and Volume 2, How Lathe Canned Cycles Work for more
information.

System numbered questions


The system numbered questions are a numbered list of questions at the end of the post customization
file that are read by Mastercam when the post is loaded. The system questions set certain parameters in
Mastercam and turn certain Mastercam features on and off. When Mastercam starts and loads the
default post customization file or when the operator changes the post customization file, Mastercam
reads the system numbered questions.
See Using Numbered Questions for more information.

How is an MP post organized?


Organization in this context refers to the order in which post comments, declarations, postblocks, and
statements should occur, or sometimes must occur, in the post customization file. As the MP post
language has evolved, the organization requirements have become less stringent. Although not strictly
required, the organization guidelines presented here will make it easier to understand and maintain the
post customization files.
Note: Please refer to the MP_EZ.PST sample post customization file for code examples.
In general, post customization files should be organized into three major areas:
! The Definition area containing the post header (post comments), declarations (initializations,
formats, global formulas), post functions and lookup tables.
! The Postblock area containing both user-defined and predefined postblocks.
! The System Questions located at the end of the post customization file.

Definition area
The Definition area contains the following sections:
! Header containing the title block, revision log, and feature list. This entire section is series of
comments, which is indicated by the pound character (#) in the first column. (The post executable
ignores the # and everything following it.) Comments are generally documentation intended to be
read by the post’s users.)

! Debug switches, program constants and other program switches. Debug switches allow you to
generate information about which NCI line and postblocks have produced each line of NC output.
See Post Debugging Techniques for more information. Program constants are numeric variables
that have a single constant value that should never be changed. Program switches turn program
features on and off or select a behavior from a list of options. Both program switches and variables
are given initial values by the post in this section of the customization file.

2-12 Mastercam Version 9 MP Post Reference Guide June 2002


Volume 1 Chapter 2 Introduction to MP Post Processors

! Numeric variable initialization is a continuation of the debug switches, program constants, and
other program switches section. Some are predefined numeric variables that may be initialized to a
different values depending on the post writer’s requirements. Others are user-defined numeric
variable declarations that are required in the post customization file. A numeric variable
initialization is always defined with the colon “:” and, as the name implies, assigns only the initial
value of the numeric variable.

! Format statements describe the numeric format of every numeric variable you will output to the
NC file. Format statements are referred to by number. By default, format statement 1 is associated
to a numeric variable.

! String variables, string select functions declare string variables and the string select
functions, which are used to obtain a character string based on a numeric variable. The string
variable label always starts with the letter ‘s’ and the declaration uses a space between the label and
the character string.

! Lookup Tables define tables. The post function declaration is entered followed by the table
entries.

! Buffers defines the buffers used to access or save data. MP_EZ.PST does not use buffer files and
it is generally best to avoid their use unless absolutely needed.
! Global formulas are numeric variable declarations that are evaluated whenever the declared
numeric variable is encountered as a postline statement or in a postline formula. This evaluation
occurs before any output. Although any numeric variable declarations (initialization or global) can
have a formula assignment, a global formula is different in that it uses the equal sign (=) instead of
the colon for the assignment. Note: Use of global formulas is not recommended and can lead to
confusion when debugging. Try to put the formula in the postblock where it is used.

! Format assignments assign both a prefix character and defined format statement to a numeric
variable. When the numeric variable is output, these formatting assignments are applied.

Postblock area
The Postblock area contains Postblock declarations.
User-defined postblocks must always be declared by defining the postblock with a postblock label
following the syntax rules for postblocks. User-defined postblocks must be called from a predefined
postblock.
Note: To produce output, predefined postblocks must be declared, and postlines with statements for
processing the output must be written. If they are not found in the post customization file as a
declaration, control is immediately returned without any warning to the user. If output statements that
produce output are not present in your post customization file, the NC file will be empty or missing
critical motion output.

System numbered question area


The System Question area contains the following:

June 2002 Mastercam Version 9 MP Post Reference Guide 2-13


Chapter 2 Introduction to MP Post Processors Volume 1

! System numbered questions, which are evaluated by Mastercam when the post is loaded. They
can also be evaluated in the post.
! User numbered questions are the same form as the system questions but are evaluated in the post.
The system questions can also be evaluated in the post.

Sample post: MP_EZ.PST


MP_EZ.PST is a generic post, which means that, while it provides commonly used output codes and
formats, it is not customized for a particular machine or control. It is intended to be customized.
Examine the sections of MP_EZ.PST illustrated below to familiarize yourself with its format and
organization. (Note: This is not the complete post.) You may not understand all statements. Post
comments (marked by #) help explain each line. The title block, revision log, and feature list should be
read carefully to understand what is supported by the post customization file and instructions on how it
is intended to be used.

Definition area
Title block # Post Name : MP_EZ
# Product : MILL
# Machine Name : GENERIC FANUC
# Control Name : GENERIC FANUC
# Description : GENERIC FANUC 3 AXIS MILL POST
# Associated Post : NONE
# Mill/Turn : NO
# 4-axis/Axis subs. : NO
# 5-axis : NO
# Subprograms : NO
# Executable : MP 8.10
#
# WARNING: THIS POST IS GENERIC AND IS INTENDED FOR MODIFICATION TO
# THE MACHINE TOOL REQUIREMENTS AND PERSONAL PREFERENCE.
Revision log # ---------------------------------------------------------------------
# Revision log:
# ---------------------------------------------------------------------
# Programmers Note:
# CNC 01/12/01 - Initial post setup v8.1, jce
#
Feature list # --------------------------------------------------------------------------
# Features:
# --------------------------------------------------------------------------
# This post supports Generic Fanuc code output for 3 axis milling and was
# derived from the MPFAN post which supports 4 axis milling and subprograms.
# It is designed to support the features of Mastercam Mill V8.
#
#
# Following Misc. Integers are used:
#
# mi1 - Work coordinate system
# 0 = Reference return is generated and G92 with the
# X, Y and Z home positions at file head.
# 1 = Reference return is generated and G92 with the
# X, Y and Z home positions at each tool.
# 2 = WCS of G54, G55.... based on Mastercam settings.
#
# mi2 - Absolute or Incremental positioning at top level
# 0 = absolute
# 1 = incremental
#
# mi3 - Select G28 or G30 reference point return.
# 0 = G28, 1 = G30
#
#Canned text:
# Entering cantext on a contour point from within Mastercam allows the
# following functions to enable/disable.
# Cantext value:
# 1 = Stop = output the "M00" stop code
# 2 = Ostop = output the "M01" optional stop code

2-14 Mastercam Version 9 MP Post Reference Guide June 2002


Volume 1 Chapter 2 Introduction to MP Post Processors
# 3 = Bld on = turn on block delete codes in NC lines
# 4 = bLd off = turn off block delete codes in NC lines
#
#
#Drill:
# All drill methods are supported in the post.
#
#Additional Notes:
# 1) G54 calls are generated where the work offset entry of 0 = G54,
# 1 = G55, etc.
# 2) Metric is applied from the NCI met_tool variable.
# 3) Incremental mode calculates motion from home position at toolchanges.
# The home position is used to define the last position of the tool
# for all toolchanges.
# 4) The variable 'absinc' is now pre-defined, set mi2 (Misc. Integer) for
# the absolute/incremental program output.
#
#

Debug # --------------------------------------------------------------------------
# Debugging and Factory Set Program Switches
switches, # --------------------------------------------------------------------------
program m_one : -1 #Define constant
constant zero : 0 #Define constant
one : 1 #Define constant
definitions, two : 2 #Define constant
program three : 3 #Define constant
switch and four : 4 #Define constant
variable five : 5 #Define constant
c9k : 9999 #Define constant
initialization
fastmode : 1 #Posting speed optimization
bug1 : 2 #0=No display, 1=Generic list box, 2=Editor
bug2 : -30 #Append postline labels, non-zero is column position?
bug3 : 0 #Append whatline no. to each NC line?
bug4 : 1 #Append NCI line no. to each NC line?
whatno : yes #Do not perform whatline branches? (leave as yes)

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

# --------------------------------------------------------------------------
# General Output Settings
# --------------------------------------------------------------------------
sub_level : 0 #Enable automatic subprogram support
breakarcs : yes #Break arcs into quadrants?
arcoutput : 1 #0 = IJK, 1 = R no sign, 2 = R signed neg. over 180
arctype : 2 #Arc center 1=abs, 2=St-Ctr, 3=Ctr-St, 4=unsigned inc.
arccheck : 1 #Check for small arcs, convert to linear
atol : .01 #Angularity tolerance for arccheck = 2
ltol : .002 #Length tolerance for arccheck = 1
vtol : .0001 #System tolerance
maxfeedpm : 500 #Limit for feed in inch/min
ltol_m : .05 #Length tolerance for arccheck = 1, metric
vtol_m : .0025 #System tolerance, metric
maxfeedpm_m : 10000 #Limit for feed in mm/min
force_wcs : yes #Force WCS output at every toolchange?
spaces : 0 #No. of spaces to add between fields
omitseq : no #Omit sequence no.
seqmax : 9999 #Max. sequence no.
stagetool : 0 #0 = Do not pre-stage tools, 1 = Stage tools
use_gear : 0 #Output gear selection code, 0=no, 1=yes
max_speed : 10000 #Maximum spindle speed
min_speed : 50 #Minimum spindle speed
nobrk : no #Omit breakup of x, y & z rapid moves
progname : 1 #Use uppercase for program name

Format # Format statements - n=nonmodal, l=leading, t=trailing, i=inc, d=delta


# ---------------------------------------------------------------------
statements #Default english/metric position format statements
fs2 1 0.7 0.6 #Decimal, absolute, 7 place, default for initialize (:)
fs2 2 0.4 0.3 #Decimal, absolute, 4/3 place

June 2002 Mastercam Version 9 MP Post Reference Guide 2-15


Chapter 2 Introduction to MP Post Processors Volume 1
fs2 3 0.4 0.3d #Decimal, delta, 4/3 place
#Common format statements
fs2 4 1 0 1 0 #Integer, not leading
fs2 5 2 0 2 0l #Integer, force two leading
fs2 6 3 0 3 0l #Integer, force three leading
fs2 7 4 0 4 0l #Integer, force four leading
fs2 9 0.1 0.1 #Decimal, absolute, 1 place
fs2 10 0.2 0.2 #Decimal, absolute, 2 place
fs2 11 0.3 0.3 #Decimal, absolute, 3 place
fs2 12 0.4 0.4 #Decimal, absolute, 4 place
fs2 13 0.5 0.5 #Decimal, absolute, 5 place
fs2 14 0.3 0.3d #Decimal, delta, 3 place
fs2 15 0.2 0.1 #Decimal, absolute, 2/1 place
fs2 16 1 0 1 0n #Integer, forced output

Format # Format assignments – prefix, fs#, variable


# ---------------------------------------------------------------------
assignments fmt T 4 t #Tool No: prefix T, fs4, variable t
fmt T 4 first_tool #First Tool Used: prefix T, fs4, first_tool
fmt T 4 next_tool #Next Tool Used: prefix T, fs4, next_tool
fmt D 4 tloffno #Diameter Offset No: prefix D, fs4, tloffno
fmt H 4 tlngno #Length Offset No: prefix H, fs4, tlngno
fmt G 4 g_wcs #WCS G address: prefix G, fs4, g_wcs
fmt P 4 p_wcs #WCS P address: prefix P, fs4, p_wcs
fmt S 4 speed #Spindle Speed: prefix S, fs4, speed
fmt M 4 gear #Gear range: prefix M, fs4, gear

String and # --------------------------------------------------------------------------


#String and string selector definitions for NC output
string select # --------------------------------------------------------------------------
definitions
#Address string definitions
strm "M"
strn "N"
stro "O"
strp "P"
srad "R"
srminus "R-"
sblank

#Cantext string definitions (spaces must be padded here)


sm00 "M00"
sm01 "M01"
strtextno
strcantext

# --------------------------------------------------------------------------
# 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


# --------------------------------------------------------------------------
# Select work plane G code
sg17 G17 #XY plane code
sg19 G19 #YZ plane code
sg18 G18 #XZ plane code
sgplane #Target string

fstrsel sg17 plane sgplane #String and string selector definitions for NC

Lookup # Define the gear selection code


flktbl 1 3 #Lookup table definition - table no. - no.
Table #entries
40 0 #Low gear range
41 400 #Med gear range
42 2250 #Hi gear range

Postblock area
# --------------------------------------------------------------------------
# Tool Comment / Manual Entry Section
# --------------------------------------------------------------------------
ptoolcomment #Comment for tool
tnote = t

2-16 Mastercam Version 9 MP Post Reference Guide June 2002


Volume 1 Chapter 2 Introduction to MP Post Processors
toffnote = tloffno
tlngnote = tlngno
"(", pstrtool, *tnote, *toffnote, *tlngnote, *tldia, ")", e

pstrtool #Comment for tool


if strtool <> sblank,
[
strtool = ucase(strtool)
*strtool, " "
]

pcomment #Comment from manual entry (must call pcomment2 if booleans)


pcomment2

pcomment2 #Comment from manual entry


scomm = ucase (scomm)
if gcode = 1007, "(", scomm, ")"
else, "(", scomm, ")", e

# --------------------------------------------------------------------------
# Start of File and Toolchange Setup
# --------------------------------------------------------------------------
psof0 #Start of file for tool zero
psof

psof #Start of file for non-zero tool number


toolchng = one
if ntools = one,
[
#skip single tool outputs, stagetool must be on
stagetool = m_one
!next_tool
]
"%", e
*progno, e
"(PROGRAM NAME - ", progname, ")", e
"(DATE=DD-MM-YY - ", date, " TIME=HH:MM - ", time, ")", e
pbld, n, *smetric, e
pbld, n, *sgcode, *sgplane, "G40", "G49", "G80", *sgabsinc, e
sav_absinc = absinc
if mi1 <= one, #Work coordinate system
[
absinc = one
pfbld, n, sgabsinc, *sg28ref, "Z0.", e
pfbld, n, *sg28ref, "X0.", "Y0.", e
pfbld, n, "G92", *xh, *yh, *zh, e
absinc = sav_absinc
]
pcom_moveb
ptoolcomment
comment
pcan
if stagetool >= zero, pbld, n, *t, "M6", e
if mi1 > one, absinc = zero
pcan1, pbld, n, *sgcode, *sgabsinc, pwcs, pfxout, pfyout,
*speed, *spindle, pgear, strcantext, e
pe_inc_calc
ps_inc_calc
absinc = sav_absinc
pbld, n, sgabsinc, e
pbld, n, "G43", *tlngno, pfzout, scoolant, next_tool, e
pcom_movea
toolchng = zero

System numbered question area


# --------------------------------------------------------------------------
# Numbered questions for Mastercam Version 8
# --------------------------------------------------------------------------
38. Rapid feedrate? 300.0
#76. Configuration file name?
80. Communications port number for receive and transmit (1 or 2) ? 2
81. Data rate (110,150,300,600,1200,2400,4800,9600,14400,19200,38400)? 1200
82. Parity (E/O/N)? E
83. Data bits (7 or 8)? 7
84. Stop bits (1 or 2)? 2
85. Strip line feeds? N
86. Delay after end of line (seconds)? 0
87. Ascii, Eia, or Binary (A/E/B)? A
88. Echo keyboard to screen in terminal emulation? n
89. Strip carriage returns? N
90. Drive and subdirectory for NC and Material files?

June 2002 Mastercam Version 9 MP Post Reference Guide 2-17


Chapter 2 Introduction to MP Post Processors Volume 1
91. Name of executable post processor? MP
92. Name of reverse post processor? RP
93. Reverse post PST file name? RPFAN
100. Number of places BEFORE the decimal point for sequence numbers? 3
101. Number of places AFTER the decimal point for sequence numbers? 0

Post modification guidelines


Note: The post you need might already exist. Always contact your Mastercam dealer to see if an
appropriate post is available.
! Most importantly, before you make any changes to a post customization file, create a copy of
the original file, preferably using a different name, as a backup. Until you have complete
confidence in a post version, you should keep previous versions, uniquely named, so that you
can return to a previous version if necessary.
! Try to find an existing post that produces a format similar to your requirement.
! Try to use a post that was written for the Mastercam version you are using. Determine if the post
supports any new features in Mastercam. It is much easier to modify a post customization file that
supports the new features than to add support for new features to an older post.
! Have the NC control's operator or programming guide available before starting to make any post
modifications. Most controls are very specific about the data they expect to receive and will not
function properly if there are any NC code syntax errors. Carefully test the NC code you generate
for your machine control. Machine builders can change the format of the NC code or the behavior
of the machine tool with machine tool parameter settings. The documentation that is provided with
the machine tool may be out of date or inaccurate.
! Understand how the post customization file you are about to modify works and the NCI Gcode
input before making any changes to the post. Do not blindly use a post comment (#) to remove MP
code in the post customization file. Required procedures may be removed and adversely impact
the NC output.
! Read all of the revision, features, and usage notes at the beginning of the .PST file before making
any changes. Log and document any changes you make in the Revisions area.
! Check the toolpaths, parameter page entries, and the NCI file data to be sure that input from your
sample Mastercam file is correct.
! Test and debug all changes you make to the post customization file before using the post NC output
in a production environment.

MP language syntax rules


This section summarizes the MP language syntax rules that apply to the most frequently used language
features. Additional rules may be found in the reference sections that describe the feature.
See Numeric Variables, String Variables, Postblocks, etc. for more information. For detailed syntax
descriptions, see Volume 3.

2-18 Mastercam Version 9 MP Post Reference Guide June 2002


Volume 1 Chapter 2 Introduction to MP Post Processors

General post formatting rules


Although the MP language is not case-sensitive, use lowercase for all the MP language features. It is
easier to read the post customization file because string literals are normally upper case.
Features that begin in the first column
The first column (that is, the first character position next to the left margin) is reserved. The following
features must begin in the first column and are the only features that can begin in the first column:
! Numeric variable initialization
! Global formula
! String variable initialization
! Format statement
! Format assignment
! String select function
! User prompt function
! Lookup table function
! Parameter table function
! Buffer file function
! Postblock declaration
! System numbered questions
! Post comments
Features that must be indented
! Output postlines
! Formula postlines
! Boolean postlines
! Lookup table entries
! Parameter table entries
! Post comments

Variable initialization rules


! Predefined variables do not have to be initialized or formatted. See Volume 3, Numeric Variables
and Volume 3, String Variables for a complete list or predefined variables.
! Predefined numeric variables are initialized in the post executable file to 0 by default. The
predefined variables: vtol, atol, chord_tol, ltol, scalex, scaley, scalez, date, time, mon and the post
constants (pi, deg2rad, rad2deg, etc.), are initialized to values appropriate for them. You can also
initialize them to different values in the post customization file.
! Labels used for predefined variables and predefined postblocks are reserved. When defining user-
defined variables, make sure not to use the label of a predefined variable or postblock.
See Volume 3, Numeric Variables and Volume 3, Postblocks for a complete list.
! Numeric variable labels may not start with a numeral.
! String variable labels must start with “s”.
! User-defined numeric variables must be formatted and/or initialized.

June 2002 Mastercam Version 9 MP Post Reference Guide 2-19


Chapter 2 Introduction to MP Post Processors Volume 1

! User-defined string variables are only initialized. Do not attempt to initialize or format them using
the syntax for numeric variables. They may be initialized without a character string to define an
empty (null) string.
! If a numeric variable will not be output because it will be used for calculations only, it does not
have to be formatted.
! Format and/or initialize a variable only once. You can reassign a value or string to a variable
within a postblock by using a formula statement.
! If you do not assign a format to a numeric variable, the format statement 1 is assigned by default.
! Use the colon (:) to initialize numeric variables, for example:
newx : 10.
! Use a space to initialize a string variable, for example:
newstring “G01”
! Do not use the equal sign (=) to initialize a string or numeric variable. This creates a global
formula when used outside a postblock.
! Variables used in a formula that is part of an assignment in either a global formula or initialization
must be defined before they are used in the assignment formula.

Postblock and postline rules


! Postblock labels must begin in the first column.
! Postblock labels begin with letter “p”. Although the letters “m” or “l” are also used, they are
intended for use with mill/turn applications.
! A postblock label must be on a line by itself (except for post comments).
! User-defined postblock labels must not duplicate predefined postblock labels.
! Any MP language feature that starts in the first column following a postblocks postline(s) indicates
the end of that postblock. The exception is the post comment (#).
! The open and close brackets ([,]) that enclose the postlines in a bracketed postblock should be on
lines by themselves.
! Do not nest bracketed postblocks more than 25 levels deep.
! Indent the brackets used with the bracketed postblock.
! Postlines must always be indented.
! NC lines are built in the order in which the output statements occur on the postline. What you see
in the post customization file is what you get in the NC output. Keep in mind that modality and
other factors control what is actually output to the NC file.
See Numeric Variables for more information on modality.
! Use commas (,) to separate output statements.
! Output statements can continue over multiple lines by placing a comma at the end of the line (and
before any post comment).
! Terminate a series of output statements that are intended to produce NC output with the “e”
command variable. This tells the post executable to write the end-of-block characters.
! Output statements may follow the comma delimiter on a Boolean postline.
! A formula statement must be on a single line. Do not put more than one formula statement on a
line.
! A single formula statement on a single line can follow the comma delimiter on a Boolean postline.

2-20 Mastercam Version 9 MP Post Reference Guide June 2002


Volume 1 Chapter 2 Introduction to MP Post Processors

! A conditional branching statement can never follow the comma delimiter on a Boolean postline.
! A conditional branching statement can continue over multiple lines until the comma delimiter is
found.
! Never use the colon (:) as an assignment operator in a postline formula statement. The colon is
reserved for initialization only.
! In a conditional branching statement, use a space to separate the Boolean keyword (if, else, while)
from the formula.

Limits
Feature Maximum

Numeric variable label length 25 characters


String variable label length 25 characters
Postblock label length 25 characters
String assignment length 120 characters
Number of nested postblock calls 25
Number of nested bracket postblocks 25
Number of format statements (fs/fs2) 30
Format assignment (fmt) prefix length 15 characters
Numeric variable definitions 32,700
String definitions 32,700
String length in buffer file 80 characters
Postblock definitions 32,700
Number of user prompt questions 20

Common post tasks or How do I …?


This section provides brief descriptions of how to make changes to the MP_EZ post to perform some
of the more common tasks. These changes affect the NC output file. These techniques often relate to
other post customization files. Please refer to the sections cited for details.

How do I …?
Change the start-of-file Search for the postblock psof in the post customization file. Replace the % character in this line:
character
"%", e

with the one needed on for your machine tool. If the character cannot be typed, replace the “%”
characters with the ASCII decimal equivalent. For example:

35, e

Remove the line if no special character is needed.

June 2002 Mastercam Version 9 MP Post Reference Guide 2-21


Chapter 2 Introduction to MP Post Processors Volume 1

Change the end-of-file Search for the postblock peof in the post customization file. Follow the procedure used in “Change
character the start-of-file character.

Pre-stage tools for the MP_EZ post was set up to do this. Search for the numeric variable stagetool and find this line:
machines tool changer
stagetool : 0 #0 = Do not pre-stage tools, 1 = Stage tools
and set the initialization to 1.
stagetool : 1 #0 = Do not pre-stage tools, 1 = Stage tools

At the end of the NC Search for the postblock peof in the post customization file. Find the line:
file, I want the first tool
pre-staged #if stagetool = one, pbld, n, *first_tool, e

and remove the # character. The # makes this statement a comment. Removing it exposes the code to
the post executable.

Separate the tool This change must be done in two postblocks. Search for the postblock psof in the post customization
number and tool file. Replace the entire line:
change command
if stagetool >= zero, pbld, n, *t, "M6", e

with these lines:

if stagetool >= zero, pbld,


[
n, *t, e
n, "M6", e
]

By reordering the lines, you can reverse where the tool and command appear. Search for the postblock
‘ptlchg’ and repeat the process.

Use G92 instead of The Miscellaneous Integer number 1 is used to control this feature in this post. Search for “301.” in the
G54 post customization file. Change the response to 0. The next time the post is loaded, the setting takes
effect.

If you have existing operations, you will need to modify them from the Operations Manager in
Mastercam. Right-click and select Options, Edit Common Parameters. In the Tool Parameters dialog
box, select the Misc. values button and change the first Integers to 0.

Do not break the arcs Search for the numeric variable breakarcs and find this line:
at the quadrants breakarcs : yes #Break arcs into quadrants?
Set the initialization to no.

breakarcs : no #Break arcs into quadrants?

2-22 Mastercam Version 9 MP Post Reference Guide June 2002


Volume 1 Chapter 2 Introduction to MP Post Processors

Output I,J,K with arcs MP_EZ is coded to output R or I,J,K automatically with a user-defined numeric variable as a switch.
Search for the numeric variable ‘arcoutput’ and find this line:

arcoutput : 1 #0 = IJK, 1 = R no sign, 2 = R signed neg. over 180

Set the initialization to 0.

arcoutput : 0 #0 = IJK, 1 = R no sign, 2 = R signed neg. over 180

Output R signed when Follow the procedure used in “Output I,J,K with arcs” but set the initialization to 2.
the sweep exceeds
180 degrees arcoutput : 2 #0 = IJK, 1 = R no sign, 2 = R signed neg. over 180

Allow sequence Search for the numeric variable seqmax and find this line:
numbers to be greater
than N9999 seqmax : 9999 #Max. sequence no.

Set the initialization to the appropriate value. Note: You control the initial sequence number and
increment amount in the Mastercam toolpath parameters dialog box.

Omit sequence Search for the numeric variable use_gear and find this line:
numbers entirely
omitseq : no #Omit sequence no.

Set the initialization to yes.

omitseq : yes #Omit sequence no.

Set up a gear range Search for the numeric variable use_gear and find this line:
table
use_gear : 0 #Output gear selection code, 0=no, 1=yes

Set the initialization to 1.

use_gear : 1 #Output gear selection code, 0=no, 1=yes

Next search for the post function ‘flktbl’ and find this line:

flktbl 1 3 #Lookup table definition - table no. - no. entries

A lookup table equates the spindle speed to gear range value. The postline here:

gear = frange (one, speed)

from the postblock ‘pgear’ returns the selected value to the numeric variable gear, which is
subsequently formatted and output. Adjust the table to your requirements by modifying and adding to
the lookup table entries. Remember to keep the ‘no entries’ current on the table declaration line.

June 2002 Mastercam Version 9 MP Post Reference Guide 2-23


Chapter 2 Introduction to MP Post Processors Volume 1

Modify the motion Search for the post function fstrsel and find this line:
Gcode
fstrsel sg00 gcode sgcode

The string variables above this line are used in the string selection and are placed in the target string
variable sgcode, which is used as an output statement. To modify the output, simply modify the string
variables character string. For example, change:

sg00 G0 #Rapid

to:

sg00 G00 #Rapid

to output “G00” instead of “G0”.

Change the numeric The post function fs and fs2 are used to define the numeric format for numeric variables. These are
format of a numeric assigned to the numeric variable label with the post function ‘fmt’. First, determine the numeric variable
variable name that you want to modify. Search for the variable name in the post and see if it is in a format
assignment (you may need to create a format assignment for the numeric variable). For example, to use
feed:

fmt F 15 feed #Feed rate

The third parameter (second if there were no prefix) indicates that the format assignment is from format
statement number 15. Now search for Format statement number 15 and find:

fs2 15 0.2 0.1 #Decimal, absolute, 2/1 place

Refer to Numeric Variables for information on modifying the numeric format.

Change the prefix of a Following the procedure used in “Change the numeric format of a numeric variable”, stop at the
numeric variable point where you found the format assignment. Between the keyword ‘fmt’ and the format statement
number is the optional prefix string. In the above example, you can replace F with E:

fmt E 15 feed #Feed rate

to output something like E1.5

Use double quotes if the prefix string has spaces.

Select long code or The usecan… predefined numeric variables control the post executable to determine which process to
canned cycle drilling use. Search for the partial string usecan to find the numeric variable initialization.
output See Working with Drill Cycles for more information.

Change the order of You can change the order of the words output to the NC file simply by rearranging the output statements
words in the NC output on a postline. For example, this line is copied from the postblock plinout:

pcan1, pbld, n, sgplane, `sgcode, sgabsinc, pccdia,


pxout, pyout, pzout, feed, strcantext, scoolant, e

2-24 Mastercam Version 9 MP Post Reference Guide June 2002


Volume 1 Chapter 2 Introduction to MP Post Processors

possible output: N10G1G90X10.Y10.F5.M8

can be rearranged to:

pcan1, pbld, n, ` sgabsinc, sgcode, sgplane, pccdia,


pxout, pyout, pzout, strcantext, scoolant, feed, e

possible output: N10G90G1X10.Y10.M8F5.

Prompt the user for You must declare a user prompt function to display a prompt on the Mastercam screen. In the Definition
information during section of the post customization file, enter a user prompt function. For example:
posting
fq 1 omitseq Enter 1 to omit sequences, 0 to use sequences>

Call the question by inserting “q” with the fq definition number (for example, q1) on a separate postline
in the postblock where you want to prompt the user. pq would be a logical postblock for this user
prompt function call. See How Prompt Questions Work for details.

Control the number of Search for the numeric variable spaces and find this line:
spaces between words
in the NC output spaces :0 #No. of spaces to add between fields

Set the initialization to the appropriate number of spaces (10 is the maximum). Spaces are padded in
front of the output word.

June 2002 Mastercam Version 9 MP Post Reference Guide 2-25


Chapter 2 Introduction to MP Post Processors Volume 1

2-26 Mastercam Version 9 MP Post Reference Guide June 2002

You might also like