102 Intro To MP Post Proc PDF
102 Intro To MP Post Proc PDF
       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
       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.
        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.
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.
       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.
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,
        Following the comma delimiter in the Boolean postline, it is legal to have any statement type except
        another conditional branching statement.
       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.
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.
       See Numeric Variables for more information on modality and its effect on output.
       The MP_EZ post provides string selects for the following:
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.
        See Volume 2, How Subprograms Work and Volume 2, How Lathe Canned Cycles Work for more
        information.
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.
       !    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 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.
        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
       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)
                        # --------------------------------------------------------------------------
                        # 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
                        # --------------------------------------------------------------------------
                        # 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 sg17 plane sgplane #String and string selector definitions for NC
        Postblock area
                        # --------------------------------------------------------------------------
                        # Tool Comment / Manual Entry Section
                        # --------------------------------------------------------------------------
                        ptoolcomment    #Comment for tool
                              tnote = t
                   # --------------------------------------------------------------------------
                   # Start of File and Toolchange Setup
                   # --------------------------------------------------------------------------
                   psof0           #Start of file for tool zero
                         psof
        !   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.
         !   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
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
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
                              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.
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:
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 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
Next search for the post function ‘flktbl’ and find this line:
A lookup table equates the spindle speed to gear range value. The postline here:
                         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.
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:
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:
                         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:
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:
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:
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.