Sunteți pe pagina 1din 160

Section One

Pro/NC-GPOST BASIC INFORMATION

1
– page intentionally left blank –

2
1. Introduction

Pro/NC-GPOST Modules

Pro/NC-GPOST consists of two modules: Optfile and GPOST

 Optfile is an interactive program that builds an option file containing information


entered about one or more numerically controlled (NC) machines and their
controllers.

 GPOST uses this option file, along with the cutter location (CL) files generated by
Pro/NC, to produce the final NC tapes for each particular machine.

Pro/NC

CL File

Pro/NC-GPOST

GPOST
GPOST Optfile
Optfile

Option File
NC Tape Verification
List
UNCX01

NC Machine & Control

3
1. Optfile

This module enables the user to create a specialized post-processor file to generate output
that meets the requirements of each machine-tool/machine-control combination.

A post-processor is generated by supplying the machine configuration, control codes, date


format, and other machine control parameters through a dynamic menu interface with
context sensitive help.

Because the Option File Generator is menu driven, there is easy access to all the available
parameter settings. Options can be selected in any order, and only those default values not
agreeing with the control or machine description need be selected and changed. Also, one
post-processor can be used to create another, making the creation of additional ones fast
and easy. While creating a post-processor, the on-line, context sensitive help explains the
selected menu option and facilitates setting the parameters.

This module is used only when creating new post-processors or when modifying existing
ones.

4
Optfile can be started in several ways:

 From Pro/ENGINEER, using the Applications pull-


down menu

 From Pro/NC, with the PProcessor option in the Mfg.


Setup menu

 From an external shell, by typing the Pro/NC-GPOST run-command


entered during the product installation (e.g. optfile). Optionally, this
command may contain a special qualifier specifying the directory to be
used to store post-processors (e.g. optfile –db:C:\training\gpost)

NOTE: It is preferable to use the third option, since it can give you access to both
Pro/NC-GPOST and Pro/NC at the same time.

Optfile is writing an Option file called UNCL01.Pnn (for a Lathe) or UNCX01.Pnn (for a
Mill or a wire EDM). The nn in the file name represents the machine number you assign
to when you initialize the Option File Generator.

If you choose to utilize the advanced features of FIL (Factory Interface Language), an
additional file will be created using the same file naming convention but the file extension
will begin with an F.

For example, to use FIL with a Mill post-processor, you would have an option file
UNCX01.pnn and a filter file UNCX01.Fnn. These files are ASCII files and can be edited
using any standard editor.

5
2. GPOST

GPOST uses the information about the NC machine defined in the Questionnaire in
order to convert the points and vectors of a Cutter Location (CL) file generated by
Pro/NC into the joint locations and machine codes of an NC control tape file. The CL file
is the only input for GPOST.

GPOST outputs an NC control tape file, which is ready for either punching to paper tape
or transmission to the NC machine via DNC network. The actual transmission process is
controlled by other software (DNC software). GPOST also outputs a verification listing
which can be used by the NC programmer to check for problems, and by the NC
machine operator to follow the program’s progress.

GPOST can only be started from Pro/NC. There are two ways to post-process a CL file:

 As the CL file is generated (CL Data  Output  Operation or NC Sequence 


File), Pro/NC presents a checklist containing two options: CL File and MCD
(Machine Control Data). By selecting both options, the CL file will be created and
post-processed in a single step.

 Once a CL file has been created and it is only required to be post-processed, the
Post Process option can be selected in the CL Data menu.

6
In either case, a new checklist entitled PP Options will be shown next, allowing you to
select various options for GENER. These options are:

 Verbose If used, GPOST will output information in a window display. This option is
usually pre-selected by default.

 Trace This option controls whether GPOST should output CL record tracing
information in the verification listing file. It is also pre-selected by default.

 MACHIN The software requires the selection of an existing post-processor in the


database. By using this option, the post-processor will be selected based on the
manufacturing parameters used in the generation of the CL file (i.e. MACH_NAME
and MACH_ID). If the MACHIN option is not used, a list of available post-processors
will be presented next, allowing the selection of the desired machine.

7
– page intentionally left blank –

8
2. Option File Generator (Optfile) GUI
This section provides a basic description of the operation of the Windows NT/95/98/2000
interface, used for the Optfile module.

This interface takes advantage of the familiar Microsoft Windows graphical user interface.
The ease to use and intuitive interface makes it possible for anyone to quickly develop and
modify NC post-processor.

The Optfile window is divided in four main areas:

The Pull Down Menus

The Toolbar

Main Menu Area Main Panel Area

9
The Toolbar

The toolbar contains standard shortcuts for frequently used menu commands.
You can hide or show the toolbar using View/Toolbar command.

To identify a button on the toolbar, just point at it to pop up a tooltip (it may take a few
seconds for the tooltip to appear).

Hide/Show Toolbar Tooltip

The toolbar allows you to create a new post-processor, open en existing post-processor,
stop the editing of the current post-processor, save the current post-processor, find help
about specific items, increase and decrease the size of the main panel and cancel the
edit to the current panel.

Active window’s help feature

File New: Select this icon to create a new option file

File Open: Select this icon to open an existing option file

10
File Close: Select this icon to close the current post-processor.

File Save: Select this icon to save the current option file without exiting Optfile.

Help: Select this icon then left-click an item you require more information about.

Decrease Main Panel size: Selecting this icon will decrease the screen size of
the Main panel area.

Increase Main Panel size: Selecting this icon will increase the screen size of the
Main panel area.

Cancel edits to current panel: Selecting this icon will set the current category
back to the original values of the current option file.

The toolbar also displays the option file being edited:

The Main Menu Area

11
The Main Menu Area is used to select different post-processor function categories to
modify. To select a different category just click on the category title and the information in
the “ Main Panel Area” will change to activate selection features associated with the
chosen category.

12
The Main Panel Area

This area will dynamically change according to the current category selected. In some
cases, this section will have multiple tabs available for selection at the top of the main
panel. To select a different sub-panel just click on its tab.

In order to change the information on these pages, several methods may be employed.
To activate a modification mechanism, position the mouse/cursor onto the subject area
or field, then click the left mouse button.

Available modification mechanisms are:

Selection Box: a box presents the current function selection and can be modified by
left-clicking the selection box. A list of choices will appear, in which the current selection
will be highlighted. Move to the desired choice and left-click again.
Your selection will be activated and the list will disappear leaving the new selection
displayed.

“Register box” or “Letter Address box” can be modified by left-clicking the respective
register or letter address. A list of addresses will appear, in which the current selection
will be highlighted. Move the cursor to the desired letter address and left-click again.

13
Your choice will be now activated and the list will disappear leaving the new selection
displayed.

A “Spin Buttons” box can be updated by either clicking on the up arrow or the down
arrow to change the value in the box or by selecting the box with the left mouse button
and typing the value directly.

“Check Boxes” can be updated with a left click.

An “Edit box” can be updated by left-clicking the edit box then typing in the desired
information.

An “ASCII Character Box” can be modified by left-clicking the respective ASCII


character box. An ASCII character table will appear in which the current selection will be
highlighted. Select the desired character by left-clicking it. The character will be
selected, the table will disappear and the selected character will be displayed in the
ASCCI character box.

14
If you wish to use an ASCII character not shown in the table, select “Enter value …”.
You will be prompted for the ASCII character desired. Enter the decimal value and click
the ‘OK” button.

A “Function Code Box” is used to allow the specification of a decimal value to be


output for preparatory (typically G) and auxiliary (typically M) function codes. These
codes can be modified by positioning the mouse/cursor on the selection function’s “edit
box” then clicking the left mouse button. The “Function Code Box” will appear with a list
of available codes where the current selection will be highlighted. Move the
cursor/mouse to the desired code and click the left mouse button again. The code will be
selected, the list will disappear and the selected value will be displayed.

If you select +100, you will be prompted to enter the code value. Type in any value
between 0 and 999 and either press “Enter” Key or use the mouse to select “OK”.

Selecting “Not Required” will instruct the post-processor that no G or M code is to be


output for the post-processor command represented by the function. The post-processor
command will still be processed as if it functions normally, just no code will be output.

Selecting “Not Available” will instruct the post-processor that this particular function
does not exist in the post-processor. Subsequent use of the post-processor command
the function represents will invoke a warning message from the post-processor.

15
The Minimize, Maximize and Exit buttons

There are two sets of these buttons active while using the Option file Generator. The
first is located in the upper right hand corner of the Option File Generator main screen
and is used for minimizing, maximizing and exiting from the Option File Generator.

The other set is located in the upper right hand corner of the Main Panel and is used for
minimizing, maximizing and exiting the current option file being modified. It will not exit
the Option File Generator.

Emailing Post-processor Files

A Send button is available in the File menu to start your Email system and automatically
attach the current option and FIL files to your email.

16
17
3. Post-processor Function Categories

The Main Menu Area is used to select the various post-processor function categories to
modify. To select a category, simply click on the category title and the information in the
“Main Panel Area” will change to activate selection features associated with the chosen
category.

The Machine Tool Type Panel

This panel allows the user to specify the machine type for which the post-processor
option file will be built.

Once the machine type is specified, other machine type specific ‘tab’ panels are
presented to allow the user to define further specifications such as travel limits, home
positions for each machine axis, resolution of the control, maximum departure and so
forth.

The MCD (Machine Control Data) File Format Panel.

18
This panel provides features to specify the machine register addresses, the order in
which these addresses will be output and the format required for each address by the
NC control. Additionally, it provides the ability to assign an alias address or string for
each register.

A special function is used to rearrange the order of the registers or letter addresses. By
positioning the cursor over the text area to the right of the “Register Alias Box”, a small
hand will appear. Once this hand appears you can hold down the left mouse button and
drag the register, dropping it at the desired new location, thus changing its output order.

The screen will dynamically update to the new order.

19
A “Register Box “or “Letter Address Box” can be modified by clicking on the Register or
letter address. A list of addresses will then appear, where the current selection will be
highlighted. Move the mouse/cursor to the desired letter address and left-click it. The
choice will be selected and the list will disappear.

To set the format of a letter address, select the “Set Format” and the following dialog box
will appear:

Use the spin buttons to adjust the “left of the decimal” and “right of the decimal” output
for inch and metric. Use the check boxes to specify the output of the leading zeros,
trailing zeros, plus sign and the decimal point. To set the format on a different letter
address register, click on the letter address in the left hand corner of this dialog box and
the letter address selection box will allow you to select another letter address. When
you have finished formatting the letter address select the “Close” button.

An Alias for every address can be defined. You may enter up to eight ASCII characters.

The List File Format Panel.

This panel provides features to control the characteristics of the verification listing (.lst
file) such as the number of lines to be printed per page, whether post-processor
warnings are to be printed and whether the CL data points must be included.

20
21
The Sequence Numbers Panel

This panel provides features such as the minimum, maximum and incremental values to be
used for the machine control data sequence numbers. Other features include switches for
“Block Delete” options and whether sequence numbers are to be included on operator
comments output by the INSERT or PPRINT post-processor statements.

The Preparatory/G Codes Panel

This panel provides features allowing the definition of preparatory codes (i.e. G-codes) for
functions such as linear interpolation, axis preset, inch/metric mode, absolute/incremental
mode and automated machine cycles.

It also allows to specify if multiple preparatory codes are allowed on a single machine
control data block.

22
The Auxiliary/M Codes Panel

This panel provides features allowing the definition of auxiliary codes (i.e. M-codes) for
machine control functions such as STOP, OPSTOP, END, REWIND, and whether multiple
auxiliary codes are allowed on a single machine control data block.

23
The Coolant Auxiliary/M Codes Panel

This panel provides features to define the auxiliary/M-codes to control coolant


operations.

The Circular Codes Panel

This panel provides features to define the preparatory/G codes, as well as other
characteristics required to perform circular machine motion.

These features include the methodology used to define circular CL data records and
other control requirements such as the maximum circular departure.

24
The Rapid Motions Panel

This panel allows the definition of the preparatory code, as well as other information,
required to perform rapid traverse motions.
It also provides features to control the output of these moves, such as the motion analysis
feature.
Motion analysis is a post-processor safety feature. When activated, the post will analyze all
the rapid traverse motions in order to determine whether the spindle is advancing or
retracting. When advancing, the X and Y axis motion will be output in a block by itself, prior
to the block containing the Z-axis motion. When retracting, the post will output the Z-axis
motion in a separate block, prior to the block containing the X and/or Y motion. This way the
post-processor maximizes the probability of fixture/clamp avoidance.

The Feedrates Panel

This panel provides features to define feedrate preparatory codes, minimum and
maximum feedrates, inverse time feedrate calculation methods (if required by your
control) and other feedrate related functions.

25
The Dwell Parameters Panel

This panel provides features to define preparatory codes for the NC machine dwell
function, as well as the required address registers and minimum and maximum values.

The Spindle Codes Panel

This panel provides features to define spindle code handling methodology, spindle
ranges, auxiliary spindle function codes and spindle limits.

26
The Motion & Cycles Panel

This panel provides features to define extraneous functions for canned cycle capabilities
such as motion analysis, repetition of identical points, special cycle address registers
and so forth.

The Tool Change Sequence Panel

This panel provides features to define special tool change functions such as tool change
coordinates (if required), whether or not to output special tool change blocks and tool
length preparatory codes.

27
The Fixture Offset Panel

This panel provides a feature to define the fixture offset G code or registers address.
A switch allows to control the output of the fixture compensation command.

28
The Startup Defaults Panel

This panel provides features to format the machine control data file for either a DNC
(Distributed Numerical Control) environment or preparation for being punched into tape.
It also allows the definition of the preparatory/G codes required to be output by default at
the beginning of a machine control data file (e.g. inch/metric mode, absolute/incremental
mode, default feedrate mode and default circular interpolation plane).

User Defined startup blocks can also be defined to be included at the beginning of the
tape.

The Cutter Compensation Panel

This panel allows the definition of the preparatory codes required for cutter diameter
compensation (CUTCOM), as well as the type of compensation used by the machine
control.

29
The Operator Messages/Insert Panel

This panel provides features to define the characteristics required to include operator
comments in the machine control data file.

30
The Common Variables Panel

This panel provides features that allow the user to access and set the internal variables
of the post-processor.
Those users experienced with building post-processors will find the PLABEL functions
accessible through this panel.
There is also a ‘search’ feature that will allow the user to browse the
post-processor’s document containing internal variable definitions and
usage.

The FIL (Factory Interface Language) Panel

This panel provides a simple editing window that reads/writes the FIL file (filter file) to be
associated with the current option file.

31
When creating and saving a post-processor, the Option File Generator will prompt for an
option file number to be associated with the post-processor being saved. The resulting file
will be named uncx01.pnn (milling) or uncl01.pnn (turning) where nn is the number
chosen by the user.

When a FIL file is created in the editing window and the user chooses to save the file,
the Option File Generator will automatically save the FIL file as uncx01.fnn (milling) or
uncl01.fnn (turning), where nn is the same number as the one assigned to the option
file.

32
4. Post-processors and the Pro/MFG Parameters

This section illustrates the relationship between various Manufacturing Parameters available in
Pro/NC and the post-processor output. Since the configuration of a post-processor (including
its customization) is used systematically every time a CL file is being processed, any option
specific to a particular manufacturing sequence must be defined inside Pro/NC. Examples may
include: applying and removing the cutter diameter compensation, selecting the appropriate
fixture origins, starting the coolant and displaying tool and/or NC Sequence comments.

Furthermore, the Customize option in the Pro/NC NC Sequence menu allows for a variety of
post-processor commands to be inserted in the CL file as additional input for the post. This
requires a certain knowledge of the available post-processor words and syntax, documented in
the G-POST Generalized Post-processor manual.

1. Manufacturing Parameters:

Most manufacturing parameters are used to control the tool path geometry. Implicitly, they
have a considerable impact on the tool motions produced by the post. There are however
a few parameters used to control the post-processor commands generated in the CL file.
Their influence is more obvious on the resulting G & M codes. These parameters are
included in the FEED and MACHINE categories of the NC Sequence Manufacturing
Parameters table. Here are a few of them:

 CUT_FEED controls the F-code value for cut motions


 PLUNGE_FEED controls the F-code value for plunge motions
 CUT_UNITS feedrate units G-code for cut motions (uPM / uPR)
 PLUNGE_UNITS feedrate units G-code for plunge motions (uPM / uPR)
 SPINDLE_SPEED controls the S-code value in current spindle units
 SPINDLE_SENSE controls spindle direction: M3 (CW) or M4 (CCW)
 MAX_SPINDLE_RPM generates G50 or G92 codes for turning
 SPEED_CONTROL spindle units G-codes for turning (RPM / CSS)
 SPINDLE_RANGE selects the spindle gear (M-code) if available
 LINTOL linearizes combined moves for 4- or 5-axes milling
 COOLANT_OPTION generates M-code for FLOOD, MIST, TAP or THRU
 CUTCOM if set to ON, enables CDC (G41 or G42 code)
 CUTCOM_REGISTER selects a diameter offset number if available
 FIXT_OFFSET_REG selects a fixture origin (G54 – G59 or register)
 OSETNO_VAL selects a tool length offset number if available

2. The PPRINT Table:

In order to display various information on the model as CRT messages in the output file
(e.g. operation names and/or comments, NC Sequence names and/or comments, tool
names and/or comments), a PPRINT Table must be set in Pro/MFG (Mfg Setup  CL
Setup  PPRINT  Create). All the desired options must be set to Yes. This will insert
the required information in the CL file as PPRINT records.

33
The post-processor could then output these records as CRT messages provided that
the display has been turned on using a DISPLY/ON command. This command is modal
(therefore, once stated, it will stay in effect until cancelled).

You can also set the output of all PPRINT to the tape file in the Operator Msgs/Insert
panel.

3. The Customize menu:

Along with various options allowing the customization of the toolpath, this menu also
offers the possibility to insert a post-processor command anywhere in the CL file.
Post-processor commands can be typed manually or selected from different menus:

34
35
5. CL File Records and Post-processor Vocabulary

Each line in a CL file generated by Pro/NC consists of one record. All records are
composed of a major word, optionally followed by one or more arguments which can be
either minor words, numeric expressions or character strings. Some major words do not
require any arguments (e.g. RAPID, GOHOME, STOP, OPSTOP, END, FINI).

Major and minor words are represented internally by numeric expressions. Inside the CL
files, these words are generated using aliases. An alias is an explicit English word or its
abbreviation of max. 6 characters, describing a specific record (e.g. CYCLE, TURRET,
GOTO, CUTTER, UNITS, COOLNT, LOADTL, etc). During post-processing, all aliases
are replaced by their numeric values. A major word will be replaced by its numeric class
and its subclass, separated by a colon (e.g. a COOLNT record will be represented as
“2000:1030”); a minor word will be replaced by its numeric code (e.g. the minor word ON
becomes “71”).

There is a predefined set of major and minor words supported by Pro/NC-GPOST.

Pro/MFG CL records can be classified in three categories:

 Motion records (e.g. GOTO, FROM, GODLTA, CIRCLE)


 Post-processor commands (e.g. PARTNO, LOADTL, FEDRAT, SPINDL, CYCLE)
 Environment control records (e.g. TOLER, CUTTER, MULTAX, UNITS, FINI)

Motion statements (class 5000 records) cause the tool to move from its current location
to a new one and/or to modify the orientation of the tool axis with respect to the part.

36
GOTO and FROM records are defined either by three (x,y,z), or six (x,y,z,i,j,k) numeric
arguments. The x,y,z triplet identifies the X, Y and Z coordinates of the new tool location;
i, j and k define a vector identifying the tool axis orientation. If they are not specified, the
tool is considered by default as being parallel to the Z-axis.

CIRCLE records use seven arguments and must be followed by at least one GOTO.
The syntax is as follows:

CIRCLE / xc, yc, zc, xv, yv, zv, rc


GOTO / xe, ye, ze [ , i, j, k ]

The xc,yc,zc parameters identify the circle center point. The xv,yv,zv parameters define a
vector parallel to the circle axis, as well as the direction of rotation of the circle (using the
left hand rule). The rc parameter specifies the radius. The xe,ye,ze arguments of the
subsequent GOTO record identify the end point of the circle.

Post-processor commands (class 2000 records) are used to control various processing
parameters of the post-processor and of the NC machine.

Here after is a brief summary of the most common post-processor commands


generated by Pro/NC:

PARTNO / part_description

MACHIN / name , id_number

PPRINT / string

LOADTL / pocket_nb [ , OSETNO , offset ]

TURRET / station_nb [ , XAXIS , x_offset , ZAXIS , z_offset ]

SPINDL / RPM , value , CLW [ , RANGE , LOW ]


SFM CCLW MEDIUM
SMM HIGH
number
SPINDL / OFF

FEDRAT / value , IPM


IPR
MMPM
MMPR

RAPID

SET / OFSETL , fixture_nb


SET / OFSETL , OFF

CUTCOM / LEFT
RIGHT

37
CUTCOM / OFF

CYCLE / DRILL , DEPTH , depth, IPM , feed , CLEAR , cl_plane


FACE IPR
TAP
BORE
BRKCHP
DEEP

CYCLE / OFF

Environment control records are used to control special settings in the post-processor.
The following commands are generated by Pro/NC:

INTOL, OUTTOL, TOLER, CUTTER and LINTOL (class 6000) require a single numeric
argument. These commands can be used to specify tolerances or the cutter diameter.

UNITS and MULTAX (class 9000) require a single minor word. The UNITS command is
always output at the beginning of the CL file. Its arguments are either INCHES or MM.
MULTAX is used to indicate whether subsequent motion records use vector information.

FINI (class 14000) does not require any arguments. This record occurs only once, at the
end of the CL file, identifying its end-of-file status.

38
– page intentionally left blank –

39
6. Introduction to the Factory Interface Language (FIL)

6.1. FIL General Information


GPOST’s Factory Interface Language (FIL) command language is a set of programming
tools allowing for enhancements of the post-processor’s capability. This section provides
a basic description of some of the most important FIL commands and functions, along
with its available computing capabilities such as the logic flow, text handling capabilities
and geometric definitions.

FIL can be used for the following tasks:

 To alter the post-processor output


 To add or modify post-processor vocabulary words
 To read or write data in external ASCII files (up to two files)
 To call other applications

These tasks can be accomplished by writing a filter file called UNCL01.Fnn (for lathes)
and respectively UNCX01.Fnn (for mills, punch presses and wire EDMs), where nn
represents the machine number used for the current post-processor option file. For
example, if FIL is used with a lathe post-processor saved under option file number 10,
the software will save an option file UNCL01.P10 and a filter file UNCL01.F10.

The filter file is used by FIL to insert data into the post-processor:
FIL is a

CL File

FIL

UNCL01.Fnn Lathe MULTAX UNCX01.Fnn

UNCL01.Pnn
G-Post G-Post UNCX01.Pnn

MCD File

powerful addition to G-Post. Therefore, as any high-powered tool, it should be


used with caution. We recommend it only to experienced users, who fully
understand its implications.

40
There are four main applications for FIL:

 Adjust the input syntax


 Modify the processing of a CL file command
 Support non-standard functions on NC machines
 Account for any output not supported by the Optfile questionnaire.

Like any programming language, FIL is composed of:

 Variables
 Labels
 Operators
 Functions
 String Manipulation Functions
 Logic Statements
 Macro definition
 CL Commands
 File I/O
 Specialized Post-processor functions (POSTF)

6.2. Syntax of the FIL File


A FIL file consists primarily of two sections: the global area and the FIL subroutines.
Essentially, anything not enclosed in a FIL subroutine is considered as being in the
global area. Anything defined in the global area is initialized at the beginning of the post-
processor execution and is available for use by any of the FIL subroutines.

The syntax used for the definition of a FIL subroutine is:

CIMFIL / ON, major_word or CIMFIL / ON, type [ , subtype ]





CIMFIL / OFF

A major_word is any APT command in the CL file. Alternatively, a major word can be
defined using its CL record type or class (e.g. 2 for a post record, 3 for a circular move,
5 for a linear motion, 14 for FINI, etc.), and optionally by its subtype. If the subtype is
omitted, the subroutine will match only the record type.

The CIMFIL/OFF command terminates the subroutine and returns the control to GPost
to resume the processing of the CL file. Its usage is optional, since the next CIMFIL/ON
turns off the current subroutine.

There is no limit to the number of FIL subroutines defined in a FIL file, as long as each
subroutine is unique. In other words one cannot have two FIL routines for the same CL
record.

41
If a subroutine is defined in the FIL file for a particular major word (or type), the normal
processing of that respective major word is altered. Whenever GPost will encounter the
respective word in the CL file, it will pass the control to the filter file, to process whatever
commands have been included in the FIL subroutine (i.e. all information found between
the CIMFIL/ON and the CIMFIL/OFF statements).

Before reading the first CL record, FIL performs a syntax check on the filter file. If no
errors are found, the file is processed normally. If there are errors, the file is processes,
but the post output may contain unexpected results. It is therefore highly recommended
to review the LIST file for possible error messages.

After the syntax check, FIL performs a logical execution of all the FIL statements in the
global area (i.e. outside any FIL subroutines). This enables the initial setup of all the
necessary global variables. If any macros are defined, it is recommended to also include
them in the global area – up front, outside the FIL blocks.

The following example illustrates this:

PRINT/ON $$ Statements outside the FIL block
FIRST=0 $$ are executed once.
RESERV/A,10 $$ Declare an array
Global 
Area M1=MACRO $$ Create a macro
. . . . .
TERMAC

CIMFIL/ON,COOLNT $$ Begin FIL subroutine
FIL  $$
Blocks  $$ This FIL subroutine is used to ignore 
Area $$ all COOLNT commands in the CL file
$$
CIMFIL/OFF          $$ End FIL subroutine

The FIL processor reads the first 72 columns in a line, any data entered beyond 72 is
ignored by FIL.

The SYN command (synonym) allows the creation of alternate FIL vocabulary spellings.

Its format is as follows:

SYN / new spelling, vocab, new spelling, vocab, …

For example:

SYN / CM, CIMFIL, MC, MACRO

42
6.3. Variables

6.3.1. Basic Information

The FIL language supports the following types of variables:

 Real numbers (12.1, 4, 0.1234, 1234)


 Strings (‘PROGRAM NUMBER’, ‘1.000 END MILL’)
 Geometric symbols (POINT, VECTOR)

Variable names consist of up to six alphanumeric characters, at least one of


which must be alphabetic. For example:

TOOLNM=TEXT/’1/4” BALL END MILL’
NTOOL=12
V1=VECTOR/0,0,1
P1=POINT/1,2,3

6.3.2. String Definition

The TEXT statement assigns a variable name to a string of characters. Once


defined, a string variable symbol can be subsequently referenced in statements
that use character data, such as PARTNO, PPRINT, and INSERT, or in other
TEXT statements. TEXT can be defined as a single string of characters or as a
composite string consisting of two or more substrings:

symbol=TEXT/string
symbol=TEXT/string_1, string_2, ---, string_n

A string in a text definition can be specified in three ways:

 As a literal string between quotes.


 By the symbol assigned to it in a previous text definition.
 As a scalar that is to be converted to a string.

For example:

T1=TEXT/’CHANGE TOOL’
T2=TEXT/’CHANGE ’,’TOOL’
T3=TEXT/T2,’ 12’

The REPEAT modifier will cause character(s) to be repeated n times:

REPEAT, n, ‘characters’

43
For example to put 30 spaces before a string:

T1=TEXT/REPEAT,30,’ ’,’START SPINDLE’

6.3.3. Array Definition

The RESERV statement allows the definition of a variable as a unidimensional


array. This statement can only be included in the global area of a FIL file (i.e. not
within a CIMFIL/ON – CIMFIL/OFF routine).

The format of a RESERV command is:

RESERV / variable_name, array_size, variable_name, array_size, ~

For example:

RESERV/TOOLID,30, TOOLNM,30
TOOLID(1)=1
TOOLNM(1)=TEXT/’1/2 BALL END MILL’

6.3.4. Redefinition of Variables

In order to avoid errors resulting from the unintentional reuse of a variable name,
FIL normally diagnoses an error when a geometric or text variable is reused.

REDEF / ON-OFF indicates whether variable redefinition is permitted.

6.3.5. Geometric Definition

Geometric definition statements are used to define CL points and vectors within
FIL for execution by the post-processor. The formats available are:

name = POINT / x, y, z
name = VECTOR / x, y, z

For example:

P1=POINT/1,2,3
V1=VECTOR/0,1,0
RAPID
GOTO/P1,V1

44
6.3.6. CANON Definitions

In addition to the regular methods that are available for defining geometric
entities, a CANON definition may be used to define an entity directly in terms of
its canonical elements or in terms of modifications to be made to a previously
created canonical form.

A CANON definition always permits redefinition of a symbol even though


redefinition has not been enabled (by REDEF/ON) for regular definitions.

Type / symbol, CANON, canonical elements

In this format, type is a major word indicating the canonical form type - POINT, or
VECTOR.

The symbol represents a previously defined entity of the same type.

The canonical form denoted by the symbol serves as the base canonical form for
the new definition. Values are given for canonical elements that are to be
different from those in the base canonical form. Values replace elements on a
positioned basis - the value in the first position replaces the first element in the
base canonical form, etc. A comma is used to space over a position where the
element is to retain its base value. Trailing commas following the last specified
value are unnecessary but permissible.

Examples:

P1=POINT/6,4,8
P2=POINT/P1, CANON,7 $$(P2 = 7, 4, 8)
P3=POINT/P1, CANON,,9 $$(P3 = 6, 9, 8)
P4=POINT/P1, CANON,,,3 $$(P4 = 6, 4, 3)

6.3.7. The DATA Statement

The DATA statement allows the input of several data items that vary from one
use of the program to another within a single statement.

The format of a DATA statement is:

symbol = DATA / entry 1, entry 2,--, entry n

The minimum number of entries allowed is one; the maximum is 82.

Each entry can be a scalar, a vocabulary word, or a previously defined symbol.

When entry is the symbol for a canonical form, the elements of the referenced
canonical form replace the symbol in the DATA canonical form. Thus, a DATA

45
statement generates a canonical form composed of scalars and/or vocabulary
words.

Examples:

D1 = DATA / 9, 10, 11 $$ canonical form is 9, 10, 11
D2 = DATA / 15, IPM  $$ canonical form is 15, IPM
D3 = DATA / D1, 20, 21 $$ canonical form is 9, 10, 11,
 $$ 20, 21

The appropriate names can be assigned to the scalars in a DATA canonical form
by using OBTAIN or CANF.

For example, suppose that a FIL is written to handle similar configurations, the
only difference among the members being that six particular dimensions can
vary. These dimensions are referenced in the body of the FIL routine by the
symbols A, B, C, D, E, F.

The dimensions for a particular configuration are input in a DATA statement:

D 1 = DATA / 1.5, 3.75, 2.5, 5, 6.2,10

An OBTAIN statement then sets the symbols to the values of the DATA
canonical elements:

OBTAIN, DATA / D1, A, B, C, D, E, F

In some applications, it is desirable to be able to vary the number of elements in


a DATA statement from one use to another. FIL permits this by not regarding it as
an error if more symbols are included in the OBTAIN statement than there are
elements in the DATA canonical form. The excess symbols are simply ignored.

An alternative method of using DATA is provided as follows: A DATA symbol can


be referenced to the right of the slash in a statement where a series of scalars
and/or vocabulary words would normally appear. The effect is the same as if the
elements of the referenced DATA canonical form appeared explicitly in place of
the symbol.

Examples:
D1= DATA/1, 2, 3
P1=POINT/D1 
is equivalent to 
P1= POINT/1, 2, 3

SD= DATA/200, RPM, CLW
SPINDL/SD
is equivalent to 
SPINDL/200, RPM, CLW

FD=DATA/.1, IPR

46
FEDRAT/FD 
is equivalent to
FEDRAT/.1, IPR

RESERV / D, 4
  D(1)=DATA/500,SFM
D(2)=DATA/CLW
D(3)=DATA/RANGE,2
D(4)=DATA/MAXRPM,3000

SPINDL/D(1, THRU, 4)
is equivalent to
SPINDL/500,SFM,CLW,RANGE,2,MAXRPM,3000

You can indicate that only selected elements of the DATA canonical form are to
be used by specifying the following after the DATA symbol:

RANGE, m, n

m is the number of the first element to be used and n is the number of the last.

Example:

D1 = DATA/1, 5, 6.5, 10, IPM, 300
FEDRAT/D1, RANGE,4,5
is equivalent to
FEDRAT/10, IPM

SPINDL/D1, RANGE, 6,6
is equivalent to
SPINDL/300

6.3.8. The OBTAIN Statement

The OBTAIN statement can be used to extract scalars from a canonical form and
assign symbols to them. Its format is:

OBTAIN, type/canon symbol, scalar symbols

Type is a major word indicating the canonical form type - POINT, VECTOR, or
DATA.

Canon symbol is the symbol of a canonical form of the specified type.

The scalar symbols are the symbols to be assigned to the elements of the
canonical form. The number of scalar symbols can be as small as one and as
large as the number of elements in the canonical form.

47
Symbols and elements are matched according to their position - the symbol in
the first position is assigned to the first element, etc. It is not necessary, however,
to assign a symbol to every element. A comma can be used to space over a
position whose corresponding element is not to be assigned a symbol. Trailing
commas following the last symbol are not necessary but are permissible.

The usage of this feature requires a knowledge of the order and the significance
of the elements of canonical forms.

Examples:

P1 = POINT/3, 8, 5
OBTAIN, POINT/P1, A, B, C $$ (A=3, B=8, C=5)
OBTAIN, POINT/P1, A $$ (A=3)
OBTAIN, POINT/P1, A,, $$ (A=3)
OBTAIN, POINT/P1,,B $$ (B=8)
OBTAIN, POINT/P1,,B,C $$ (B=8, C=5)
OBTAIN, POINT/Pl,,,C $$ (C=5)

6.4. Labels
You can attach a label to a statement and subsequently refer to that statement by using
its label. (Statement types that refer to other statements include IF and JUMPTO). Like
any regular symbol, a label can consist of from one to six alphanumeric characters, but
unlike a regular symbol, all the characters can be numeric.

Example:

S1) GOTO/1,1,0
A) FEDRAT/01,IPM
456) B = 10 / 2 * (3+4)

6.5. Operators

The following operators are supported:

 Scalar assignments: Symbol=Number


 Arithmetic Operators: + - / * ** ( )
 Logical Operators: .AND. .OR. .GT. .GE. .LT. .LE. .EQ. .NE. .NOT.
 $$ is a comment line or can be used to indicate the end of the current statement prior
to column 72. For example: COOLNT/ON $$ Start coolant
 $ at the end of a line indicates continuation on the next line

48
6.6. Functions
The FIL language has several built-in functions:

Function Descritpion Example


ABSF(n) Absolute value of a real A=-30
B=ABSF(A) $$ B=30
ANGLF(point1,point2) Angle between two points A=POINT/0,0,0
B=POINT/1,1,0
C=ANGLF(A,B) $$ C=45
ANGLF(vector) Angle of the vector A = VECTOR/ 1 , 1 , 0
B = ANGLF(A) $$ (B = 45)

ATANF(tangent) Arc Tangent of an angle A=1


B=ATANF(A) $$ B=45
ATAN2F(y,x) Arc Tangent given 2 A=ATANF(0,1) $$ A=0
arguments A=ATANF(1,-1) $$ A=135
CANF(string,1) Returns the number of T1=TEXT/’HELLO
charaters in string. N=CANF(T1,1) $$N=5
CANF(symbol,n) Return element n of the P1=POINT/13,24,35
symbol X1=CANF(P1,1) $$ X1=13
CMPRF(string1,string2) Compare two strings (0:no TA=TEXT/’AB’
match, 1:match) TB=TEXT/’CD’
C=CMPRF(TA,TB) $$C=0
COSF(angle) Cosine (degrees) A=-30
B=COSF(A) $$ B=.86603
DISTF(point1,point2) Distance between 2 points P1=POINT/1,4,0
P2=POINT/5,7,0
D1=DISTF(P1,P2) $$D1=5
DOTF(vector1,vector2) Dot product of 2 vectors A=VECTOR/2,3,0
B=VECTOR/4,1,0
D=DOTF(A,B) $$D=11
EXPF(real) Exponential A=EXP(.69315) $$A=2
ICHARF(string) Conversion from character T=TEXT/’A’
(ASCII value) V=ICHARF(T) $$V=65
ICODEF(word) Integer code of a post word T=ICODEF(CLW) $$T=60
INDXF(string1,string2) Index of a sub-string T1=TEXT/’ABCD’
T2=TEXT/’C’
P=INDXF(T1,T2) $$P=3
INTF(real) Truncation to whole number A=INTF(2.9999) $$A=2
A=INTF(-7.999) $$A=-7
LNTHF(vector) Vector length V1=VECTOR/3,0,0
A=LNTHF(V1) $$ A=3
LOGF(real) Natural logarithm (base e) A=LOGF(2) $$A=.69315
MAXF(real1, real2, …) Largest value A=4.7

49
B=-5.6
C=MAXF(A,B) $$C=4.7
MINF(real1,real2, …) Smallest value A=2.3
B=-1
C=MINF(A,B) $$C=-1
MODF(real1,real2) Remainder A=123.45
B=MODF(A,10) $$B=3.45
SCALF(string1) Converts a string to real TA=TEXT/’12.4’
V=SCALF(TA)+1 $$V=13.4
SIGNF(real1,real2) Applies the sign of real1 to A=123.4
real2 B=-12
C=SIGNF(A,B) $$C=-123.4
SINF(angle) Sine (degrees) A=30
B=SINF(30) $$ B=.5
SPWNF(string) Spawns a sub-process
SQRTF(real) Square root A=100
B=SQRTF(A) $$B=10
TANF(angle) Tangent (degrees) A=45
B=TANF(A) $$B=1

6.7. String Functions

The TEXT statement used in conjunction with a series of special keywords, allows for
various string manipulation operations.

6.7.1. Search and Replace:

The MODIFY function enables you to perform a search/replace action on a


string. The syntax is as follow:

tl = TEXT/MODIFY,t2,t3,t4,n1

tl: New modified string


t2: Old string to be modified
t3: Target string
t4: Replacement string
nl: Number of times to replace the target string (use 0 to replace all
occurrences)

For example:

T2=TEXT/’N001G01X5C-4’
TA=TEXT/’C’
TB=TEXT/’B’
T1=TEXT/MODIFY,T2,TA,TB,0 $$ Change C to B in string
T2

50
6.7.2. Removing Blanks

The OMIT function enables you to remove blank from a string. The syntax is as
follow:

t1 = TEXT/OMIT,t2,n1

t1: New modified string


t2: Old string to be modified
n1: Remove blanks in t2 and return in tl

n1: = 1 Remove trailing blanks


n1: = 2 Remove leading blanks
n1: = 3 Remove all blanks

In this example, we remove the trailing blanks from the text string.

TA = TEXT/’ABCDE bbbbbbb ‘
TB = TEXT/OMIT,TA,1      $$ TB will be 'ABCDE'

6.7.3. Extracting a Substring

The RANGE modifier allows you to extract a portion of a string. The syntax is as
follow:

t1 = TEXT/RANGE,t2,n1,n2

t1: New modified string


t2: Old string to be modified
n1: Starting location in t2
n2: Ending location in t2

Substring of t2 returned in t1.

Example:

TA = TEXT/'ABCDEFGHIJK'
TB = TEXT/RANGE,TA,3,5         $$ TB will be 'CDE'

6.7.4. Adding a Non-printing Character

51
The CONVS modifier enables you to add non-printing characters to a text string.
The syntax is as follow:

T1 = TEXT/CONVS,n

n Any scalar that specifies the desired ASCII character.

For example.

T1 = TEXT/’ABC’,CONVS,4   $$ EOT used by Maho

6.7.5. String Conversion Modifiers (Text Formatting)

The string conversion modifiers CONVI, CONVF and CONVE allow for the
conversion of a scalar into an explicitly formatted string of characters.

a) CONVI: Conversion to Integer

CONVI,scalar, n

CONVI indicates that the specified scalar is to be converted to a string composed of


n characters. The scalar is truncated before being converted; that is, its fractional
part, if any, is deleted. The resulting string represents an integer value. The string
is right adjusted. A minus sign precedes the numeric characters if the original scalar
is negative. No sign is included for a positive scalar. If fewer than n characters are
required to represent the scalar, the unused positions to the left are filled with
blanks. If more than n characters are required (including the minus sign for a
negative scalar), n asterisks are generated as an error indication.

Examples:

A = 23
B = ­7
C = 125.9

TEXT definition Generated string

T1=TEXT/CONVI,A,2 23
T2=TEXT/CONVI,A,3 b23
T3=TEXT/CONVI,A,4 bb23
T4=TEXT/CONVI,B,3 b­7
T5=TEXT/CONVI,B,2 ­7
T6=TEXT/CONVI,C,4 b125
T7=TEXT/CONVI,C,3 125
T8=TEXT/CONVI,C,2 **

b) CONVF: Conversion to Floating Point

52
 CONVF, scalar, n, d

CONVF indicates that the specified scalar is to be rounded to d decimal places and
converted to a string composed of n characters. The string contains a decimal point
followed by d fractional digits. The string is right adjusted. If the scalar is negative, a
minus sign precedes the numeric characters. No sign is included for a positive
scalar. If fewer than n characters are required to represent the scalar, the string is
filled to the left with blanks. If more than n characters are required (including the
decimal point and the minus sign for a negative scalar), n asterisks are generated
as an error indication.

Examples:

A = 12.3456
B = ­7.654321

TEXT definition Generated string

T1=TEXT/CONVF,A,7,4 12.3456
T2=TEXT/CONVF,A,8,4 b12.3456
T3=TEXT/CONVF,A,8,3 bb12.346
T4=TEXT/CONVF,A,10,5 bb12.34560
T5=TEXT/CONVF,B,9,6 ­7.645321
T6=TEXT/CONVF,B,10,4 bbb­7.6453
T7=TEXT/CONVF,B,6,4 ******

 CONVF, scalar,n,d,sign option, decimal option,zero option

This expanded format for CONVF allows to specify three options for controlling
the inclusion or omission of the sign, decimal point, and leading / trailing zeros.

These options could be useful when the exact format of the string is important;
for example, when the string is being used with INSERT to generate a punched
tape block. The permissible values for these options are:

sign option =0 Include a minus sign for a negative scalar,


no sign for a positive scalar.
=1 Always include the sign - plus for a
positive scalar, minus for a negative scalar.

decimal option =0 Include a decimal point.


=1 Don't include a decimal point.

zero option = 0 Convert leading zeros to blanks.


= 1 Omit no zeros.
= 2 Omit trailing zeros.
= 3 Omit leading zeros and left adjust.
= 4 Omit leading and trailing zeros and left adjust.

53
When the zero option is 2, 3, or 4 and zeros are omitted, the number of characters
in the generated string is less than the specified number by the number of zeros
omitted. You must specify all three options or none of them; either three or six
entries must follow CONVF. If you don't specify the options, the assumed value for
each option is zero.

Examples:

A = 12.3
T1 = TEXT/CONVF,A, 8, 4, 0, 0, ZOP

The following shows the strings generated for various values of a variable ZOP:

ZOP  String

0 b12.3000 Blank leading zeros.
1 012.3000 Omit no zeros.
2 012.3 Blank trailing zeros.
3 12.3000 Omit leading zeros, left adjust.
4 12.3 Omit leading and trailing zeros, left
 adjust.

c) CONVE: Conversion to the exponential notation

CONVE, scalar, n, d

CONVE provides a notation for representing scalars that are too large or small
or whose range of values is too great to be represented by CONVF. It expresses
the scalar S in terms of a fraction F and an exponent E whose relationship is:

S=F*(10**E)

The string generated by CONVE will include an optional minus sign if the scalar
is negative. No sign will be included for a positive scalar. It will also include a
decimal point, followed by a fraction equal to or greater than .1 and less than 1,
rounded to d decimal places. Furthermore, the string will include a plus or minus
sign indicating the sign of the exponent, and the two-digit exponent.

The string is right adjusted; that is, the nth (rightmost) character of the string
represents the units digit of the exponent. If fewer than n characters are required,
the string is filled to the left with blanks. If more than n characters are required,
asterisks are output as an error indication. The number of characters n should
normally be at least 5 greater than d to include positions for the sign, decimal
point, exponent sign, and exponent.

Examples:

54
A = .01236
B = ­.01236
C = .1236
D = 1.236
E = 12360.4

TEXT definition String

T1=TEXT/CONVE, A, 12, 6 bb.123600­01
T2=TEXT/CONVE, B, 12, 6 b­.123600­01
T3=TEXT/CONVE, C, 11, 4 bbb.1236+00
T4=TEXT/CONVE, D, 11, 4 bbb.1236+01
T5=TEXT/CONVE, E, 11, 6 b.123604+05

6.7.6. Current Date & Time

The TIMES modifier generates the current date and time as a string.

Example:

T1 = TEXT/TIMES

This generates a string similar to: 07/24/00 15:04:38

6.7.7. CL File Name

The PART modifier is used to obtain the current input file name in a string.

Example:

Assume that your input file name is test.ncl.1 and that this file is located in a
directory named D:\proe_work\mfg\cldata. A variable TPN, defined as:

TPN=TEXT/PART

will contain the string: D:\proe_work\mfg\cldata\test.ncl.1

55
6.8. Logic Statements

FIL statements are normally processed in the order in which they appear. However, various
commands can be used to control the sequence in which the lines of a filter file are executed.

6.8.1. The Arithmetic IF Statement

The arithmetic IF statement allows the control to be transferred on a conditional


basis, depending on the value of a real. Its format is:

IF (real) label1, label2, label3

FIL tests the real and accordingly transfers to either of the statements designated
by label1, label2, or label3, depending on whether the real is negative, zero or
positive. For example:

IF (A) ST1, ST2, ST3



ST1)

ST2)

ST3)

6.8.2. The Logical IF

The logical IF statement can be used to test a logical expression in order to cause
one of two possible actions to be taken depending on whether the logical expression
is true or false.

IF (logical expression) substatement

IF (logical expression) substatement 1, ELSE, substatement 2

6.8.3. The Logical IF-THEN-ELSE

The logical IF-THEN-ELSE statements can be used to test a logical expression in


order to cause different possible actions to be taken depending on whether the logical
expression is true or false.

IF (logical expression) THEN


substatements
ELSE
substatements
ENDIF

56
6.8.4. Logical Evaluation

A logical expression has the value true or false. The following relational operators
are available:

.LT. less than


.LE. less than or equal to
.EQ. equal to
.NE. not equal to
.GE. greater than or equal to
.GT. greater than
.AND.
.OR.
.NOT.

Examples:

IF(X.GT.0.AND..NOT.(Y.GT.0.AND.Y.LE.10)) THEN
   SPINDL/100,RPM 
   COOLNT/ON
ELSE 
   SPINDL/5600,SFM
   COOLNT/ON
ENDIF

IF(A.GE.1)FEDRAT/10, ELSE, FEDRAT/20

IF(A.LT.B)JUMPTO/S10

6.8.5. The CASE Statement

A CASE statement allows the user to branch to different FIL statements


depending on the value of a variable (real or string). It is similar to a complex IF
block but more versatile.

CASE/variable
WHEN/value
statements

WHEN/value,THRU,value
statements

WHEN/OTHERS
statements

ENDCAS

57
6.8.6. DO Loops

The DO loop provides an automatic mechanism for controlling the repetitive


execution of a series of statements. A DO loop has the following format:

DO / label, do_variable=initial_value, final_value, [incr]




label)

For example:

DO/S1, Y=1.5, 7.5, 2 
  DO/S1, X=2.5, 8.5, 1.5
GOTO/X, Y, 0
GODLTA/0, 0, ­1
S1) GODLTA/0, 0, 1

It is possible to transfer out of a DO loop using a JUMPTO statement. When this


occurs, the DO variable retains the value that it had at the time of the transfer.

6.8.7. The CONTIN Statement

The CONTIN (continue) statement causes no action to be taken by FIL. Its


purpose is to provide a dummy statement to which a label can be attached.
For example:

RESERV/P,50
DO/S1,N=1,50,1
   P(N) = POINT/(N*.5),0,0
S1) 

DO/S2,N=1,50,1
   T=CANF(P(N),1)  $$ T = X VALUE OF POINT
        IF(T.GT.10)THEN
            JUMPTO/S3
      ELSE
GOTO/P(N)
   ENDIF
S2) CONTIN
S3) CONTIN

58
6.8.8. The JUMPTO Statement

The JUMPTO statement is used to program an unconditional jump. Its format is:

JUMPTO / label

Example:

IF( F­10 ) S1, S1, S2
S1) SPINDL/200
JUMPTO/S3
S2) SPINDL/250
S3)

A multiple JUMPTO statement causes a transfer to one of a series of designated


statements, depending on the value of a scalar. Its format is:

JUMPTO / real, label 1, label 2, ---, label n

For example:

M=MACRO/N
JUMPTO/N, S1, S3, S8, S9

S1) ­
­
S3) ­
­
S8) ­
­
S9) ­
­
TERMAC

CALL/M, N=1 $$ JUMPTO S1
CALL/M,N=3 $$ JUMPTO S8
CALL/M,N=5 $$ ERROR ­ ­ NO 5th LABEL

6.8.9. The TIMLIM Statement

TIMLIM/t may be used to detect and terminate endless loops in FIL. The value t is
given in minutes of processing time. If the value t is less than one, the run time is
unlimited, which is the default as before.

The time termination uses the system elapsed time and NOT the cpu time and thus
termination point (ISN) may vary for the FIL file.

59
6.9. Macro definition

You can assign a name to a group of statements and subsequently cause them to be
executed each time you "call' the name. This group of statements will be called a macro.
The syntax is based on the APT macro call technique:

macnam = MACRO/varl, var2, -----, varn


FIL Statements
.
.
TERMAC

The MACRO statement indicates the beginning of a macro definition, establishes the
name, macnam, by which the macro may subsequently be called, and specifies the
names of the macro variables, if any. A macro may have no variables or it may have any
number of variables up to a system limit. If a macro has no variables, then the slash is
optional. The following, for example, are equivalent:

MAC1=MACRO
MAC1=MACRO/

The TERMAC (terminate macro) statement indicates the end of the macro definition.
Between the MACRO statement and the TERMAC statement, you write the regular FIL
statements that comprise the body of the macro.

The statements in the body of a macro are not executed at the time the macro is defined;
they are not executed until the macro is called the first time.

You can cause a previously defined macro to be executed by means of a statement with
the following format:

CALL/macnam, var1=value1, var2=value2, --- varn=valuen

In the above format, macnam is the name assigned the macro in the MACRO statement.
The equations var 1=value 1, etc. assign values to the macro variables. If the macro
has no variables, then, of course, there will be no argument equations.

For example a tool change macro may looks like:

TLCHG = MACRO/ TLN, SPD, FED
LOADTL/ TLN, ADJUST, 1
SPINDL/ SPD, RPM
FEDRAT/ FED, IPM 
TERMAC

Each time this macro will be called, some values must be assigned to TLN, SPD, FED

CALL/TLCHG, TLN=1, SPD=500, FED=10
CALL/TLCHG, TLN=2, SPD=760, FED=24

60
CALL/TLCHG, TLN=3, SPD=50, FED=12

Macro variables can be used for scalars (TLN, FED, and SPD), and vocabulary words
(KUL). Marco variables can also be used for symbols as follows:

TLCHG = MACRO/ TLN, SPD, FED,KUL,HPT
GOTO/HPT
LOADTL/ TLN, ADJUST, 1
SPINDL/ SPD, RPM
FEDRAT/ FED, IPM
COOLNT/KUL
TERMAC

P1 = POINT / 10, 10, 10
CALL/TLCHG,TLN=1,FED=10,SPD=500,KUL=FLOOD,HPT=P1

A macro cannot be defined within another macro, but can be called from within another one.

6.10. CL Commands

The FIL language also supports motions and post-processor commands.

Examples:

RAPID
GOTO / P1          $$ P1 is a point
FROM / 0,0,0
GOTO / 1,1,1
GODLTA/1,1,1
GODLTA/V3          $$ V3 is a vector
GOTO / 1,2,ZVAL         $$ ZVAL is a real variable
FEDRAT / FED * 1.5      $$ FED is a real variable
LOADTL/TOOL1,OSETNO,TL1+1   $$ TL1 is a real variable

Some special commands are also available:

6.10.1. The PPWORD Command

PPWORD enables users to add post-processor words to the FIL system.

PPWORD / word, IC

where word is the post word and IC is the integer code.

61
6.10.2. The PRINT Command

The PRINT command is used as a debugging tool.

PRINT/ON-OFF

The PRINT/ON statement causes a printout to be produced of each named


scalar value and canonical form as it is generated.

The PRINT/OFF turns off a previous PRINT/ON statement and is the assumed
setting if neither PRINT/ON nor PRINT/OFF is specified.

PRINT/ON,IN-OFF,IN

The PRINT/OFF,IN statement turns off the printout of the FIL file in the LIST file.

The PRINT/ON,IN turns on a previous PRINT/OFF,IN statement and is the


assumed setting if neither PRINT/ON,IN nor PRINT/OFF,IN is specified.

6.10.3. The POSTN Command

This command provides a variable insert to output selected tape codes to the
punch file.

POSTN/IN-OUT, a1,v1, a2,v2..... an, vn [, NEXT ]

where:

a1-an are the required letter addresses and must be 1 through 26 to indicate the
alpha characters A through Z.

v1-vn are the required values to be output with a1-an.

NEXT will output these codes with the next block.

If some data already exists for output, the IN option will combine the POSTN
codes with the existing block and the OUT option will clear the current block and
start a new block for POSTN.

6.10.4. The REPEAT Command

This command is used to output an extra address and value automatically


whenever a specific address is output.

REPEAT / a1, a2, v [ , ON-OFF]

62
where:
a1: 1-26 representing A to Z. This is the address that is used to force output of
the extra address and value.

a2: 1-26 representing the extra address to be output.

V: the value that is to be output with a2.

ON: specifies that a2 and v will be output every time a1 is output. The default
condition is that a2 and v will be output only the next time a1 is output.

OFF: stops a2 and v from being output with a1.

REPEAT / a1,a2,a3,....,a25, t1, v1, ALL

This command is similar to the above REPEAT, except that any of a number of
addresses a1,a2,a3...,a25 may force the output of the address t1 with the value of
v1. This command does not have the ON-OFF option and is used to output an
additional address and value whenever a specific regular address is being output.

a1,a2,a3,...,a25: 1-26 representing A to Z. These addresses are used as triggers


to force output of the extra address t1 and value v1.

t1: 1-26 representing the extra address to be output.

v1 : the value that is to be output with t1.

ALL: specifies that any address a1,a2,a3,...,a25 will force the output of t1 and v1.

REPEAT/a1,v1

This command will output the address a1 with a value of v1 on every block until
REPEAT/OFF is encountered.

a1: 1-26 (A-Z) representing the extra address to be output.

v1: The value that is to be output with a1.

REPEAT/OFF

Turns off all REPEAT commands and clears all stored REPEAT values.

For example to output M8 with the next Z: REPEAT / 26, 18, 8

63
6.10.5. The REPLAC Command

REPLAC is a FIL command that allows users to edit/modify the tape output block
(in a similar manner to a text editor) during the post-processor execution.

REPLAC / t1, t2 [ ,n1, n2 ]

t1 = target string to be modified


t2 = replace string
n1 = number of times to replace the current tape block
n2 = number of tape blocks to replace
If n1=0 or not given, replace all occurrences in a tape block
If n2=0 or not given, replace all tape blocks

For example to change all 360 to 0

$$ CHANGE ALL 360 TO 0
T1=TEXT/'A360.0'
T2=TEXT/'A0.0'
REPLAC/T1,T2

REPLAC / t1, t2, t3 [ , n1, n2 ]

t1 = target string to be modified


t2 = replace string
t3 = wildcard character to be used
n1 = will be set to 1 for wildcard option
n2 = number of tape blocks to replace

For example to change + or – 360 to 0:

$$ CHANGE + OR ­ 360 TO 0
T1=TEXT/'A*360.0'
T2=TEXT/'A360'
T3=TEXT/'*'
REPLAC/T1,T2,T3

Special options with wildcard for t1 and t2 texts:

if (t1=TEXT/'' or nothing), t2 will be added to start of block


if (t1=TEXT/'*' or wild card), t2 will be added to end of block
if (t2=TEXT/'TO_PASTE_BUF'), actual text found will be saved.
if (t2=TEXT/'FROM_PASTE_BUF'), last saved text will be inserted.

64
Example: Switch XY to YZ:

REPLAC/(TEXT/'X*'),(TEXT/'YTO_PASTE_BUF'),(TEXT/'*')
REPLAC/(TEXT/'Y*'),TEXT/'Y*XFROM_PASTE_BUF'),TEXT/'*')

If (t1=TEXT/'anytext*') that is ending with a wildcard, then the number following


that register will be the target text.

Example: Add C0B0 to A

T1=TEXT/'A*'
T3=TEXT/'*'
REPLAC/T1,(TEXT/'C0B0A*'),T3

REPLAC / t1, OFF

Turn off a previously specified REPLAC.

REPLAC / OFF

Turn off all REPLAC/commands and clear the REPLAC/table.

Notes:

 The REPLAC command is a FIL command and not a Post/CLfile command.


 REPLAC strings must be TEXT variables or nested.
 REPLAC commands can be inside or outside a CIMFIL/ON-OFF pair.
 REPLAC commands are applied in the order defined.
 For wildcard REPLAC commands, tape blocks can not contain the wildcard
character.
 REPLAC commands are executed last and just before the output to tape file.
 REPLACed tape blocks can not exceed 128 characters.
 REPLAC commands can only alter tape blocks and not the LST file.
 Up to 1000 REPLAC commands can be active at one time.
 REPLAC/OFF will clear and restart the REPLAC table.
 If PRINT/ON is in effect the REPLAC table is printed for debugging purposes.

Below are several examples of REPLAC commands. The REPLAC/OFF is not


required for multiple edits; it was only used to test different options in the same
FIL file.

PRINT/ON
REDEF/ON

$$ CHANGE D TO L
REPLAC/OFF

65
T1=TEXT/'D'
T2=TEXT/'L'
REPLAC/T1,T2

$$ ADD 0 TO ALL X VALUES
REPLAC/OFF
REPLAC/(TEXT/'X*'),(TEXT/'X*0'),(TEXT/'*')

$$ CHANGE C­ TO C
REPLAC/OFF
REPLAC/(TEXT/'C­'),(TEXT/'C')

$$ CHANGE N­SEQ TO NOTHING
REPLAC/OFF
T1=TEXT/'N'
T2=TEXT/''
REPLAC/T1,T2,1

$$ CHANGE N­SEQ TO O­BLOCK IN THE 1ST TAPE BLOCK
T1=TEXT/'N'
REPLAC/OFF
T2=TEXT/'O'
REPLAC/T1,T2,1,1

$$ ADD / IN FRONT OF EACH BLOCK
REPLAC/OFF
T1=TEXT/''
T2=TEXT/'/'
REPLAC/T1,T2

$$ ADD / TO END OF EACH BLOCK
REPLAC/OFF
T1=TEXT/'*'
T2=TEXT/'*/'
REPLAC/T1,T2,(TEXT/'*')

$$ SWITCH XY TO YZ
REPLAC/OFF
REPLAC/(TEXT/'X*'),(TEXT/'YTO_PASTE_BUF'),(TEXT/'*')
    REPLAC/(TEXT/'Y*'),TEXT/'Y*XFROM_PASTE_BUF'),(TEXT/'*')

6.10.6. The ALIAS Command

The ALIAS command can be used in FIL files to make some variable names and
syntax more readable:

ALIAS/%nam1,nam2

66
where %name1 is the aliased name which should replace the regular FIL command
name name2.

Notes:

 nam1 must start with %


 nam2 can not contain %
 nam1 and nam2 will be automatically upper-cased
 nam2 must be a valid FIL command
 nam1 can not exceed 60 chars
 nam2 can not exceed 512 chars (use CALL/MACRO instead)
 $ in nam2 will continue onto next line
 $$ in nam2 will end the current line
 no blanks are allowed within an ALIAS command
 a comma must be used to seperate nam1 and nam2
 a PRINT/ON,ALIAS alias command will print the translation during post
execution as a debugging aid.

The following is a simple example of using ALIAS to capture the ROTABL


command and output G90 first.

Define alias commands:

ALIAS/%Rotabl_Begin,cimfil/on,ROTABL
ALIAS/%Process_CL_Record,dmy=postf(13)
ALIAS/%Save_CL_Record,dmy=postf(20)
ALIAS/%Restore_Saved_CL_Record,dmy=postf(21)
ALIAS/%G,7
ALIAS/%Output,POSTN/OUT,
ALIAS/%End,cimfil/off

Use alias commands:

%Rotabl_Begin
  %Save_CL_Record
  %Output,%G,90
  %Restore_Saved_CL_Record
  %Process_CL_Record
%End

Same as:

CIMFIL/ON,ROTABL
  DMY=POSTF(20)
  POSTN/OUT,7,90
  DMY=POSTF(21)

67
  DMY=POSTF(13)
CIMFIL/OFF

6.11. File I/O

FIL provides tools to open, close, read from and write to external ASCII files. Up to two
such files can be active at any given time.

FIL also provides an option to read and write to two additional auxiliary files: the auxiliary
punch and listing file (see POSTF(25,n)).

6.11.1. The FILEF command

FILEF operates on external files.

rslt = FILEF(fn,op,t1)

rslt: Result of operation

=0 Requested file operation suceeded - OK


=1 Requested file operation failed - error

fn: File number to be used (0, 1, 2, 3, or 4). If fn is 0, output is sent to


the terminal.

op: Operation to be executed

= 1 Write one record from text string t1 to file fn.


= 2 Open an existing file; file name is t1; fn must be 1 or 2.
= 3 Open a new file; file name in t1; fn must be 1 or 2.
= 4 Rewind file; t1 not required; fn must be 1 or 2.
= 5 Close file; t1 not required; fn must be 1 or 2.
= 6 Close and delete file; t1 not required; fn must be 1 or 2.
= 7 Inquire if file exist; rslt will be set to 1 if file exist,
otherwise rslt will be set to 0; fn must be 1 or 2.

Examples:

To open an existing file:

FN = TEXT / ‘TEST.PPR’ $$THE FILE NAME
FEX = FILEF(1,7,FN) $$CHECK TO SEE IF FILE
$$EXIST
IF(FEX .EQ. 1)THEN 
  DMY = FILEF(1,2,FN) $$OPEN EXISTING FILE FN AS
$$LOGICAL UNIT 1
ELSE
  FOPEN = POSTF(1,3,FN) $$FILE DID NOT EXIST,OPEN A

68
$$NEW FILE NAMED FN AS
$$LOGICAL UNIT 1
ENDIF

To open an new file:

FN = TEXT / ‘TEST.PPR’ $$ THE FILE NAME
FEX = FILEF(1,7,FN) $$ CHECK TO SEE IF FILE
$$ EXIST
IF(FEX .EQ. 1)THEN 
  DMY = FILEF(1,2,FN) $$ OPEN EXISTING FILE FN AS
$$ LOGICAL UNIT 1
  DMY = FILEF(1,6) $$ CLOSE AND DELETE
$$ LOGICAL UNIT 1 (FILE FN)
ENDIF
FOPEN = POSTF(1,3,FN) $$ OPEN A NEW FILE NAMED
$$ FN AS LOGICAL UNIT 1

To close and save an opened file:

IF(FOPEN .EQ. 0)THEN  $$ FOPEN IS THE VARIABLE
$$ SET DURING THE FILE OPEN
$$ COMMAND.
  DMY = FILEF(1,5) $$ CLOSE LOGICAL UNIT 1 AND
$$ SAVE
ENDIF

To close and delete an opened file:

IF(FOPEN .EQ. 0)THEN  $$ FOPEN IS THE VARIABLE
$$ SET DURING THE FILE OPEN
$$ COMMAND.
  DMY = FILEF(1,6) $$ CLOSE LOGICAL UNIT 1 AND
$$ DELETE
ENDIF

To write a text string to an opened file:

IF(FOPEN .EQ. 0)THEN  $$ FOPEN IS THE VARIABLE
$$ SET DURING FILE OPENING
  T1=TEXT/’THIS IS A TEXT’
  DMY=FILEF(1,1,T1) $$ WRITE STRING T1 TO
$$ LOGICAL UNIT 1
ENDIF

69
To write a text string to the terminal;

T1=TEXT/’ENTER TOOL NUMBER ­> ’ $$ A TEXT STRING
MY=FILEF(0,1,T1) $$ WRITE STRING T1 TO
$$ LOGICAL UNIT 0, THE
$$ TERMINAL

6.11.2. Reading from an External File

t1 = TEXT / READ, fn

t1: variable containing the text string being read


fn: 0,1, or 2 (file number opened with previous FILEF function)

The READ option reads the next record from a file. If READ reaches the end of the
file, t1 contains the text string ‘ERROR$EOF’ to indicate the end of file condition.

If fn is 0, the input is read from the terminal.

6.11.3. Reading from the Auxiliary Print File

The READ,PRINT option reads the next record from the auxiliary print file. The
auxiliary print file is created using the POSTF(25,n) command. If READ,PRINT
reaches the end of the file, t1 contains the text string ‘ERROR$EOF’ to indicate
the end of file condition.

t1 = TEXT/READ,PRINT

t1: variable containing the text string being read

6.11.4. Reading from the Auxiliary Punch File

The READ,PUNCH option reads the next record from the auxiliary punch file. The
auxiliary punch file is created using the POSTF(25,n) command. If READ,PUNCH
reaches the end of the file, t1 contains the text string ‘ERROR$EOF’ to indicate the
end of file condition.

t1 = TEXT/READ,PUNCH

t1: variable containing the text string being read

70
6.12. POSTF Commands (Post-processor Functions)

The primary usage of POSTF (POST-processor Function) commands is to allow access


to the internal features used during processing. The POSTF syntax is:

rslt = POSTF( function_type, arg1, arg2, arg3, argn )

rslt is a scalar that returns the result of the operation. For those POSTF commands
using TEXT function types, rslt will be a string.

function_type is a two-digit number that represents the function type. The number of
arguments required depends on the type of function.

Here after is a brief description of the post-processor functions available in FIL:

Function Functionality
Type
01 Get COMMON value
02 Set COMMON value
03 Set COMMON to empty
04 Test for COMMON empty
05 Get number of words in current CL record
06 Find word type in current CL record
07 Get CL record value
08 Get text data from CL record
09 Put minor word in CL record
10 Put scalar in CL record
11 Reserved for future use
12 Set number of words in CL record
13 Process current CL record
14 Read next current CL record from CL file
15 Position to a CL record in CL file
16, 17, 18 Reserved for future use
19 Output current Post block (call out)
20 Save current CL record
21 Load a saved CL record
22 Get current machine number
23 Move COMMON values
24 Turn on/off ISN trace print
25 Redirect Post output<$IPOSTF chart>
26 Control CIMFIL/ON-OFF

The following table summarizes the syntax used for these POSTF commands, along
with the type and significance of each argument.

71
Function type Syntax & description RSLT Arguments
Post 01 POSTF(01,a1,a2) Value a1 = type (1=int, 2=rel, 3=dbl)
Common (Get Common) a2 = location
02 POSTF(02,a1,a2,a3) 0 a1 = type (1=int, 2=rel, 3=dbl )
(Set Common) a2 = location
a3 = value
03 POSTF(03,a1,a2) 0 a1 = type (1=int, 2=rel, 3=dbl)
(Empty Common) a2 = location
04 POSTF(04,a1,a2) 0=Unused a1 = type (1=int, 2=rel, 3=dbl)
(Test for Empty) 1=empty a2 = location
19 POSTF(19)
(Output Post Block)
22 POSTF(22) Machine
(Get Machine Number) Number
23 POSTF(23,a1,a2,a3) 0 a1 = type (1=int, 2=rel, 3=dbl)
(Move Common Values) a2 = New Location
a3 = Existing Location
25 POSTF(25,a1) 0 a1 = Direction Flag
(Redirect Post Output) 0=Normal
1=Aux. Files
2=Rewind Aux. Files
Get CL 05 POSTF(05) Word
Info (Get # of CL words) count
06 POSTF(06,a1) 0= mnr wrd a1 = location
(Get CL word type) 1= scalar
2= text
07 POSTF(07,a1) Value a1 = location
(Get CL word value)
08 TEXT/CLW 66 char
(Get CL text) text string
Load CL 09 POSTF(9,a1,a2) 0 a1 = location
Info (Load a minor word) a2 = word
10 POSTF(10,a1,a2) 0 a1 = location
(Load a scalar) a2 = scalar
12 POSTF(12,a1) 0 a1 = count of words
(Set # of CL words)
13 POSTF(13) 0
(Execute CL record)
20 POSTF(20) 0
(Save CL record)
21 POSTF(21) 0
(Load saved CL record)
CL File 14 POSTF(14,a1) 0=OK a1 = Return next CL record
(Read next CL record) 1=Error
15 POSTF(15,a1) 0=OK a1 = CL record number
(Position to CL record) 1=Error
26 POSTF(26,a1,a2,a3) 0 a1 = CL rec type
(Control CIMFIL/ON) a2 = CL rec subtype
a3 = 0 Disabled
a3 = 1 Enabled
Debug 24 POSTF(24,a1) 0 a1 = 0 Trace off
(Trace on/off) a1 = 1 Trace on

72
– page intentionally left blank –

73
Section Two
Pro/NC-GPOST EXERCISES

74
– page intentionally left blank –

75
Exercise 1

Creation and customization of a basic post-processor


for a 3 axis Mill
The purpose of this exercise is to familiarize you with Optfile, Pro/NC-GPOST’s
Questionnaire. Starting with an existing default configuration, you will create a new post-
processor for a generic 3-axes horizontal mill equipped with a FANUC 15M control.

Exercise Steps:

1. Start Pro/NC-GPOST’s Optfile module.

2. Select the New post processor icon:

3. Select Mill for the Machine Type.

4. Enter 1 for the Machine Number. Your post-processor will then be named
UNCX01.P01.

5. For the Method of initialization, select ”Select a system supplied default”.

6. In the list of default option files, select the ”FANUC 15M CONTROL” option:

7. Specify ”Exercise Number 1” as a title for the configuration file:

76
8. Return to the main panel (by clicking OK), then save the post-processor.

9. In Pro/NC, retrieve the manufacturing model pplab1.mfg. In the CL Data menu,


Output the Operation OP010 to a File, checking both the CL File and the MCD File
options. Accept the default name pplab1.ncl for the CL file. In the PP Options menu
check only the Verbose option and click Done. Select the post-processor UNCX01.01
from the PP List menu and click Done.

10. At the end of the execution, carefully read the information displayed in the Pro/NC
information window and Close the window when done.

11. Using a text editor, view the resulting tape file pplab1.tap and the verification list file
pplab1.lst.

Your next task will be to modify the post-processor in order to accommodate some changes
in the output tape file.

Here are the NC programming requirements:

 First move after tool change should be output on two separate blocks: XY then Z.
 G and T codes must be output using 2 digits (e.g. G00 instead of G0).
 M codes are preferred before the T and S words.
 Sequence numbers showing on each block must be incremented by 2.
 Tape files must start with a Program ID number preceded by the letter “O” (e.g. O001).
 There should be no space between registers.
 An M30 code is required at the end of the program.

Here after are the first few lines of the current tape file and of the required output:

% %
N5 G70 O0001
N10 T1 M06 N1G70
N15 S600 M03 N2M06T01
N20 G0 Z.5 M08 N3M03S600
N25 X-2.5 Y0. N4G00X-2.5Y0.
N30 Z.1 N5Z.5M08
N35 G1 Z-.25 F5. N6Z.1
N40 X8.25 F10. N7G01Z-.25F5.
N45 X9.25 Y.875 N8X8.25F10.
N50 X0. N9X9.25Y.875
N55 X-1. Y1.75 N10X0.
N60 X8.25 N11X-1.Y1.75
... ...

12. Return to Pro/NC-GPOST (or, if you have previously terminated the Pro/NC-GPOST
session, start a new session and Load the post-processor UNCX01.01).

13. Select the MCD File Format category.

14. Change the register format of T and G.

77
15. Move the register M before S and T.

16. Unselect the “Insert a blank before each address” option.

17. Select the Sequence Number category and modify the starting sequence number
and increment.

18. Select the Startup/End of Program category and check the box for Program Number
(be also sure that DNC format is checked).

78
19. A new tab will appear: Prog #. Click on the tab and enter the appropriate settings:

20. Select the End of Program tab and add an M30 code at the end of the program.

21. Select the Tool Change Sequence category and click on the Tool Change Coordinates
tab. Set the Z coordinate to 100 to force the “squaring-off” (i.e. XY before Z) of the first

79
motion block after the tool change.

22. Save and run the post-processor to check your modifications.

Additional Tasks:

 Output Operator messages with the following format: (MSG, message ).


 Set the maximum spindle speed to 4000RPM.
 Set the maximum feedrate to 200 IPM.
 Set the RAPID feedrate to 200 IPM.
 Change the circular interpolation method to Radius instead of Center (maximum
arc should be 180˚).
 Output the Date and Time of processing at the beginning of the program.
 Output the following safe startup blocks at the beginning of the program:

G90G80G94
G40G49

80
Exercise 2

Creation and customization of a basic post-processor


for a 4 axis Mill

Starting once again with an existing default configuration, you will create a post-processor
for a Toshiba 4-axes horizontal mill (with a B Table), equipped with a Tosnuc 520 control.
You will also set the physical limits of the linear axes.

Exercise Steps:

1. In Pro/NC-GPOST’s Optfile module, start a new post processor option file.

2. Select Mill for the Machine Type and enter 2 for the Machine Number. Your option file
will then be named UNCX01.P02.

3. For the Method of initialization, select ”Select a system supplied default”.

4. Select TOSHIBA TOSNUC 500 SERIE CONTROL from the list of default option files:

5. Specify “Exercise Number 2” as a title for the configuration file.

81
6. In the Machine Tool Type category, set the Machine Type to 4-axis Rotary table.

7. A new sub-panel appears: 4 Axis Rot. Table


Select this new tab.

8. Verify that the rotary axis defined is a B axis (i.e. Rotation about Y axis)
Uncheck Only Capable of Indexing (check the explanation of this parameter, the
Pro/NC CL file used for testing will be of MULTAX type):

9. Select the Specs tab and set the linear axes limits to a range of –8” to 37.5” for the
X-axis, 0 to 27.5” for the Y-axis and 0 to 13” for the Z-axis. Ensure that the Check
axis Limits box is checked.

82
10. The home position should be set to the maximum of each axes.

11. Select the Feedrates category and the UPM Mode tab. Set the maximum feedrate
to 200IPM.

12. Exit and save the post-processor.

83
13. In Pro/NC, retrieve the manufacturing model pplab2.mfg. In the CL Data menu, Output
the Operation OP010 to a File, checking both the CL File and the MCD File options.
Accept the default name pplab2.ncl for the CL file. From the PP Options menu check
only the Verbose option and click Done. Select the post-processor UNCX01.02 from
the PP List menu and click Done.

14. At the end of the execution, carefully read the information listed, then Close the Pro/NC
information window.

15. Using a text editor, view the resulting tape file pplab2.tap and the verification listing
file pplab2.lst.

Your task is now to modify the post-processor in order to change the output convention of the
B rotary table.

Here is the beginning of the current tape output, together with the required B-axis values:
%
N10G70
N20M6T1
N30S500M3
N40G0X0.Y.5B90. <- Indexing should be done before positioning
N50G43Z2.2071H1M8
N60G73X0.Y.5Z.7593R1.3071F10.B90.
N70G80
N80G0Z2.2071
N90B45.
N100G73X0.Y.5Z.698R1.3071F10.B45.
N110G80
N120G0Z2.2071
N130B0.
N140G73X0.Y.5Z.698R1.3071F10.B0.
N150G80
N160G0Z2.2071
N170B-45. <- B315 required instead of B-45
N180G73X0.Y.5Z.698R1.3071F10.B-45.
N190G80
N200G0Z2.2071
N210B-90. <- B270 required instead of B-90
N220G73X0.Y.5Z.7022R1.3071F10.B-90.
N230G80
N240M5
.........

16. Return to Pro/NC-GPOST (or, if you have previously terminated the Pro/NC-GPOST
session, start a new session and open the post-processor file UNCX01.P02).

17. Select the Machine Tool type category


and the 4 Axis Rot. Table tab.

According to the on-line help box, there


are two solutions to change the values of
the B axis. Read the explanations and
check the 0 and 359.99 controller
takes shortest path box.

84
18. Select the RAPID Motions category. The Motion analysis box is already checked.
However, we do not know exactly how this motion analysis will be performed in the case
of a rotary axis; and this is why we have a B value with a XY position.

Many post-processors parameters are not directly available in the Optfile questionnaire.
Therefore we must review all the internal parameters (Common Variables) in order to set
the appropriate option.

19. Select the Common/PLABELs category. Using the Search tab, look for the word rotary:

Option 40 allows to set the order of output of motion registers during motion analysis.

85
20. Select the 31-40 tab and set option 40 to Rotary then XY then Z ….

21. Exit and save the post-processor.

22. Return to Pro/NC and run the post-processor using CL Data / Post Process.

23. When the process is finished, use the text editor to view the new pplab2.tap. Note
the differences in the B-axis output from the previous version of the file.

Additional Tasks:

 Reposition the B register to be after Z.


 Create a Q register (use the Extra #1 register) for the Step value in CYCLEs.
 Output Block and Tool time in the listing file (uses PLABEL option).
 Set the G code for UPM to G94.
 Add the following lines at the end of the program:

G28G91Z0
M30

86
Exercise 3
Post-processors and the Pro/MFG Parameters
The purpose of this exercise is to allow a better understanding of the relationship between
manufacturing parameters and the post-processor output. The material provided includes
a manufacturing model in which you will have to change various settings. You will start by
configuring a post-processor for a 4-axes mill with a Mazatrol™ M32 control.

Exercise Steps:

1. Create a new post-processor named UNCX01.P03 using the control MAZAK M32.
This post-processor is for a 4 axis Milling machine with a B rotary table.

2. In Pro/MFG, retrieve the manufacturing model pplab3.mfg. Output the first operation
and post-process the resulting pplab4.ncl CL file using the UNCX01.P03 post.
Analyze the results.

3. Customize the Pro/MFG Model Tree by adding the following new columns for the
Machining Parameters. Do not forget to show the features of the Model Tree.

 CUT_FEED
 ARC_FEED
 SPINDLE_SPEED
 COOLANT_OPTION
 CUTCOM
 FIXT_OFFSET_REG
 PLUNGE_FEED

4. Using the new Model Tree


configuration, enter appropriate
values for the parameters listed
above in all the NC Sequences
defined in the model. Output the
CL Data once again and process it
with the UNCX01.P03 post,
analyzing the new results.

5. In Pro/MFG, select the Mfg Setup → CL Setup menu and add a PPRINT table which
activates the following options:

 NC_SEQUENCE_COMMENTS
 TOOL_NAME
 TOOL_COMMENTS

87
6. Output the CL Data one more time and process it again. Notice the CRT messages in
the resulting NC output file.

7. Return to Pro/MFG and Customize the first NC Sequence. Position your option at the
beginning of the Automatic Cut and
Insert a CL Command at the
current placement.

Using the Menu, select the OPSKIP


command. Enter ON as the argument.
Next, Insert the same CL command at
the <end of tool path> position, using
the argument OFF. Your customization
box should eventually look like in the
diagram attached.

Output the CL Data and post-process


the resulting file. Note that the first NC
Sequence is output using “block delete”.

This is useful for NC Sequences which


only need to be machined once (i.e. on
the first run).

Additional Tasks:

 Some B value are greater or equal 370. Modify the B axis behavior in Optfile to
have values between 0 and 359.99
 Insert a blank between each address.
 Output the coolant code with next XY move.

88
Exercise 4
Full Creation of a Post-processor

One of the pre-requisites of this training was for every trainee to provide in class the
following material:

 the programming manual of one of your NC controllers

 a list of the machine tool specifications (i.e. max feeds, speeds, axes travels, etc)

 if available, a picture or diagram of the NC machine (highly recommended for more


than three axes)

 a sample NC program that has been successfully executed on the machine (to be
used as model for the required output of the post).

This exercise relies entirely on the assumption that the above material is now available.

Your task is to apply this information to the configuration of a real post-processor using the
available options in Optfile. Towards the end of this training, you will continue to customize
this post as further information is being discussed.

Tips and Requirements:

1. For further referencing of the post-processor you will create during this exercise, it is
recommended that you name your post UNCX01.P04 or UNCL01.P04.

2. Start the post-processor creation by using the appropriate control default.

3. In order to test your post-processor, the following manufacturing models are available:

 Pplab4_mill.mfg for 3-axes milling posts


 Pplab4_trn.mfg for 2-axes turning posts

89
Exercise 5
Basic FIL Routines
The purpose of this exercise is to present some basic FIL routines.

Exercise Steps:

1. Create a generic post-processor for a 3-axes mill with a Mitsubishi Meldas 520
control, using the control default file Mitsubishi Meldas 500M. Save the new post as
UNCX01.P11 and use it to post-process the CL file pplab1.ncl in Pro/NC

2. Create a FIL routine to ignore all coolant commands. This demonstrates the most
basic CIMFIL application: ignore a post-processor command:

CIMFIL / ON, COOLNT


$$ this routine will start on all COOLNT commands
$$ and will remove all M08’s from the tape file
CIMFIL/OFF

To add this FIL routine to the UNCX01.P1 post-processor, simply type the text above
the FIL Editor window:

Save the post and post-process pplab1.ncl to see the result (all coolant codes M08
have disappeared)

3. Let us assume that the NC machine has coolant capabilities, but the coolant must be
started by the operator. Let us then modify the COOLNT FIL routine above to issue
a message to the operator. This demonstrates another type of CIMFIL application:
replace a CL command by another.

90
Here is the new COOLNT routine:

CIMFIL/ON,COOLNT
$$ this routine will start on all COOLNT commands
$$ and will issue an operator message in the tape file
ARG1=POSTF(7,4) $$ first argument of COOLNT
IF(ARG1.EQ.ICODEF(OFF)) THEN
$$ This is a COOLNT/OFF command
INSERT/(TEXT/’(OPERATOR STOP COOLANT)$)’ $$ message
ELSE
$$ This command starts the coolant (ON, FLOOD or MIST)
INSERT/(TEXT/’(OPERATOR START COOLANT)$)’ $$ message
ENDIF
DELAY/20 $$ dwell 20 sec. to give time to the operator
CIMFIL/OFF

Save the post and post-process pplab1.ncl to see the results:

%
O1111
N0010 G20
N0020 T01 M06
N0030 S600 M03
N0040(OPERATOR PLEASE START COOLANT)
N0050 G04 X20.
N0060 G00 X-2.5 Y0.

4. Your next task is to create another FIL routine to start or stop the air flow (M12, M13)
before processing a SPINDL command (not a SPINDL/OFF command though). This
demonstrates another type of CIMFIL application: add a post-processor command after
an existing command.

CIMFIL/ON,SPINDL $$ starts on all SPINDL statements


DMY=POSTF(20) $$ save SPINDL record in memory
PARAM=POSTF(7,4) $$ first parameter of SPINDL command
IF(PARAM.NE.ICODEF(OFF)) THEN
$$ it is not a SPINDL/OFFcommand
AUXFUN/12 $$ start the air flow
ENDIF
DMY=POSTF(21) $$ restore SPINDL record saved in memory
DMY=POSTF(13) $$ process the CL record
CIMFIL/OFF $$ end of CIMFIL on SPINDL

5. Now you will want to add some shut-down codes at the end of the NC program:

G91 G28 Z0.


G28 X0. Y0.
M30

91
To do so, create a routine on FINI:

CIMFIL / ON, FINI $$ starts on the FINI record


DMY=POSTF(20) $$ save the FINI record in memory
INSERT/’ G91 G28 Z0.$’
INSERT/’ G28 X0. Y0.$’
INSERT/’ M30$’
DMY=POSTF(21) $$ restore FINI record saved in memory
DMY=POSTF(13) $$ process the CL record
CIMFIL/OFF $$ end of CIMFIL on FINI

Do not forget to add a REDEF/ON statement in the global section of the FIL file to
allow the redefinition of the DMY variable (as a test you can see what happens if you
don’t do this).

6. Finally, you need to add some startup codes at the beginning of the NC program:

G90 G80 G40


(DATE: 12/12/1999 03:20)

To do so, create a routine on MACHIN. It is important to note that tape output is generated
only after the MACHIN statement is processed.

CIMFIL/ON,MACHIN $$ starts on the MACHIN record


DMY=POSTF(13) $$ process the MACHIN statement
INSERT/(TEXT/’G90 G80 G40$’) $$ output safe startup block
DVAL=TEXT/TIMES $$ extract the system time
INSERT/’( DATE:’,DVAL,’)$’ $$ insert the message
CIMFIL/OFF $$ end of CIMFIL on MACHIN

Additional tasks:

 Create a FIL routine to replace all RAPID commands by FEDRAT/200,IPM.


 Modify the SPINDL FIL routine to output the AIR command after the output of the
SPINDL record.
 Remove all PPRINT records containing the word COMMENTS (see TEXT/CLW and the
INDXF function).

92
Exercise 6
FIL Variables: Scalars
This exercise allows a better familiarization with scalar variables available in FIL. The object
is to customize a post-processor in order to accommodate a special output requirement.

Exercise Steps:

1. Create a generic post-processor for a 3-axes mill with a Mitsubishi Meldas 520 control,
using the control defaults Mitsubishi Meldas 500M. Save the new post as UNCX01.P12
and use it to post-process the CL file pplab1.ncl from the Pro/NC manufacturing model
pplab1.mfg. Analyze the results (pplab1.tap).

The customization requirement for this exercise consists in accommodating a special


sequence numbering convention: each NC Sequence must restart block numbering using
multiples of 1000, continuing in the respective range with an increment of 1 (i.e. N1000,
N1001, N1002… for the 1st NC Sequence, N2000, N2001, N2002… for the 2nd one, etc).

2. The first step is to create a scalar variable in the global section of FIL to store the
sequence number multiplier: SEQNB.

$$ Variable definition and initialization


SEQNB=0

3. Now you need to create a FIL routine on LOADTL:

CIMFIL/ON,LOADTL $$ starts on all LOADTL records


DMY=POSTF(20) $$ save current CL record
SEQNO/OFF $$ stop sequence numbering
INSERT/(TEXT/‘ $‘) $$ insert a blank line
SEQNB=SEQNB+1 $$ increment variable SEQNB
STVAL=SEQNB*1000 $$ calculate sequence numbering start value
SEQNO/STVAL,INCR,1 $$ set new sequence numbering start value
SEQNO/ON $$ restart sequence numbering
DMY=POSTF(21) $$ reload saved LOADTL record
DMY=POSTF(13) $$ process LOADTL
CIMFIL/OFF $$ end of CIMFIL on LOADTL

4. Save the post and post-process pplab1.ncl to see the results.

93
Exercise 7
FIL Variables: Strings
This exercise allows a better familiarization with string variables available in FIL. The object
is to customize a post-processor in order to accommodate a special tape header.

Exercise Steps:

1. Create a generic post-processor for a 3-axes mill with a FANUC 6M, using the control
defaults FANUC 6M. Save the new post as UNCX01.P13 and use it to post-process the
CL file pplab1.ncl from the Pro/NC manufacturing model pplab1.mfg. Analyze the results
(pplab1.tap).

The customization requirement for this exercise consists in generating a special header at
the beginning of the program. The PARTNO string needs to be displayed as an operator
message at the beginning of the NC program. A safe startup block: G90 G80 G40 must also
be inserted. The feedrate needs to default to 10 IPM.

2. Create a FIL routine on PARTNO to store the PARTNO text:

CIMFIL/ON,PARTNO $$ starts on all PARTNO records


DMY=POSTF(13) $$ process the PARTNO record
PTXT=TEXT/CLW $$ get the PARTNO text
PTXT1=TEXT/OMIT,PTXT,1 $$ Remove trailing blanks
CIMFIL/OFF $$ end of CIMFIL on PARTNO

3. Create a FIL routine on MACHIN. Do not forget that tape output will be generated
only after the MACHIN statement is processed.

CIMFIL/ON,MACHIN $$ starts on the MACHIN record


DMY=POSTF(13) $$ process MACHIN statement
INSERT/(TEXT/’(’,PTXT1,’)$’) $$ inserts PARTNO as message
INSERT/(TEXT/’G90 G80 G40$’) $$ insert the safe startup block
FEDRAT/10,IPM $$ set default feedrate
CIMFIL/OFF $$ end of CIMFIL on MACHIN

4. Save the post and post-process pplab1.ncl to see the result.

Additional tasks:

 Simplify the PARTNO routine to not use two text variables (see the REDEF command).
 Remove the ”/” character in operator messages (see the REPLAC command).
 Output the CL file name to the tape (see the TEXT command).
 Output the current Date and Time to the tape (see the TEXT command).

94
Exercise 8
Sub-programming Techniques
The objective of this exercise is to customize a post-processor to support sub-programs.

Exercise Steps:

1. Create a generic post-processor for a 3-axes mill with a FANUC 10M, using the control
defaults FANUC 10M. Save the new post as UNCX01.P13 and use it to post-process
the CL file pplab14.ncl. Analyze the results (pplab14.tap).

2. The first FIL routine to write will be on DEFSUB: the sub-program definition CL record.
On the Fanuc control, all sub-programs start with a unique “O”-block, followed by the
sub-program number.

CIMFIL/ON,DEFSUB $$ starts on all DEFSUB records


SUBNUM=POSTF(7,4) $$ first parameter of the DEFSUB command
$$ Convert the scalar SUBNUM to a string O followed by 4 digits
TPNUM=TEXT/’O’,CONVF,SUBNUM,4,0,0,1,1,’$’
SEQNO/OFF $$ stop sequence numbering
INSERT/TPNUM $$ insert sub-program number
SEQNO/10,INCR,1 $$ restart sequence numbering
CIMFIL/OFF $$ end of CIMFIL on DEFSUB

3. The next step will be to create a FIL routine on the CL record that marks the end of a
sub-program: ENDSUB. On the Fanuc control, the end of sub-programs is defined by an
M99 code.

CIMFIL/ON,ENDSUB $$ starts on all ENDSUB


INSERT/(TEXT/’M99$’) $$ insert end of sub-program code
SEQNO/OFF $$ stop sequence numbering
INSERT/(TEXT/’ $’) $$ insert a blank line
SEQNO/ON $$ restart sequence numbering
CIMFIL/OFF $$ end of CIMFIL on ENDSUB

4. Finally you must create a routine on the sub-program call CL record: CALSUB. On the
Fanuc control, sub-programs are called using a M98 code followed by a “P”-block and
the sub-program number.

CIMFIL/ON,CALSUB $$ starts on all CALSUB


CNUM=POSTF(7,4) $$ first parameter of the CALSUB command
$$ Convert the scalar CNUM to a string M98P followed by
$$ the sub-program number
TPNUM=TEXT/’M98 P’,CONVF,CNUM,4,0,0,1,3,’$’
INSERT/TPNUM $$ output sub-program call
CIMFIL/OFF $$ end of CIMFIL on CALSUB

5. For cosmetic reasons you need to detect the first tool change and issue the header for
the main program.

95
To do so, you must start by setting up a “flag” in the global area of the FIL file:

$$ Flag to detect the first tool change


FTOOL = 0

6. Next write a FIL routine on LOADTL:

CIMFIL/ON,LOADTL $$ starts on all LOADTL


DMY = POSTF(20) $$ save current CL record
IF(FTOOL.EQ.0) THEN $$ check if first tool change
FTOOL=1 $$ reset the flag
SEQNO/OFF $$ stop sequence numbering
INSERT/(TEXT/’ $’) $$ insert a blank line
INSERT/(TEXT/’%$’) $$ insert a “%”
SEQNO/10,INCR,2 $$ restart sequence numbering
INSERT/(TEXT/’G90G40G80$’) $$ safe startup
DATTXT=TEXT/TIMES $$ store current date and time
INSERT/’(‘,DATTXT,’)$’ $$ output operator message
ENDIF
DMY=POSTF(21) $$ restore saved record (LOADTL)
DMY=POSTF(13) $$ process LOADTL
CIMFIL / OFF $$ end of CIMFIL on LOADTL

7. Save the post and post-process pplab14.ncl to see the results. You will notice quite a
number of errors being generated:

** Error ** 1007 SYMBOL IS DOUBLY DEFINED--TPNUM

The reason is the fact that the TPNUM variable is redefined at each DEFSUB. The errors
can be avoided by inserting a REDEF/ON statement in the global area of the filter file. It is
generally recommended to add this statement at the beginning of all filter files.

8. Save the post and post-process pplab14.ncl to see the result.

Additional tasks:

”Clean up” the NC tape output using FIL routines or Optfile modifications:

 Remove the G20 code at the beginning of the NC tape.


 Output the tool name as a comment after each tool change (CIMFIL on PPRINT).
 Ensure that all sub-programs start with G00 or G01 by resetting the current feedrate
mode (see POSTF, INTCOM).
 Ignore all SPINDL/OFF records.

96
Exercise 9
FIL File Optimization

This exercise demonstrates various technique to simplify the development of FIL routines
using macros, as well as ALIAS and INCLUD statements.

Exercise Steps:

1. Create a post-processor for a Makino mill using the control defaults FANUC 16M. Save
the new post as UNCX01.P15 and use it to post-process the CL file pplab1.ncl from the
Pro/NC manufacturing model pplab1.mfg. Analyze the results (pplab1.tap).

2. Your first task will be to create several alias definitions for the FIL statements most
commonly used in filter files:

$$ ALIAS definitions
ALIAS/%SAVE_CLREC,DMY=POSTF(20) $$ save current CL record
ALIAS/%RESTORE_CLREC,DMY=POSTF(21) $$ restore saved CL record
ALIAS/%PROCESS_CLREC,DMY=POSTF(13) $$ process current CL record in memory
ALIAS/%OUTPUT,DMY=POSTF(13) $$ process current CL record in memory
ALIAS/%FCL1,POSTF(7,4) $$ 1st argument of current CL record
ALIAS/%FCL2,POSTF(7,5) $$ 2nd argument of current CL record
ALIAS/%FCL3,POSTF(7,6) $$ 3rd argument of current CL record
ALIAS/%FCL4,POSTF(7,7) $$ 4th argument of current CL record
ALIAS/%FCL5,POSTF(7,4) $$ 5th argument of current CL record
ALIAS/%FCL6,POSTF(7,4) $$ 6th argument of current CL record
ALIAS/%FCL7,POSTF(7,4) $$ 7th argument of current CL record
ALIAS/%FCL8,POSTF(7,4) $$ 8th argument of current CL record
ALIAS/%FIZE,POSTF(5) $$ nb of arguments on current CL record
ALIAS/%GET_TXT,TEXT/CLW $$ text argument of current CL record
ALIAS/%MTNMAC_TRUE,DMY=POSTF(26,5,5,1) $$ macro on motion activated
ALIAS/%MTNMAC_FALSE,DMY=POSTF(26,5,5,0) $$ macro on motion de-activated

3. You can also define a series of standard variables used in FIL files, such as the letter
addresses:

A=1;B=2;C=3;D=4;E=5;F=6;G=7;H=8;I=9;J=10;K=11;L=12;M=13
N=14;O=15;P=16;Q=17;R=18;S=19;T=20;U=21;V=22;W=23;X=24;Y=25;Z=26

4. Now write a macro to output the machining summary (program size and machining
time) at the end of the NC program. This macro can be used in any post-processor:

ENDSUM=MACRO
_TTIME=POSTF(1,3,495) $$ DBLCOM 495: total machining time
_TCHAR=POSTF(1,3,494) $$ DBLCOM 494: total tape length
PPRINT/(TEXT/’CYCLE TIME:’,_TTIME ,’sec. BYTES:’,_TCHAR)
TERMAC

5. In order to print this information at the end of the NC program, you must create a FIL
routine on FINI. You may also use the ALIAS statements previously defined:

97
CIMFIL/ON,FINI $$ starts on FINI
%SAVE_CLREC $$ save the current CL record
CALL/ENDSUM $$ print time and bytes summary
%RESTORE_CLREC $$ restore CL rec. in memory
%PROCESS_CLREC $$ process current CL rec.
CIMFIL/OFF $$ end of CIMFIL on FINI

6. Your next step will be to issue an M98P1000 code (super GI command for the Makino
mill) before the first motion following a tool change. To do so, write a FIL routine on
GOTO. Note that in order for this FIL routine to be executed only after a tool change, it
must be activated in a different FIL routine on LOADTL:

Here are the two routines:

CIMFIL/ON,LOADTL $$ starts on all LOADTL


%PROCESS_CLREC $$ process LOADTL
%MTNMAC_TRUE $$ activate CIMFIL on GOTO
CIMFIL/OFF $$ end of CIMFIL on LOADTL

CIMFIL/ON,GOTO $$ starts on all GOTO


%SAVE_CLREC $$ save the GOTO
INSERT/’M98P1000$’ $$ issue the super GI command
%MTNMAC_FALSE $$ deactivate CIMFIL on GOTO
%RESTORE_CLREC $$ restore the saved CL record (GOTO)
%PROCESS_CLREC $$ process the GOTO
CIMFIL/OFF $$ end of CIMFIL on GOTO

NOTES:

 All these ALIAS statements, variable initialization and macros can be written in an
external file (e.g. myfil.txt), which can be then included in all your post-processors.
The syntax to be used is:

INCLUD / myfil.txt

 Another solution would be to create a series of custom default startup FIL files:
UNCX01.F00, UNCL01.F00, UNCP01.F00, UNCC01.F00 and respectively
UNCW01.F00 inside the $pro_directory/$MC/obj directory (see Appendix 2).

Additional task:

 Rewrite the FIL routines developed in the previous exercise using ALIAS statements.

98
Exercise 10
Internal (COMMON) Variables
This exercise demonstrates the way to read and modify various internal post-processor
variables (common variables) during the execution of a post-processor.

Exercise Steps:

1. Create a post-processor for a Toshiba mill using the control defaults Toshiba TOSNUC
800 Serie. Save the new post as UNCX01.P16 and use it to post-process the CL file
pplab1.ncl from the Pro/NC manufacturing model pplab1.mfg.

By analyzing the CL file pplab1.ncl and its resulting tape file pplab1.tap, you will notice
that the M9 code (stop coolant) is never being output, although several COOLNT/OFF
commands are present in the CL file and even if the M9 code has been defined in the
Coolnt Aux/M-Codes category of the UNCX01.P16 post-processor.

The output of all COOLNT commands is actually set to be delayed to the next Z move.
However, COOLNT/OFF records are not processed this way because the post-processor
encounters a COOLNT/ON before the next motion:

GOTO / 9.7500000000, 5.2500000000, 0.5000000000
COOLNT / OFF <­ COOLNT programmed wait for next Z move to process
SPINDL / OFF
$$­> END / 
$$­> FEATNO / 73
LOADTL / 2 $$­> 1" F.E.M.
$$­> CUTTER / 1.000000
SPINDL / RPM, 600.000000,  CLW
COOLNT / ON <­ COOLNT programmed wait for next Z move to process
RAPID 

99
GOTO / 9.6250000000, 3.6250, 0.500 <­ Z move, process last COOLNT programmed

2. You should therefore create a FIL routine to process COOLNT/OFF on a separate block
and to continue processing all other COOLNT records with the next Z move.

3. Your first step is to find the internal common variable used for the COOLNT Output Type.
To find it, select the Common/PLABELs category and the sub-panel Search. Look for
the word COOLNT:

The common variable is INTCOM 3425.

4. Now write a FIL routine on COOLNT:

CIMFIL/ON,COOLNT $$ starts on all COOLNT


COLTYP=POSTF(7,4) $$ first argument of COOLNT
IF(COLTYP.EQ.ICODEF(OFF))THEN
$$ This is a COOLNT/OFF command
DMY=POSTF(2,1,3425,0) $$ set INTCOM 3425 to 0 (output now)
ELSE
$$ This is COOLNT/ON or FLOOD, etc.
DMY=POSTF(2,1,3425,2) $$ set INTCOM 3425 to 2 (output with next Z)
ENDIF
DMY=POSTF(13) $$ process COOLNT
CIMFIL/OFF $$ end of CIMFIL on COOLNT

5. Save the post and post-process pplab1.ncl to see the result. Notice that COOLNT/OFF is now
processed immediately. This technique demonstrates yet another CIMFIL application: how to
change the value of an internal post-processor variable.

6. Your next task is to support a special coolant code (M12), available only for a particular
tool station number: T3. You must therefore create a FIL routine on COOLNT (or rather
modify the existing one) in order to replace M8 by M12 only if the current tool is tool #3.
First you must find the common variable which stores the current tool number. Select

100
the Common/PLABELs category and the sub-panel Search and type current tool
number”:

The variable is DBLCOM 497.

7. Now modify your FIL routine on COOLNT:

CIMFIL/ON,COOLNT $$ starts on all COOLNT


COLTYP=POSTF(7,4) $$ first argument of COOLNT
IF(COLTYP.EQ.ICODEF(OFF)) THEN
$$ This is COOLNT/OFF
DMY=POSTF(2,1,3425,0) $$ set INTCOM 3425 to 0 (output now)
ELSE
$$ This is COOLNT/ON or FLOOD or ….
DMY=POSTF(2,1,3425,2) $$ set INTCOM 3425 to 2 (output with next Z)
ENDIF
CURTOL=POSTF(1,3,497) $$ Get DBLCOM 497 (current tool number)
IF(CURTOL.EQ.3) THEN
$$ Replace M8 by M12 for the next output
T1=TEXT/’M8’
T2=TEXT/’M12’
REPLAC/T1,T2,1,1
ENDIF
DMY=POSTF(13) $$ Process COOLNT
CIMFIL/OFF $$ End of CIMFIL on COOLNT

Do not forget to add REDEF/ON in the global area of the FIL file to allow the redefinition of
variables (T1 and T2).

8. Save the post and post-process pplab1.ncl to see the result. Check that the coolant code for
tool 3 is now M12. This technique demonstrates another CIMFIL application: how to check the
current value of an internal post-processor variable.

9. Finally, you must ensure that prior to the first occurrence of a circular interpolation record,
the post will always output the appropriate G code for the interpolation plane selection
(i.e. G17, G18 or G19). On one hand, the default plane is set to G17 in the option file, and

101
on the other hand the CL file pplab1.ncl only contains arcs generated in the XY plane. As

a result, the post will never output a G17. You may begin by finding the common variable
which stores the current interpolation plane. To do so, select the Common/PLABELs
category and the sub-panel Search, then type the word plane:

The variable is INTCOM 619

Now you can write a FIL routine on LOADTL to reset this variable at every tool change:

CIMFIL/ON,LOADTL $$ start on all LOADTL statements


DMY=POSTF(13) $$ process the LOADTL record
DMY=POSTF(3,1,619) $$ set INTCOM 619 to EMPTY
CIMFIL/OFF

10. Save the post and post-process pplab1.ncl to see the result. Check if the G17 code is
generated before the first circular interpolation of each tool path. This demonstrates
another CIMFIL application: how to set an internal post-processor variable to EMPTY.

Additional tasks:

 Find the variable storing the previous FEDRAT mode.


 Find the variables storing the minimum and maximum XYZ values for limit checking.
 Find the variables storing the last X CL file position.

102
Exercise 11
File I/O
This exercise demonstrates how to open, read and write to and from external ASCII files.

Exercise Steps:

1. Create a post-processor for a milling machine, using the control defaults FANUC 16M.
Save the new post as UNCX01.P17 and use it to post-process the CL file pplab1.ncl
from the Pro/NC manufacturing model pplab1.mfg. Analyze the results (pplab1.tap).
You may notice that after every tool change, the machine moves in Z first then in XY.
This could be very dangerous, considering the existing part / fixture collision conditions.
The post is actually performing the so-called “Motion Analysis”, in order to square off
RAPID moves, but has no information on the actual Z-axis value of the tool change.

To fix this problem, simply modify the Z level used for the tool change: Select the Tool
Change Sequence category and the sub-panel Tool Change Coordinates and set the
Z coordinate to 50.

Save the post-processor and run it again. Notice the effects of your modification.

2. One of the custom requirements of this machine consists in a outputting list of all the
tool used in the NC program at the beginning of the tape. To do so, you must write a
FIL routine on MACHIN and read all necessary tool information from an external ASCII
file named clfilename.tl1, generated by GPOST before the execution of the post. For
example, if the CL file used for testing is pplab1.ncl, the .tl1 file will be pplab1.ncl.tl1.

103
Here is a sample of this ASCII text file:

6
           6   1        1.0000         .0000         .0000         .0000         .0000  0  0
          36   1        2.0000         .0000         .0000         .0000         .0000  0  0
         292   1        3.0000         .0000         .0000         .0000         .0000  0  0
 ….

The first line displays the total number of tools, 6. Each of the following lines describes the
tool change: the CL record number, the tool change type (1:LOADTL, 2:TURRET), the tool
number, the offset number, the tool length, the X gauge length (for TURRET), the Y gauge
length (for TURRET also), the TURRET index direction (1:CLW, -1:CCLW) and finally the
TURRET selected (1:FRONT, 2:REAR, 4:MAIN).
CIMFIL/ON,MACHIN
DMY=POSTF(13) $$ process the MACHIN record
CLNAME=TEXT/PART $$ CL file name
T1=TEXT/'.'
NCLPOS=INDXF(CLNAME,T1) $$ find position of . in CLname
$$ remove the version number of the CL file name
FNAME=TEXT/RANGE,CLNAME,1,NCLPOS+4
FNAME=TEXT/FNAME,'TL1' $$ add the extension TL1
FEXT=FILEF(1,7,FNAME) $$ check if the file exists
IF(FEXT.EQ.1) THEN $$ found the file
INSERT/(TEXT'( TOOL LIST )$') $$ header
FOPEN=FILEF(1,2,FNAME) $$ open external file
TBUFF=TEXT/READ,1 $$ read 1st line of the file
MXTL=SCALF(TBUFF) $$ convert string to real
IF(MXTL.GT.0)THEN
DO/ENDDO,I=1,MXTL,1 $$ loop in the TL1 file
TBUFF=TEXT/READ,1 $$ read next line
TLNUM=TEXT/RANGE,TBUFF,17,30 $$ tool number starts column 17
TLVAL=SCALF(TLNUM) $$ convert to real
INSERT/(TEXT/'( TOOL ',TLVAL,')$')
ENDDO) CONTIN
IF(FOPEN.EQ.0) THEN
FCLOS=FILEF(1,5) $$ close the external file
ENDIF
ENDIF
INSERT/'(---------)$' $$ end tool list
ENDIF
CIMFIL/OFF

Save the post and post-process pplab1.ncl to see the results:

%
N5 G70
N10( TOOL LIST )
N15( TOOL 1)
N20( TOOL 2)
N25( TOOL 3)
N30( TOOL 4)

104
N35( TOOL 5)
N40( TOOL 6)
N45(---------)
N50 T1 M06
...

3. Another typical CIMFIL application includes techniques to prompt the user for various
information not included in the CL file, such as the part revision number. The answer
will be then displayed together with the PARTNO text:

First write a FIL on PARTNO to store the part name:

CIMFIL/ON,PARTNO $$ starts on PARTNO


TPART=TEXT/CLW $$ extract text of PARTNO
TPART=TEXT/OMIT,TPART,1 $$ remove the trailing blanks
CIMFIL/OFF

Now add some new lines to your existent MACHIN routine:

CIMFIL/ON,MACHIN
DMY=POSTF(13)
PROMPT=TEXT/'PART',TPART,' - Revision ?:'
RSLT=FILEF(0,1,PROMPT)
STRNG=TEXT/READ,0
SCALR=SCALF(STRNG)
PRGNM=TEXT/CONVF,SCALR,5,0,0,1,1
INSERT/(TEXT/'(',TPART,' - REV:',PRGNM,')$')
...

Additional tasks:

 Add the tool offset with the tool number in the tool list at the beginning of the tape.
 Remove the / in the revision number message.

105
Section Three
EXERCISE SOLUTIONS

106
– page intentionally left blank –

107
Solutions for Exercise 1 – Additional Tasks

Output Operator messages with the following format: (MSG, message )


Select the Operator Msgs / Insert Category

Set the maximum spindle speed to 4000RPM


Select the Spindle Code category, sub-panel Direct RPM Speeds

108
Set the maximum feedrate to 200 IPM
Select the Feedrates category, sub-panel UPM Mode

Set the RAPID feedrate to 200 IPM


Select the Rapid Motions Category

109
Change the circular interpolation method to Radius instead of Center (maximum
arc should be 180˚)
Select the Circular Codes Category, sub-panel General

Output the current Date and Time at the beginning of the program
Select the Startup/End of Program category, sub-panel General

110
Output safe startup blocks at the beginning of the program
G90G80G94
G40G49
Select the Startup/End of Program category, sub-panel Default Prep/G-Codes

111
Solutions for Exercise 2 – Additional Tasks

Reposition the B register after Z


Select the MCD File Format category and move the B register.

Create a Q register for the Step value in CYCLEs


Select the MCD File Format category and create a new register called Q using Extra #1

112
Set the format of this register and move the register Q after Z.

Select Motion & Cycles category and assign Q to Cycle Deep.

Output Block and Tool time in the listing file (using PLABEL options)
Select the Common/PLABELs category , sub-panel Search and look for the word time.

113
Modify PLABEL 36 by selecting the 31-40 tab then setting PLABEL 36 to the option:
Output Block and Tool Time to List File.

Set the G code for UPM to G94


Select the Feedrates category, sub-panel UPM Mode and set the Prep/G Code that
establishes UPM Mode to 94.

114
Add the following lines at the end of the program:
G28G91Z0
M30
Select the Startup/End of Program category, sub-panel End of Program and check the
“Output user-defined end of program blocks” box.

115
Solutions for Exercise 3 – Additional Tasks

Some B value are greater or equal 370. Modify the B axis behavior in Optfile to
have values between 0 and 359.99
Select the Machine Tool Type category, sub-panel 4 Axis Rot. Table and check the
“-359.99 and +359.99” box.

Insert a blank between each address.


Select the MCD File Format category and check the “Insert a blank before each
address” box.

116
Output the coolant with the next XY move
Select the Coolant Aux/M-Codes category and set the Output Type to “with the next
XY block”

117
Solutions for Exercise 5 – Additional Tasks

Write a FIL routine to replace all RAPID records by FEDRAT/200,IPM

CIMFIL/ON,RAPID $$ starts on all RAPID statements


FEDRAT/200,IPM $$ issue a FEDRAT instead of RAPID
CIMFIL/OFF $$ end of CIMFIL on RAPID

Modify the SPINDL FIL routine to output the AIR command after the processing of SPINDL.

The new CIMFIL routine shall be:

CIMFIL/ON,SPINDL $$ starts on all SPINDL statements


DMY=POSTF(13) $$ process the SPINDL command
PARAM=POSTF(7,4) $$ first parameter of SPINDL command
IF(PARAM.EQ.ICODEF(OFF)) THEN
$$ it is not SPINDL/OFF; start the air flow
AUXFUN/12
ENDIF
CIMFIL/OFF $$ end of CIMFIL on SPINDL

Remove all PPRINT records containing the word COMMENTS

CIMFIL/ON,PPRINT $$ Starts on all PPRINT


TTEXT=TEXT/CLW $$ extract the text
TCOM=TEXT/’COMMENTS’ $$ comparison string
OK=INDXF(TTEXT,TCOM) $$ search for TCOM in TTEXT
IF(OK.EQ.0) THEN
$$ TCOM is not found in TTEXT
DMY=POSTF(13) $$ process PPRINT
ENDIF
CIMFIL/OFF $$ end of CIMFIL on PPRINT

In order to test this routine, create a PPRINT table in Pro/NC to output TOOL COMMENTS
and load it in the pplab1.mfg manufacturing model.

118
Solutions for Exercise 7 – Additional Tasks
Simplify the PARTNO routine to not use two text variables
To allow the redefinition of a variable, add a REDEF/ON command in the FIL global area.

Remove the / in operator messages


Replace all occurrences of ‘( /’ by ‘(‘ using the REPLAC command in the FIL global area:

T1=TEXT/’( /’
T2=TEXT/’(‘
REPLAC/T1,T2

Output the CL file name to the tape


The PART modifier returns the CL file name. Add the following lines in the FIL routine on
MACHIN:

CLNM=TEXT/PART
INSERT/(TEXT/‘(‘,CLNM,’)$’)

Output the current Date and Time to the tape


The DATE modifier returns the CL file name. Add the following lines in the FIL routine on
MACHIN:

CURDT=TEXT/DATE
INSERT/(TEXT/‘(‘,CURDT,’)$’)

119
Solutions for Exercise 8 – Additional Tasks
Remove the G20 code at the beginning of the tape
The G20 is automatically generated by GPOST. Therefore you need to modify this
setting in Optfile.

1. Start Optfile and load the UNCX01.P13 post-processor.


2. Select the Startup/End of Program category and the sub-panel Default Prep./G
Codes and uncheck the G20 Output code to Tape Image box:

Put the tool name after the tool change


The tool name can be found on a specific PPRINT record in the Pro/NC CL file.
Start by defining two variables in the FIL global area:

OKTOOL=0 $$ flag if the tool name is present


TOOLNM=TEXT/’NONAME$‘ $$ default for tool name string

Then write a FIL routine on PPRINT to extract the tool name:

CIMFIL/ON,PPRINT $$ starts on all PPRINT


MESS = TEXT/CLW $$ extract the text of the PPRINT
TESTV=TEXT/’TOOL NAME’$$ Value to test for
RSLT=INDXF(MESS,TESTV)$$ Test if TESTV is in MESS
IF(RSLT.EQ.0) THEN
PPRINT/MESS $$ process the PPRINT
ELSE
OKTOOL=1 $$ flag tool name programmed
TOOLNM=TEXT/MESS $$ store tool name
ENDIF
CIMFIL/OFF $$ end of CIMFIL on PPRINT

120
And finally output the tool name using a FIL routine on LOADTL. Just add the following
lines at the end of the current LOADTL routine, just before CIMFIL/OFF:

IF(OKTOOL.EQ.1) THEN
OKTOOL=0 $$ reset the flag
PPRINT/TOOLNM $$ output the message
ENDIF

Ensure that all sub-programs start with either G00 or G01

The post does not process directly the DEFSUB, ENDSUB and CALSUB statements.
Therefore all G codes required for rapid moves and linear interpolation are still considered
modal. As a result, the post may see the first GOTO in a sub-program as the continuation of
a previous GOTO. The solution is to reset the common variable which stores the previous
feedrate mode at the beginning of each sub-program.

First you must find this variable:

1. Start Optfile and load the UNCX01.P13 post-processor.

2. Select the Common/PLABELs category and the sub-panel Search and look for the
words FEDRAT mode:

The variable to reset (to EMPTY) is INTCOM 493.

3. Add the following line to the current FIL on DEFSUB, just before CIMFIL/OFF:

DMY=POSTF(3,1,493) $$ Reset previous feed mode to EMPTY

121
Ignore SPINDL/OFF

CIMFIL / ON, SPINDL $$ starts on all SPINDL


ARG1=POSTF(7,4) $$ first argument
TYP1=POSTF(6,4) $$ type of the first argument
$$ Test the first argument to see if it is OFF
IF(TYP1.EQ.0.AND.ARG1.EQ.(ICODEF(OFF))) THEN
CONTIN $$ do nothing
ELSE
DMY=POSTF(13) $$ process SPINDL
ENDIF
CIMFIL / OFF $$ end of CIMFIL on SPINDL

122
Solutions for Exercise 10 – Additional Tasks
Find the variable for the previous FEDRAT mode

Find the variables for minimum and maximum XYZ values for limit checking

123
Find the variables for the last X CL file position

124
Solutions for Exercise 11 – Additional Tasks

Add the tool offset with the tool number in the tool list at the beginning of the tape.

The offset number starts at column 31 of the TL1 file.


The new DO loop in the MACHIN routine will be:

...
DO/ENDDO,I=1,MXTL,1 $$ loop in the TL1 file
TBUFF=TEXT/READ,1 $$ read next line
TLNUM=TEXT/RANGE,TBUFF,17,30 $$ tool nb. starts column 17
TLOFF=TEXT/RANGE,TBUFF,31,44 $$ offset nb. starts column 31
TLVAL=SCALF(TLNUM) $$ convert to real
OFFVAL=SCALF(TLOFF) $$ convert to real
INSERT/(TEXT/'( TOOL ',TLVAL,' OFFSET ‘,OFFVAL, )$')
ENDDO) CONTIN $$ label for the DO loop
...

Remove the / in the revision number message

You may use two different techniques to accomplish this task:

1. Use the REPLAC command in the FIL global area:


T1=TEXT/‘( /’
T2=TEXT/’(‘
REPLAC/T1,T2

2. Add the following lines to the FIL routine on PARTNO to extract the substring after the /.

CIMFIL/ON,PARTNO $$ starts on PARTNO


FPART=TEXT/CLW $$ extract PARTNO text
FPART=TEXT/OMIT,FPART,1 $$ remove trailing blanks
T1=TEXT/’/’
SPOS=INDXF(FPART,T1) $$ position of / in string
LPOS=CANF(FPART,1) $$ number of characters in FPART string
TPART=TEXT/RANGE,FPART,SPOS+1,LPOS
CIMFIL/OFF

125
– page intentionally left blank –

126
– page intentionally left blank –

127
APPENDIXES

128
– page intentionally left blank –

129
Appendix 1: Sample FIL Files

TEMPLATE.FIL A template FIL file


SAMPLE1.FIL A sample of how to ignore an unwanted command
SAMPLE2.FIL A sample of how to replace a command with another command
SAMPLE3.FIL A sample of how to add output to an existing command
SAMPLE4.FIL A sample of how to add a new command
SAMPLE5.FIL A sample of how to enhance an existing command
SAMPLE6.FIL A sample of how to output stuff at the beginning of the MCD file
SAMPLE7.FIL A sample of how to output stuff at the end of the file
SAMPLE8.FIL A sample of how to write to a file
SAMPLE9.FIL A sample of how to read ahead in the CL file
SAMPLE10.FIL A sample of how to output the first motion after a command
SAMPLE11.FIL A sample of how to change post settings based on a command
FADAL.FIL A sample of some unique FIL stuff
PARTNO.FIL A sample of reading the PARTNO to retrieve information
MAD1.FIL The MAD routines for changing letter address aliases
CLEARP.FIL A sample of how to catch the CLEARP command
CYCLE.FIL A sample of how to replace/change things in a CYCLE command

130
$$ *******************************************************
$$ *          FIL TEMPLATE FILE FOR TRAINIG              *
$$ *******************************************************

$$ PRINT/OFF,IN $$ USE FOR PRODUCTION
$$ DMY = POSTF(24,0) $$ USE FOR PRODUCTION
PRINT/ON $$ USE FOR TESTING
DMY = POSTF(24,1) $$ USE FOR TESTING

$$ *******************************************************
$$ *    G L O B A L   V A R I A B L E   S E C T I O N    *
$$ *******************************************************

  LTSW = 0 $$ DEFAULT LOADTL SWITCH
  CNT = 0  $$ DEFAULT COUNTER

$$ *******************************************************
$$ *       G L O B A L   M A C R O   S E C T I O N       *
$$ *******************************************************

  TWARN = MACRO/
    $$ THIS MACRO GETS THE TOTAL NUMBER OF WARNINGS FROM THE POST
    $$ AND INCREMENTS IT BY ONE, RESETING THE NEW VALUE.
    TW = POSTF(1,1,1932) $$ GET THE TOTAL # OF POST WARNINGS
    TW = TW + 1   $$ ADD 1
    DMY = POSTF(2,1,1932,TW) $$ RESET THE TOTAL # OF POST WARNINGS
  TERMAC

$$ *******************************************************
$$ *          E N D   O F   F I L   F I L E              *
$$ *******************************************************
 
FINI 

131
$$ *******************************************************
$$ *            SAMPLE 1 FIL FILE FOR TRAINIG            *
$$ *******************************************************

$$ PRINT/OFF,IN $$ USE FOR PRODUCTION
$$ DMY = POSTF(24,0) $$ USE FOR PRODUCTION
PRINT/ON $$ USE FOR TESTING
DMY = POSTF(24,1) $$ USE FOR TESTING

$$ *******************************************************
$$ *       A B O U T   T H I S   F I L   F I L E         *
$$ *******************************************************

$$ THIS IS A SAMPLE FIL FILE TO SHOW HOW TO IGNORE A COMMAND

$$ *******************************************************
$$ *    G L O B A L   V A R I A B L E   S E C T I O N    *
$$ *******************************************************

  LTSW = 0 $$ DEFAULT LOADTL SWITCH
  CNT = 0  $$ DEFAULT COUNTER

$$ *******************************************************
$$ *       G L O B A L   M A C R O   S E C T I O N       *
$$ *******************************************************

  TWARN = MACRO/
    $$ THIS MACRO GETS THE TOTAL NUMBER OF POST WARNINGS 
    $$ AND INCREMENTS IT BY ONE, RESETTING THE NEW VALUE.
    TW = POSTF(1,1,1932) $$ GET THE TOTAL # OF POST WARNINGS
    TW = TW + 1   $$ ADD 1
    DMY = POSTF(2,1,1932,TW) $$ RESET THE TOTAL # OF POST WARNINGS
  TERMAC

$$ *******************************************************
$$ *           C O O L N T     S E C T I O N             *
$$ *******************************************************

CIMFIL/ON, COOLNT
$$ IGNORE ALL COOLNT COMMANDS IN THE CL FILE
CIMFIL/OFF

$$ *******************************************************
$$ *          E N D   O F   F I L   F I L E              *
$$ *******************************************************
 
FINI 

132
$$ *******************************************************
$$ *          SAMPLE 2 FIL FILE FOR TRAINIG              *
$$ *******************************************************

$$ PRINT/OFF,IN $$ USE FOR PRODUCTION
$$ DMY = POSTF(24,0) $$ USE FOR PRODUCTION
PRINT/ON $$ USE FOR TESTING
DMY = POSTF(24,1) $$ USE FOR TESTING

$$ *******************************************************
$$ *       A B O U T   T H I S   F I L   F I L E         *
$$ *******************************************************

$$ THIS IS A SAMPLE FIL FILE TO SHOW HOW TO TAKE AN EXISTING COMMAND
$$ GOHOME AND CHANGE ITS OUTPUT USING POSTN OR INSERT

$$ *******************************************************
$$ *    G L O B A L   V A R I A B L E   S E C T I O N    *
$$ *******************************************************

  LTSW = 0 $$ DEFAULT LOADTL SWITCH
  CNT = 0  $$ DEFAULT COUNTER

$$ *******************************************************
$$ *       G L O B A L   M A C R O   S E C T I O N       *
$$ *******************************************************

  TWARN = MACRO/
    $$ THIS MACRO GETS THE TOTAL NUMBER OF POST WARNINGS 
    $$ AND INCREMENTS IT BY ONE, RESETTING THE NEW VALUE.
    TW = POSTF(1,1,1932) $$ GET THE TOTAL # OF POST WARNINGS
    TW = TW + 1   $$ ADD 1
    DMY = POSTF(2,1,1932,TW) $$ RESET THE TOTAL # OF POST WARNINGS
  TERMAC

$$ *******************************************************
$$ *           G O H O M E     S E C T I O N             *
$$ *******************************************************

CIMFIL/ON,GOHOME $$ CATCH THE GOHOME COMMANDS 
   DMY = POSTF(2,1,1867,1) $$ POST SIMULATION MODE ON
   DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD
   DMY = POSTF(2,1,1867,0) $$ POST SIMULATION MODE OFF
   POSTN/OUT,7,28,24,0,25,0,26,0 $$ OUTPUT G28X0Y0Z0
   $$ INSERT/'G28X0.Y0.Z0.$' $$ COULD USE THIS LINE INSTEAD
CIMFIL/OFF

$$ *******************************************************
$$ *          E N D   O F   F I L   F I L E              *
$$ *******************************************************
 
FINI 

133
$$ *******************************************************
$$ *          SAMPLE 3 FIL FILE FOR TRAINIG              *
$$ *******************************************************

$$ PRINT/OFF,IN $$ USE FOR PRODUCTION
$$ DMY = POSTF(24,0) $$ USE FOR PRODUCTION
PRINT/ON $$ USE FOR TESTING
DMY = POSTF(24,1) $$ USE FOR TESTING

$$ *******************************************************
$$ *       A B O U T   T H I S   F I L   F I L E         *
$$ *******************************************************

$$ THIS IS A SAMPLE FIL FILE TO SHOW HOW TO TAKE AN EXISTING COMMAND
$$ LOADTL AND ADD ADDITIONAL OUTPUT LIKE OPSTOP WITH IT

$$ *******************************************************
$$ *    G L O B A L   V A R I A B L E   S E C T I O N    *
$$ *******************************************************

  LTSW = 0 $$ DEFAULT LOADTL SWITCH
  CNT = 0  $$ DEFAULT COUNTER

$$ *******************************************************
$$ *       G L O B A L   M A C R O   S E C T I O N       *
$$ *******************************************************

  TWARN = MACRO/
    $$ THIS MACRO GETS THE TOTAL NUMBER OF POST WARNINGS 
    $$ AND INCREMENTS IT BY ONE, RESETTING THE NEW VALUE.
    TW = POSTF(1,1,1932) $$ GET THE TOTAL # OF POST WARNINGS
    TW = TW + 1   $$ ADD 1
    DMY = POSTF(2,1,1932,TW) $$ RESET THE TOTAL # OF POST WARNINGS
  TERMAC

$$ *******************************************************
$$ *           L O A D T L     S E C T I O N             *
$$ *******************************************************

CIMFIL/ON,LOADTL $$ CATCH THE LOADTL COMMANDS 
   DMY = POSTF(20) $$ SAVE THE CURRENT CL RECORD
   OPSTOP $$ OUTPUT OPSTOP M01
   DMY = POSTF(21) $$ RELOAD SAVED CL RECORD TO CURRENT
   DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD
CIMFIL/OFF

$$ *******************************************************
$$ *          E N D   O F   F I L   F I L E              *
$$ *******************************************************
 
FINI 

134
$$ *******************************************************
$$ *          SAMPLE 4 FIL FILE FOR TRAINIG              *
$$ *******************************************************

$$ PRINT/OFF,IN $$ USE FOR PRODUCTION
$$ DMY = POSTF(24,0) $$ USE FOR PRODUCTION
PRINT/ON $$ USE FOR TESTING
DMY = POSTF(24,1) $$ USE FOR TESTING

$$ *******************************************************
$$ *       A B O U T   T H I S   F I L   F I L E         *
$$ *******************************************************

$$ THIS IS A SAMPLE FIL FILE TO SHOW HOW TO ADD A NEW COMMAND
$$ XHOME/value. IF NO VALUE IS SPECIFIED DEFAULT = 30

$$ *******************************************************
$$ *    G L O B A L   V A R I A B L E   S E C T I O N    *
$$ *******************************************************

  LTSW = 0 $$ DEFAULT LOADTL SWITCH
  CNT = 0  $$ DEFAULT COUNTER
  PPWORD/XHOME,1351 $$ ADD THE WORD XHOME TO THE FIL SYSTEM,

$$ *******************************************************
$$ *       G L O B A L   M A C R O   S E C T I O N       *
$$ *******************************************************

  TWARN = MACRO/
    $$ THIS MACRO GETS THE TOTAL NUMBER OF POST WARNINGS 
    $$ AND INCREMENTS IT BY ONE, RESETTING THE NEW VALUE.
    TW = POSTF(1,1,1932) $$ GET THE TOTAL # OF POST WARNINGS
    TW = TW + 1   $$ ADD 1
    DMY = POSTF(2,1,1932,TW) $$ RESET THE TOTAL # OF POST WARNINGS
  TERMAC

$$ *******************************************************
$$ *           X H O M E       S E C T I O N             *
$$ *******************************************************

CIMFIL/ON,XHOME $$ CATCH THE XHOME COMMANDS 
   XH = 30 $$ DEFAULT X HOME LOCATION
   NW = POSTF(5) $$ GET THE NUMBER OF CL WORDS
   IF(NW .GT. 3)THEN $$ IF VALUE AFTER THE SLASH
    TYP = POSTF(6,4) $$ IS IT A MINOR WORD OR VALUE
    IF(TYP.EQ.0)THEN $$ ERROR ITS A MINOR WORD
     CALL/TWARN $$ RESET THE # OF WARNINGS
     PPRINT/'***WARNING, INVALID XHOME COMMAND'
     JUMPTO/DONE $$ GET OUT
    ELSE
     XH = POSTF(7,4) $$ GET THE VALUE ENTERED
    ENDIF
   ENDIF
   DMY = POSTF(2,1,1867,1) $$ POST SIMULATION MODE ON
   GOTO/XH,0,0 $$ SET THE POST COMMOND WITH THE COORDINATES
   DMY = POSTF(2,1,1867,0) $$ POST SIMULATION MODE ON
   POSTN/ALL $$ CLEAR MODAL REGISTERS
   POSTN/OUT,7,0,24,XH,25,0,26,0 $$ OUTPUT G00XvalueY0Z0   
   DONE) CONTIN
CIMFIL/OFF

$$ *******************************************************
$$ *          E N D   O F   F I L   F I L E              *
$$ *******************************************************
 
FINI 

135
$$ *******************************************************
$$ *          SAMPLE 5 FIL FILE FOR TRAINIG              *
$$ *******************************************************

$$ PRINT/OFF,IN $$ USE FOR PRODUCTION
$$ DMY = POSTF(24,0) $$ USE FOR PRODUCTION
PRINT/ON $$ USE FOR TESTING
DMY = POSTF(24,1) $$ USE FOR TESTING

$$ *******************************************************
$$ *       A B O U T   T H I S   F I L   F I L E         *
$$ *******************************************************

$$ THIS IS A SAMPLE FIL FILE TO SHOW HOW TO ENHANCE A COMMAND
$$ COOLNT. ADD THE FOLLOWING SYNTAX AND OUTPUT
$$
$$ COOLNT/ON $$ OUTPUT LAST M CODE 
$$ COOLNT/OFF $$ OUTPUT M09
$$ COOLNT/FLOOD $$ OUTPUT M08
$$ COOLNT/MIST $$ OUTPUT M07
$$ COOLNT/THRU,LOW $$ OUTPUT M17
$$ COOLNT/THRU,HIGH $$ OUTPUT M18
$$ COOLNT/WASH $$ OUTPUT M53
$$ 
$$ COOLNT/ON­OFF­FLOOD­MIST ARE EXISTING SYNTAX THE REST WE WILL ADD 

$$ *******************************************************
$$ *    G L O B A L   V A R I A B L E   S E C T I O N    *
$$ *******************************************************

  LTSW = 0 $$ DEFAULT LOADTL SWITCH
  CNT = 0  $$ DEFAULT COUNTER

  PPWORD/WASH,1352 $$ ADD THE WORD WASH TO THE FIL SYSTEM,
$$ ALSO TO THE APT FILE. 1352 IS THE
$$ INTEGER CODE

$$ *******************************************************
$$ *       G L O B A L   M A C R O   S E C T I O N       *
$$ *******************************************************

  TWARN = MACRO/
    $$ THIS MACRO GETS THE TOTAL NUMBER OF POST WARNINGS 
    $$ AND INCREMENTS IT BY ONE, RESETTING THE NEW VALUE
    TW = POSTF(1,1,1932) $$ GET THE TOTAL # OF POST WARNINGS
    TW = TW + 1   $$ ADD 1
    DMY = POSTF(2,1,1932,TW) $$ RESET THE TOTAL # OF POST WARNINGS
  TERMAC

$$ *******************************************************
$$ *          C O O L N T      S E C T I O N             *
$$ *******************************************************

CIMFIL/ON,COOLNT $$ CATCH THE COOLNT COMMANDS 
  TYP = POSTF(6,4) $$ GET THE CL WORD TYPE 1=VALUE 0=INTEGER CODE
  IF(TYP .EQ. 1)THEN
    DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD, THIS IS AN ERROR
  ELSE 
    KULTYP = POSTF(7,4) $$ GET THE 4TH CL WORD 
    CASE / KULTYP $$ WHAT IS THE 4TH CL WORD
      WHEN / (ICODEF(ON)),(ICODEF(OFF)),(ICODEF(FLOOD)),(ICODEF(MIST))
        DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD
      WHEN / (ICODEF(WASH)) $$ GOT COOLNT/WASH
        DMY = POSTF(2,1,1962,53) $$ SET COOLNT/ON TO M53 OUTPUT
        COOLNT/ON $$ EXECUTE COOLNT/ON, OUTPUT M53

136
      WHEN / (ICODEF(THRU))
       NW = POSTF(5) $$ GET THE NUMBER OF CL WORDS
       IF(NW.GT.4)THEN
        5TY = POSTF(6,5) $$ GET THE CL WORD TYPE,1=VALUE 0=INTEGER CODE
        IF(5TY .EQ. 1)THEN
         DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD, ERROR 
        ELSE
         5WD = POSTF(7,5) $$ GET THE 5TH CL WORD COOLNT/THRU,5TH
         CASE / 5WD $$ WHAT IS THE 5TH CL WORD
  WHEN / (ICODEF(LOW)) $$ GOT COOLNT/THRU,LOW               
           DMY = POSTF(2,1,1962,17) $$ SET COOLNT/ON TO M17 OUTPUT
           COOLNT/ON $$ EXECUTE COOLNT/ON, OUTPUT M17
  WHEN / (ICODEF(HIGH)) $$ GOT COOLNT/THRU,HIGH               
           DMY = POSTF(2,1,1962,18) $$ SET COOLNT/ON TO M18 OUTPUT
           COOLNT/ON $$ EXECUTE COOLNT/ON, OUTPUT M18
  WHEN / OTHERS $$ GOT COOLNT/THRU,??? ERROR COMMAND         
           DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD, ERROR 
         ENDCAS  
        ENDIF
       ELSE
         DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD, ERROR 
       ENDIF
      WHEN / OTHERS $$ INVALID COOLNT COMMANDS
       DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD, ERROR 
     ENDCAS  
    ENDIF
CIMFIL/OFF

$$ *******************************************************
$$ *          E N D   O F   F I L   F I L E              *
$$ *******************************************************
 
FINI 

137
$$ *******************************************************
$$ *          SAMPLE 6 FIL FILE FOR TRAINIG              *
$$ *******************************************************

$$ PRINT/OFF,IN $$ USE FOR PRODUCTION
$$ DMY = POSTF(24,0) $$ USE FOR PRODUCTION
PRINT/ON $$ USE FOR TESTING
DMY = POSTF(24,1) $$ USE FOR TESTING

$$ *******************************************************
$$ *       A B O U T   T H I S   F I L   F I L E         *
$$ *******************************************************

$$ THIS IS A SAMPLE FIL FILE TO SHOW HOW TO OUTPUT STUFF AT THE BEGINING
$$ OF THE PUNCH FILE. SUCH AS G70G90G40G17 FOLLOWED BY THE PROCESS TIME AND DATE
$$

$$ *******************************************************
$$ *    G L O B A L   V A R I A B L E   S E C T I O N    *
$$ *******************************************************

  LTSW = 0 $$ DEFAULT LOADTL SWITCH
  CNT = 0  $$ DEFAULT COUNTER

$$ *******************************************************
$$ *       G L O B A L   M A C R O   S E C T I O N       *
$$ *******************************************************

  TWARN = MACRO/
    $$ THIS MACRO GETS THE TOTAL NUMBER OF POST WARNINGS 
    $$ AND INCREMENTS IT BY ONE, RESETTING THE NEW VALUE.
    TW = POSTF(1,1,1932) $$ GET THE TOTAL # OF POST WARNINGS
    TW = TW + 1   $$ ADD 1
    DMY = POSTF(2,1,1932,TW) $$ RESET THE TOTAL # OF POST WARNINGS
  TERMAC

$$ *******************************************************
$$ *          M A C H I N      S E C T I O N             *
$$ *******************************************************

CIMFIL/ON,MACHIN $$ CATCH THE MACHIN COMMANDS 
  DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD
  DMY = POSTF(2,1,1925,3) $$ TURN OFF DEFAULT G CODE OUTPUT @ BEGINING
  DMY = POSTF(26,2,(ICODEF(MACHIN)),0) $$ TURN OFF THIS FIL ROUTINE
  PREFUN/70,NEXT $$ OUTPUT G70 WITH NEXT BLOCK
  PREFUN/40,NEXT $$ OUTPUT G40 WITH NEXT BLOCK
  PREFUN/90,NEXT $$ OUTPUT G90 WITH NEXT BLOCK
  PREFUN/17 $$ OUTPUT G17G90G70G40
  TIME = TEXT/TIMES $$ GET THE CURRENT CPU TIME AND DATE
  PPRINT/'JOB PROCESSED @ ',TIME $$ OUTPUT TIME AND DATE @ BEGINNING
CIMFIL/OFF

$$ *******************************************************
$$ *          E N D   O F   F I L   F I L E              *
$$ *******************************************************
 
FINI 

138
$$ *******************************************************
$$ *          SAMPLE 7 FIL FILE FOR TRAINIG              *
$$ *******************************************************

$$ PRINT/OFF,IN $$ USE FOR PRODUCTION
$$ DMY = POSTF(24,0) $$ USE FOR PRODUCTION
PRINT/ON $$ USE FOR TESTING
DMY = POSTF(24,1) $$ USE FOR TESTING

$$ *******************************************************
$$ *       A B O U T   T H I S   F I L   F I L E         *
$$ *******************************************************

$$ THIS IS A SAMPLE FIL FILE TO SHOW HOW TO OUTPUT STUFF AT THE END
$$ OF THE PUNCH FILE. SUCH AS M02 M30
$$ ALSO THROW AWAY ANT END OR REWIND IN THE ACL FILE 

$$ *******************************************************
$$ *    G L O B A L   V A R I A B L E   S E C T I O N    *
$$ *******************************************************

  LTSW = 0 $$ DEFAULT LOADTL SWITCH
  CNT = 0  $$ DEFAULT COUNTER

$$ *******************************************************
$$ *       G L O B A L   M A C R O   S E C T I O N       *
$$ *******************************************************

  TWARN = MACRO/
    $$ THIS MACRO GETS THE TOTAL NUMBER OF POST WARNINGS 
    $$ AND INCREMENTS IT BY ONE, RESETTING THE NEW VALUE.
    TW = POSTF(1,1,1932) $$ GET THE TOTAL # OF POST WARNINGS
    TW = TW + 1   $$ ADD 1
    DMY = POSTF(2,1,1932,TW) $$ RESET THE TOTAL # OF POST WARNINGS
  TERMAC

$$ *******************************************************
$$ *             F I N I    S E C T I O N                *
$$ *******************************************************

CIMFIL/ON,14 $$ CATCH THE FINI COMMANDS (TYPE 14000 CL) 
  DMY = POSTF(20) $$ SAVE THE CURRENT CL RECORD
  END  $$ OUTPUT END OF TAPE M02
  REWIND $$ OUTPUT REWIND M30
  DMY = POSTF(21) $$ RELOAD THE SAVED CL RECORD
  DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD
CIMFIL/OFF

$$ *******************************************************
$$ *          R E W I N D   S E C T I O N                *
$$ *******************************************************

CIMFIL/ON,REWIND $$ CATCH THE REWIND COMMANDS  
  $$ THROW AWAY THE REWIND COMMAND
CIMFIL/OFF

$$ *******************************************************
$$ *              E N D    S E C T I O N                 *
$$ *******************************************************

CIMFIL/ON,END $$ CATCH THE END COMMANDS  
  $$ THROW AWAY THE END COMMAND
CIMFIL/OFF

$$ *******************************************************
$$ *          E N D   O F   F I L   F I L E              *
$$ *******************************************************

139
$$ *******************************************************
$$ *          SAMPLE 8 FIL FILE FOR TRAINIG              *
$$ *******************************************************

$$ PRINT/OFF,IN $$ USE FOR PRODUCTION
$$ DMY = POSTF(24,0) $$ USE FOR PRODUCTION
PRINT/ON $$ USE FOR TESTING
DMY = POSTF(24,1) $$ USE FOR TESTING

$$ *******************************************************
$$ *       A B O U T   T H I S   F I L   F I L E         *
$$ *******************************************************

$$ THIS IS A SAMPLE FIL FILE TO SHOW HOW TO WRITE ALL OPERATOR
$$ MESSAGES TO A FILE. THREE FIL SECTION WILL BE USED AS FOLLOWS
$$ MACHIN SECTION TO OPEN THE FILE
$$ PPRINT SECTION TO WRITE TO THE FILE
$$ FINI SECTION TO CLOSE THE FILE

$$ *******************************************************
$$ *    G L O B A L   V A R I A B L E   S E C T I O N    *
$$ *******************************************************

  REDEF/ON $$ ALLOW SYMBOL REDEFINITION
  LTSW = 0 $$ DEFAULT LOADTL SWITCH
  CNT = 0  $$ DEFAULT COUNTER

$$ *******************************************************
$$ *       G L O B A L   M A C R O   S E C T I O N       *
$$ *******************************************************

  TWARN = MACRO/
    $$ THIS MACRO GETS THE TOTAL NUMBER OF POST WARNINGS 
    $$ AND INCREMENTS IT BY ONE, RESETTING THE NEW VALUE.
    TW = POSTF(1,1,1932) $$ GET THE TOTAL # OF POST WARNINGS
    TW = TW + 1   $$ ADD 1
    DMY = POSTF(2,1,1932,TW) $$ RESET THE TOTAL # OF POST WARNINGS
  TERMAC

$$ *******************************************************
$$ *             F I N I    S E C T I O N                *
$$ *******************************************************

CIMFIL/ON,14 $$ CATCH THE FINI COMMANDS (TYPE 14000 CL) 
  DMY = POSTF(20) $$ SAVE THE CURRENT CL RECORD
  IF(FOPEN.EQ.0)THEN $$ FILE IS OPEN
    T1 = TEXT/' *******************************************************'
    DMY = FILEF(1,1,T1) $$ WRITE STRING TO FILE
    T1 = TEXT/' *        E N D   O F  P P R I N T    F I L E          *'
    DMY = FILEF(1,1,T1) $$ WRITE STRING TO FILE
    T1 = TEXT/' *******************************************************'
    DMY = FILEF(1,1,T1) $$ WRITE STRING TO FILE
    DMY = FILEF(1,5) $$ CLOSE THE FILE
  ENDIF 
  DMY = POSTF(21) $$ RELOAD THE SAVED CL RECORD
  DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD
CIMFIL/OFF

$$ *******************************************************
$$ *          M A C H I N   S E C T I O N                *
$$ *******************************************************

CIMFIL/ON,MACHIN $$ CATCH THE MACHIN COMMANDS  
  DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD
  DMY = POSTF(26,2,(ICODEF(MACHIN)),0) $$ TURN OFF THIS FIL ROUTINE

140
  FN = TEXT/PART $$ GET THE FILE NAME
  SLASH = TEXT/'/' $$ DEFAULT TEXT STRING
  DOT = TEXT/'.' $$ DEFAULT TEXT STRING
  EXT = TEXT/'PPR' $$ NEW FILE EXTENSION
  NOSL) CONTIN $$ JUMPTO LABEL
  SLOC = INDXF(FN,SLASH) $$ FIND THE SLASH
  IF(SLOC.GT.0)THEN $$ FOUND A SLASH
    NCH = CANF(FN,1) $$ GET THE NUMBER OF CHARACTERS IN FN
    FN = TEXT/RANGE,FN,(SLOC+1),NCH $$ REMOVE THE DIRECTORY NAME FROM FN
    JUMPTO/NOSL $$ CHECK AGAIN FOR SLASH
  ENDIF
  DLOC = INDXF(FN,DOT) $$ FIND THE DOT
  IF(DLOC.GT.0)THEN $$ FOUND A DOT
    NCH = CANF(FN,1) $$ GET THE NUMBER OF CHARACTERS IN FN
    FN = TEXT/RANGE,FN,1,(DLOC) $$ REMOVE THE EXTENSION FROM FN
  ENDIF
  FN = TEXT/FN,EXT $$ PPRINT FILE NAME
  FEX = FILEF(1,7,FN) $$ SEE IF FILE EXIST
  IF (FEX.EQ.1)THEN $$ FILE EXIST
    DMY = FILEF(1,2,FN) $$ OPEN EXISTING FILE
    DMY = FILEF(1,6) $$ CLOSE AND DELETE FILE
  ENDIF
  FOPEN = FILEF(1,3,FN) $$ OPEN NEW FILE FILE
  IF(FOPEN.EQ.0)THEN $$ FILE IS OPEN
    T1 = TEXT/' *******************************************************'
    DMY = FILEF(1,1,T1) $$ WRITE STRING TO FILE
    T1 = TEXT/' *            P P R I N T    F I L E                   *'
    DMY = FILEF(1,1,T1) $$ WRITE STRING TO FILE
    T1 = TEXT/' *******************************************************'
    DMY = FILEF(1,1,T1) $$ WRITE STRING TO FILE
  ENDIF 
CIMFIL/OFF

$$ *******************************************************
$$ *          P P R I N T     S E C T I O N              *
$$ *******************************************************

CIMFIL/ON,PPRINT $$ CATCH THE PPRINT COMMANDS  
  PPTXT = TEXT/CLW $$ GET THE PPRINT TEXT FROM CL RECORD
  DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD
  IF(FOPEN.EQ.0)THEN $$ FILE IS OPEN
    DMY = FILEF(1,1,PPTXT) $$ WRITE STRING TO FILE
  ENDIF 
CIMFIL/OFF

$$ *******************************************************
$$ *          E N D   O F   F I L   F I L E              *
$$ *******************************************************
 
FINI 

141
$$ *******************************************************
$$ *          SAMPLE 9 FIL FILE FOR TRAINIG              *
$$ *******************************************************

$$ PRINT/OFF,IN $$ USE FOR PRODUCTION
$$ DMY = POSTF(24,0) $$ USE FOR PRODUCTION
PRINT/ON $$ USE FOR TESTING
DMY = POSTF(24,1) $$ USE FOR TESTING

$$ *******************************************************
$$ *       A B O U T   T H I S   F I L   F I L E         *
$$ *******************************************************

$$ THIS IS A SAMPLE FIL FILE TO SHOW HOW TO READ THE ENTIRE CL FILE 
$$ AMKE A TOOL LIST AND AUTOMATICALLY OUTPUT A SELCTL AFTER EACH TOOL 
$$ CHANGE OPERATION.
$$ THREE FIL ROUTINES ARE USED AS FOLLOWS
$$ MACHIN SECTION TO MAKE THE TOOL LIST
$$ LOADTL SECTION TO OUTPUT THE LOADTL / SELCTL
$$ SELCTL TO THROE AWAY THE SELCTL

$$ *******************************************************
$$ *    G L O B A L   V A R I A B L E   S E C T I O N    *
$$ *******************************************************

  REDEF/ON $$ ALLOW SYMBOL REDEFINITION
  LTSW = 0 $$ DEFAULT LOADTL SWITCH
  CNT = 0  $$ DEFAULT COUNTER
  MAXTLS = 0 $$ MAX TOOL VARIABLE
  RESERV/TLS,100 $$ RESERVE THE ARRAY TO STORE THE TOOL NUMBERS

$$ *******************************************************
$$ *       G L O B A L   M A C R O   S E C T I O N       *
$$ *******************************************************

  TWARN = MACRO/
    $$ THIS MACRO GETS THE TOTAL NUMBER OF POST WARNINGS 
    $$ AND INCREMENTS IT BY ONE, RESETTING THE NEW VALUE.
    TW = POSTF(1,1,1932) $$ GET THE TOTAL # OF POST WARNINGS
    TW = TW + 1   $$ ADD 1
    DMY = POSTF(2,1,1932,TW) $$ RESET THE TOTAL # OF POST WARNINGS
  TERMAC

$$ *******************************************************
$$ *          M A C H I N   S E C T I O N                *
$$ *******************************************************

CIMFIL/ON,MACHIN $$ CATCH THE MACHIN COMMANDS  
  DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD
  DMY = POSTF(26,2,(ICODEF(MACHIN)),0) $$ TURN OFF THIS FIL ROUTINE
  CLNUM = POSTF(7,1)+1 $$ SAVE THE CURRENT CL POINTER 
  $$ START TO READ THE ENTIRE CL FILE NOW
  DO/REDO,N=1,1000000,1 $$ DO IT ALOT 
     DMY = POSTF(14) $$ GET THE NEXT CL RECORD
     CLT = POSTF(7,2) $$ GET THE 2ND CL WORD, TYPE
     CLS = POSTF(7,3) $$ GET THE 3RD CL WORD, SUB­TYPE
     IF(CLT .EQ. 14000)THEN $$ FOUND THE FINI
       MAXTLS = CNT $$ SET THE MAX NUMBER OF TOOLS
       CNT = 0 $$ RESET THE COUNTER 
       DMY = POSTF(15,CLNUM) $$ REWIND THE CL FILE
       JUMPTO/DONE $$ GET OUT
     ENDIF    
     IF(CLT .EQ. 2000 .AND. CLS .EQ. (ICODEF(LOADTL)))THEN $$ FOUND A LOADTL
       CNT = CNT + 1 $$ COUNT THE NUMBER OF LOADTLS
       TLS(CNT) = POSTF(7,4) $$ STORE THE TOOL NUMBER IN THE ARRAY TLS
     ENDIF    

142
   REDO) CONTIN $$ END OF DO LOOP
   DONE) CONTIN $$ ESCAPE ROUTE
   $$ GOT THE TOOL LIST
CIMFIL/OFF

$$ *******************************************************
$$ *          L O A D T L      S E C T I O N             *
$$ *******************************************************

CIMFIL/ON,LOADTL $$ CATCH THE LOADTL COMMANDS  
  DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD
  CNT = CNT + 1 $$ COUNT THE LOADTL
  IF(CNT.GE.MAXTLS)THEN $$ THIS IS THE LAST TOOL
    SELCTL/TLS(1) $$ PRESET THE FIRST TOOL
  ELSE
    SELCTL/TLS(CNT+1) $$ PRESET THE NEXT TOOL
  ENDIF
CIMFIL/OFF

$$ *******************************************************
$$ *          S E L C T L      S E C T I O N             *
$$ *******************************************************

CIMFIL/ON,SELCTL $$ CATCH THE SELCTL COMMANDS  
$$ IGNORE SELCTL COMMANDS, LOADTL TAKES CARE OF THEM
CIMFIL/OFF

$$ *******************************************************
$$ *          E N D   O F   F I L   F I L E              *
$$ *******************************************************
 
FINI

143
$$ *******************************************************
$$ *            SAMPLE 10 FIL FILE FOR TRAINIG           *
$$ *******************************************************

$$ PRINT/OFF,IN $$ USE FOR PRODUCTION
$$ DMY = POSTF(24,0) $$ USE FOR PRODUCTION
PRINT/ON $$ USE FOR TESTING
DMY = POSTF(24,1) $$ USE FOR TESTING

$$ *******************************************************
$$ *       A B O U T   T H I S   F I L   F I L E         *
$$ *******************************************************

$$ THIS IS A SAMPLE FIL FILE TO SHOW HOW TO OUTPUT AN H CODE ON THE  
$$ FIRST GOTO AFTER EACH LOADTL.
$$ THREE FIL ROUTINES ARE USED AS FOLLOWS
$$ MACHIN SECTION TO TURN OFF THE GOTO SECTION BY DEFAULT
$$ LOADTL SECTION TO SAVE THE CURRENT H OFFSET NUMBER
$$ GOTO SECTION (5,5) TO OUTPUT THE H CODE

$$ *******************************************************
$$ *    G L O B A L   V A R I A B L E   S E C T I O N    *
$$ *******************************************************

  REDEF/ON $$ ALLOW SYMBOL REDEFINITION
  LTSW = 0 $$ DEFAULT LOADTL SWITCH
  CNT = 0  $$ DEFAULT COUNTER

$$ *******************************************************
$$ *       G L O B A L   M A C R O   S E C T I O N       *
$$ *******************************************************

  TWARN = MACRO/
    $$ THIS MACRO GETS THE TOTAL NUMBER OF POST WARNINGS 
    $$ AND INCREMENTS IT BY ONE, RESETTING THE NEW VALUE.
    TW = POSTF(1,1,1932) $$ GET THE TOTAL # OF POST WARNINGS
    TW = TW + 1   $$ ADD 1
    DMY = POSTF(2,1,1932,TW) $$ RESET THE TOTAL # OF POST WARNINGS
  TERMAC

$$ *******************************************************
$$ *          M A C H I N   S E C T I O N                *
$$ *******************************************************

CIMFIL/ON,MACHIN $$ CATCH THE MACHIN COMMANDS  
  DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD
  DMY = POSTF(26,2,(ICODEF(MACHIN)),0) $$ TURN OFF THIS FIL ROUTINE
  DMY = POSTF(26,5,5,0) $$ TURN OFF CIMFIL/ON,5,5 FIL ROUTINE
CIMFIL/OFF

$$ *******************************************************
$$ *          L O A D T L      S E C T I O N             *
$$ *******************************************************

CIMFIL/ON,LOADTL $$ CATCH THE LOADTL COMMANDS  
  DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD
  OFVAL = POSTF(1,1,1942) $$ GET THE VALUE FROM INTCOM 1942 (OFFSET LOCATION)
  LTSW = 1 $$ SET THE LOADTL SWITCH
  DMY = POSTF(26,5,5,1) $$ TURN ON THE CIMFIL/ON,5,5 ROUTINE
CIMFIL/OFF

$$ *******************************************************
$$ *       G O T O    P O I N T     S E C T I O N        *
$$ *******************************************************

CIMFIL/ON,5,5 $$ CATCH THE GOTO POINTS  

144
  DMY = POSTF(20) $$ SAVE THE CURRENT CL RECORD
  IF(LTSW .EQ.1)THEN $$ FIRST MOVE AFTER LOADTL
    POSTN/IN,8,OFVAL,NEXT $$ OUTPUT Hofval WITH NEXT BLOCK
    LTSW  = 0 $$ RESET THE LOADTL SWITCH
  ENDIF
  DMY = POSTF(21) $$ RELOAD THE SAVED CL RECORD
  DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD
  DMY = POSTF(26,5,5,0) $$ TURN OFF THIS CIMFIL/ON,5,5 ROUTINE
CIMFIL/OFF  

$$ *******************************************************
$$ *          E N D   O F   F I L   F I L E              *
$$ *******************************************************
 
FINI

145
$$ *******************************************************
$$ *            SAMPLE 11 FIL FILE FOR TRAINIG                                           *
$$ *******************************************************

$$ PRINT/OFF,IN $$ USE FOR PRODUCTION
$$ DMY = POSTF(24,0) $$ USE FOR PRODUCTION
PRINT/ON $$ USE FOR TESTING
DMY = POSTF(24,1) $$ USE FOR TESTING

$$ *******************************************************
$$ *       A B O U T   T H I S   F I L   F I L E         *
$$ *******************************************************

$$ THIS IS A SAMPLE FIL FILE TO SHOW HOW TO USE THE FROM VALUES FOR
$$ THE GOHOME COMMAND AND TO OUTPUT A G92 BLOCK TO THE FROM POINT  
$$ ONE FIL ROUTINE IS USED AS FOLLOWS
$$ FROM (5,3) SECTION 

$$ *******************************************************
$$ *    G L O B A L   V A R I A B L E   S E C T I O N    *
$$ *******************************************************

  REDEF/ON $$ ALLOW SYMBOL REDEFINITION
  LTSW = 0 $$ DEFAULT LOADTL SWITCH
  CNT = 0  $$ DEFAULT COUNTER

$$ *******************************************************
$$ *       G L O B A L   M A C R O   S E C T I O N       *
$$ *******************************************************

  TWARN = MACRO/
    $$ THIS MACRO GETS THE TOTAL NUMBER OF POST WARNINGS 
    $$ AND INCREMENTS IT BY ONE, RESETTING THE NEW VALUE.
    TW = POSTF(1,1,1932) $$ GET THE TOTAL # OF POST WARNINGS
    TW = TW + 1   $$ ADD 1
    DMY = POSTF(2,1,1932,TW) $$ RESET THE TOTAL # OF POST WARNINGS
  TERMAC

$$ *******************************************************
$$ *              F R O M   S E C T I O N                *
$$ *******************************************************

CIMFIL/ON,5,3 $$ CATCH THE FROM COMMANDS 
  FRX = POSTF(7,6) $$ GET THE 6TH CL WORD , FROM X VALUE
  FRY = POSTF(7,7) $$ GET THE 7TH CL WORD , FROM Y VALUE
  FRZ = POSTF(7,8) $$ GET THE 8TH CL WORD , FROM Z VALUE
  DMY = POSTF(2,1,1867,1) $$ POST SIMULATION MODE ON
  DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD  
  DMY = POSTF(2,1,1867,0) $$ POST SIMULATION MODE OFF
  SET/START,XAXIS,FRX,YAXIS,FRY,ZAXIS,FRZ  $$ OUTPUT G92 BLOCK
  DMY = POSTF(2,3,130,FRX) $$ RESET GOHOME X 
  DMY = POSTF(2,3,131,FRY) $$ RESET GOHOME Y 
  DMY = POSTF(2,3,132,FRZ) $$ RESET GOHOME Z 
CIMFIL/OFF

$$ *******************************************************
$$ *          E N D   O F   F I L   F I L E              *
$$ *******************************************************
 
FINI

146
$$ ************************************************
$$ *  F A D A L   S A M P L E   F I L   F I L E   *
$$ ************************************************

$$ PRINT/OFF,IN $$ USE FOR PRODUCTION
$$ DMY = POSTF(24,0) $$ USE FOR PRODUCTION
PRINT/ON $$ USE FOR TESTING
DMY = POSTF(24,1) $$ USE FOR TESTING

$$ *******************************************************
$$ *    G L O B A L   V A R I A B L E   S E C T I O N    *
$$ *******************************************************

YES = 1
NO  = 0
FADAL = NO                             $$ FADAL = YES for SPINDL output on 1st
                                       $$ motion block after SPINDL, COOLNT on
                                       $$ 1st Z; NO for output when SPINDL or
                                       $$ COOLNT command encountered

$$ *******************************************************
$$ *           S P I N D L     S E C T I O N             *
$$ *******************************************************

CIMFIL/ON,SPINDL
  IF (FADAL .EQ. YES) THEN             $$ O/P spindle stuff on next motion
    XX = POSTF(19)                     $$ force out any pending data
    XX = POSTF(2,1,1867,1)             $$ simulation mode on
    XX = POSTF(13)                     $$ process SPINDL satement
    XX = POSTF(19)                     $$ force out any pending data from SPINDL
    XX = POSTF(2,1,1867,0)             $$ simulation off
    SPSTRT = YES                       $$ set pending spindle startup flag
    XX = POSTF(26,5,5,1)               $$ intercept next motion record
  ELSE                                 $$ O/P spindle stuff now
    XX = POSTF(13)
  ENDIF
CIMFIL/OFF

$$ *******************************************************
$$ *       G O T O   P O I N T S   S E C T I O N         *
$$ *******************************************************

CIMFIL/ON,5,5
  IF (SPSTRT .EQ. YES) THEN            $$ pending spindle start­up from SPINDL
    XX = POSTF(20)                     $$ save this motion record
    ISPRNG = POSTF(1,1,1523)           $$ get current range number
    MRANGE = POSTF(1,1,(1972+ISPRNG))  $$ get M code for this range
    MTRNG  = POSTF(4,1,(1972+ISPRNG))  $$ see if above is "EMPTY"

    IF (MTRNG .NE.1) AUXFUN/MRANGE,NEXT  $$ if not, load M­code for range
    AUXFUN/(POSTF(1,1,1513)),NEXT      $$ M­code for spindle direction
    POSTN/IN,19,(POSTF(1,2,10)),NEXT   $$ S­code

    PREFUN/(POSTF(1,1,534)),NEXT       $$ load G90/G91 w/ next block

    MCLON = POSTF(1,1,1962)            $$ get last coolnt M­code
    REPEAT/OFF                         $$ clear REPEAT buffer
    REPEAT/26,13,MCLON                 $$ output coolnt with next Z word

    XX = POSTF(21)                     $$ restore the motion record
    XX = POSTF(26,5,5,0)               $$ turn off motion intercept
  ENDIF
  XX = POSTF(13)
CIMFIL/OFF

147
$$ *******************************************************
$$ *           M A C H I N     S E C T I O N             *
$$ *******************************************************

CIMFIL/ON,MACHIN
  XX = POSTF(13)
  XX = POSTF(26,5,5,0)                 $$ turn off motion record intercept
CIMFIL/OFF

$$ *******************************************************
$$ *           C O O L N T     S E C T I O N             *
$$ *******************************************************

CIMFIL/ON,COOLNT
  IF (FADAL .EQ. YES) THEN             $$ hold up coolant code for next Z
    XX = POSTF(2,1,1867,1)             $$ simulation on 
    XX = POSTF(13)                     $$ process COOLNT command
    XX = POSTF(2,1,1867,0)             $$ simulation off
  ELSE
    XX = POSTF(13)                     $$ O/P coolant code when encountered
  ENDIF
CIMFIL/OFF

$$ *******************************************************
$$ *          E N D   O F   F I L   F I L E              *
$$ *******************************************************

FINI

148
$$ *******************************************************
$$ *      P A R T N O   S A M P L E   F I L              *
$$ *******************************************************

REDEF/ON

$$ *******************************************************
$$ *           P A R T N O     S E C T I O N             *
$$ *******************************************************
                                       $$ ==================================
CIMFIL/ON,PARTNO                       $$ SPOST standard PARTNO sequence ...
LOOPST                                 $$ ==================================
  PLETER = TEXT/'O'                    $$ PLETER = string required for program
                                       $$          number block identifier
  PARLEN = 8                           $$ PARLEN = REQUIRED # of chars for 
                                       $$          program number
  MINMIN = 90000000                    $$ MINMIN = lowest acceptable program #
  MAXMAX = 99999999                    $$ MAXMAX = largest    "         "    #
  BLANKS = TEXT/REPEAT,66,' '          $$ BLANKS = string of blanks (EMPTY)
  CONCOD = 0                           $$ CONCOD = 0 indicates good PARTNO

  $$ .........  CHECK PARTNO FOR ALL BLANKS  ...............................

  PARSTR = TEXT/CLW
  PARSPN) CONTIN                       $$ branch to here from prompt section
  CONCOD = CMPRF(PARSTR,BLANKS)         $$ check for empty (66 blanks)
  IF (CONCOD .EQ. 1) THEN              $$ CONCOD = 1; empty PARTNO string
    ASK1TX = TEXT/'PROGRAM NUMBER FIELD EMPTY, ENTER PROGRAM NUMBER'
    JUMPTO/ASK1    
  ENDIF                                $$ PARTNO wasnt empty, continue

  $$ .........  CHECK PARTNO STRING FOR SUFFICIENT LENGTH ..................

  PARSTR = TEXT/OMIT,PARSTR,3          $$ omit ALL blanks
  PGMLEN = CANF(PARSTR,1)              $$ get length of remaining string
  IF (PGMLEN .LT. PARLEN) THEN
    CONCOD = 2                         $$ CONCOD = 2; wrong number of chars
  ELSE                                
    PARSTR = TEXT/RANGE,PARSTR,1,PARLEN  $$ reduce string to correct length
  ENDIF
  IF (CONCOD .NE. 0) THEN
    ASK2)CONTIN                        $$ error trap for blank answer
    ASK1TX = TEXT/$
   'PROGRAM NUMBER MUST BE ',PARLEN,' CHARS IN LENGTH, RE­ENTER'
    JUMPTO/ASK1
  ENDIF
  $$ .........  CHECK PARTNO STRING FOR NON NUMERIC CHARACTERS  ............
  BAD = 0
  DO/VFY,KK = 1,PARLEN                 $$ check PARSTR ­ only numbers allowed
     1CHR = TEXT/RANGE,PARSTR,KK,KK    $$ look at each individual character
     1VAL = ICHARF(1CHR)
     IF (1VAL .LT. 48             $
              .OR.                $
         1VAL .GT. 57) BAD = BAD+1     $$ if BAD not zero, non­numeric found!
     IF (BAD .NE. 0) KK = PARLEN+1     $$ get out of loop on 1st bad character
  VFY) CONTIN                          $$ end of DO loop ...
  IF (BAD .NE. 0) CONCOD = 3           $$ CONCOD = 3; non numeric char found!  

  IF (CONCOD .NE. 0) THEN
    ASK1TX = TEXT/'NON­NUMERIC VALUES NOT ALLOWED, RE­ENTER'
    JUMPTO/ASK1
  ENDIF

149
  $$ .........  CHECK PARTNO STRING TO BE WITHIN ACCEPTABLE RANGE  ..........
  PARNUM = SCALF(PARSTR)               $$ convert string into scalar equiv.
  IF (PARNUM .LT. MINMIN          $
             .OR.                 $
      PARNUM .GT. MAXMAX) CONCOD = 4   $$ CONCOD = 4; value not in reqd range
  IF (CONCOD .NE. 0) THEN
    ASK1TX = TEXT/$
    'PROGRAM NUMBER MUST BE BETWEEN ',MINMIN,' AND ',MAXMAX,' ,RE­ENTER'

  $$ .......................................................................

    ASK1) CONTIN                       $$ didnt like something, prompt
      XX = FILEF(0,1,ASK1TX)           $$ write prompt to screen
      PARSTR = TEXT/READ,0             $$ get the users answer
      NEWLEN = CANF(PARSTR,1)          $$ get length of new answer
      IF (NEWLEN .LT. 1) JUMPTO/ASK2
      BLANKS = TEXT/REPEAT,NEWLEN,' '  $$ make new "blanks" correct length
      JUMPTO/PARSPN                    $$ goto top and test this string
  ENDIF                                $$ if we got here, PARTNO is OK!!
  PARSTR = TEXT/PLETER,PARSTR,'!'      $$ PARSTR is string ready to INSERT
                                       $$ AFTER processing MACHIN stmt.                   
$$ =====
 LOOPND
 PARTNO/PARSTR
CIMFIL/OFF                            

$$ *******************************************************
$$ *           M A C H I N     S E C T I O N             *
$$ *******************************************************
    
CIMFIL/ON,MACHIN
  XX = POSTF(13)
  INSERT/PARSTR
CIMFIL/OFF

$$    EXAMPLE NUMBER TWO (2)…

$$ ************************************************************
$$ *               P A R T N O    S E C T I O N               *
$$ ************************************************************

CIMFIL/ON,PARTNO      $$ CAPTURE THE PARTNO COMMANDS
PNTXT = TEXT/CLW    $$ SAVE THE PARTNO
DMY = POSTF(13)    $$ EXECUTE THE CURRENT CL RECORD
CIMFIL/OFF                                 $$ END OF CIMFIL/ON,PARTNO

$$ ************************************************************
$$ *             M A C H I N     S E C T I O N                *
$$ ************************************************************

CIMFIL/ON,MACHIN          $$ CAPTURE THE MACHIN COMMAND
CLNUM = POSTF(7,1)        $$ GET THE CURRENT CL RECORD NUM
DMY = POSTF(13) $$ EXECUTE THE CURRENT CL RECORD
DMY = POSTF(26,2,(ICODEF(MACHIN)),0)   $$ TURN OFF CIMFIL/ON,MACHIN
DMY = POSTF(26,5,5,0)           $$ TURN OFF CIMFIL/ON,5,5
PNTX1 = TEXT/OMIT,PNTXT,2         $$ TRASH THE LEADING BLANKS
PNTX2 = TEXT/RANGE,PNTX1,1,6 $$ GET 1ST 6 CHARACTERS
SEQNO/OFF        $$ TURN OFF SEQUENCE NUMBERS
INSERT/'O',PNTX2,'$'        $$ OUTPUT O BLOCK
SEQNO/0,INCR,1,10        $$ TURN ON SEQUENCE NUMBERS
CIMFIL/OFF                               $$ END OF CIMFIL/ON,MACHIN

150
$$ ***********************************************************
$$ *            C L E A R P    S E C T I O N                 *
$$ ***********************************************************

CIMFIL/ON,CLEARP
   CLV = POSTF(7,4)
   CLT = POSTF(6,4)
   IF(CLT .EQ. 0 .AND. CLV .EQ. (ICODEF(OFF)))THEN
      TCZ = POSTF(1,3,606) $$ TOOL CHANGE Z
      TRZ = POSTF(1,3,288) $$ FIXED TRANS Z
      CLV = (TCZ + (TRZ)) $$ REMOVE THE Z TRANSLATION
      DMY = POSTF(10,5,CLV) $$ LOAD THE NEW CLEARP VALUE
   ELSE
     CLV = POSTF(7,5)
     CLT = POSTF(6,5)
     IF(CLT .EQ. 1)THEN
        TRZ = POSTF(1,3,288) $$ FIXED TRANS Z
        CLV = (CLV + (TRZ)) $$ REMOVE THE Z TRANSLATION
        DMY = POSTF(10,5,CLV) $$ LOAD THE NEW CLEARP VALUE
     ENDIF
   ENDIF
   DMY = POSTF(13) $$ EXECUTE CURRENT CL RECORD
CIMFIL/OFF

151
$$ MAD1 IS A MACRO TO CHANGE LETTER ADDRESS TO STRING
$$ ADR IS ADDRESS TO BE SET A=1,B=2 ETC
$$ STR IS IS THE ALIAS STRING TB=TEXT/'R101='  

MAD1=MACRO/ADR,STR
  L1=POSTF(1,1,ADR)    $$ GET ORDER(ADR)
  IF(L1.EQ.53)THEN    $$ NO ADDRESS IN THE ORDER
    TMPADR = ADR + 64    $$ SET THE DECIMAL VALUE
    ADRSW = 0    $$ ERROR SWITCH
    DO/REDOAD,N=1,26,1    $$ LOOK FOR ADDRESS IN JADDR
      NXTADR = POSTF(1,1,(52+N))    $$ READ THE NEXT ADDRESS VALUE
      IF(NXTADR .EQ. TMPADR)THEN    $$ IF ADDRESS FOUND
        L1 = N    $$ RESET L1
        ADRSW = 1    $$ SET THE ERROR SWITCH OK
        JUMPTO/DONEAD    $$ GET OUT
      ENDIF
    REDOAD) CONTIN
    DONEAD) CONTIN
    IF(ADRSW .EQ. 0)THEN
      TW = POSTF(1,1,1932)    $$ GET THE TOTAL # OF WARNINGS
      TW = TW + 1    $$ ADD 1 WARNING
      DMY = POSTF(2,1,1932,1)    $$ RESET THE TOTAL # OF WARNINGS
      PPRINT/'***WARNING, NO ADDRESS FOR MAD1 MACRO'  $$ OUTPUT A MESSAGE
    ENDIF
  ENDIF
  L2=(9­1)*26+L1+2216­1                    $$ COMPUTE JPARAD(X,9)
  I1=POSTF(2,1,L2,1)                       $$ SET JPARAD(X,9)
  DO/L10,N1=1,8                            $$ ALLOW UPTO 8CHARS
    L2=(N1­1)*26+L1+2216­1                 $$ COMPUTE JPARAD(X,N)
    I1=POSTF(3,1,L2)                       $$ SET JPARAD(X,N)=IEMPTY
    IF(N1 .GT. CANF(STR,1))JUMPTO/L10      $$ SKIP IF OVER STRING LENGTH
    A1=ICHARF((TEXT/RANGE,STR,N1,N1))      $$ GET CHARACTER NUMBER
    I1=POSTF(2,1,L2,A1)                    $$ INSERT STRING(N)
  L10)CONTIN
TERMAC

$$ MAD2 IS A MACRO TO RESET THE LETTER ADDRESS BACK FROM A STRING
$$ ADR IS ADDRESS TO BE SET A=1,B=2 ETC

MAD2=MACRO/ADR
  L1=POSTF(1,1,ADR)                        $$ GET JORDER(ADR)
  IF(L1.EQ.53)THEN    $$ NO ADDRESS IN THE ORDER
    TMPADR = ADR + 64    $$ SET THE DECIMAL VALUE
    ADRSW = 0            $$ SET ERROR SWITCH 0=ERROR
    DO/REDOAD,N=1,26,1            $$ LOOK FOR ADDRESS IN JADDR
      NXTADR = POSTF(1,1,(52+N))    $$ READ THE NEXT ADDRESS VALUE
      IF(NXTADR .EQ. TMPADR)THEN    $$ FOUND THE ADDRESS
        L1 = N    $$ RESET L1
        ADRSW = 1    $$ SET ERROR SWITCH 1 = NO ERROR
        JUMPTO/DONEAD    $$ GET OUT
      ENDIF
    REDOAD) CONTIN
    DONEAD) CONTIN
    IF(ADRSW .EQ. 0)THEN    $$ NO ADDRESS IN JADDR 
      TW = POSTF(1,1,1932)    $$ GET THE TOTAL # OF WARNINGS
      TW = TW + 1    $$ ADD 1 WARNING
      DMY = POSTF(2,1,1932,1)    $$ RESET THE TOTAL NUMBER OF WARNINGS
      PPRINT/'***WARNING, NO ADDRESS FOR MAD2 MACRO' $$ OUTPUT MESSAGE
    ENDIF
  ENDIF
  L2=(9­1)*26+L1+2216­1                    $$ COMPUTE JPARAD(X,9)
  I1=POSTF(3,1,L2)                         $$ SET JPARAD(X,9)=IEMPTY
TERMAC

152
$$ Sample FIL File replacing letter addresses in CYCLE output.

CIMFIL/ON,CYCLE
  DMY = POSTF(20) $$ SAVE THIS CL RECORD
  4TH = POSTF(7,4) $$ GET THE FOURTH CL WORD
    IF(4TH .NE. (ICODEF(DEEP)))THEN  
$$ EXCLUDE THE CYCLES WITH INCR VALUES (DEEP OR DEEPCL?)
      ZVAL = POSTF(1,1,58) $$ GET THE VALUE OF INTCOM 58 (NORMAL LOCATION OF Z)
IVAL = POSTF(1,1,59) $$ GET THE VALUE OF INTCOM 59 (NORMAL LOCATION OF 1)
      DMY = POSTF(2,1,58,IVAL)  $$ SET Z TO I
DMY = POSTF(2,1,59,ZVAL)  $$ SET I TO Z
      DMY = POSTF(21) $$ RELOAD THE SAVED CL RECORD
DMY ­ POSTF(13) $$ EXECUTE THE CYCLE CL RECORD
DMY = POSTF(2,1,58,ZVAL)  $$ PUT Z BACK IN LOCATION 58
DMY = POSTF(2,1,59,IVAL)  $$ PUT I BACK IN LOCATION 59
    ELSE
$$ PUT SOMETHING SIMILAR HERE FOR YOUR DEEP OR DEEPCL
    ENDIF
CIMFIL/O
Appendix 2: Pro/NC-GPOST File Configuration

1. All GPOST system executables are stored in a directory identified by the environment
variable CAMSYS. This directory is usually located in:

%pro_directory%\%MC%\obj\

where %pro_directory% is the Pro/E installation directory (e.g. C:\ncsystem\proe)


and %MC% is one of its subdirectories identifying the OS platform (e.g. i_486nt). In the
example above, CAMSYS would be: C:\ncsystem\proe\i_486nt\obj\

2. The GPost system library is found in a directory identified by the environment variable
CAMLIB, usually located in:

%pro_directory%\%MC%\gpost\

In the example above, CAMLIB would be: C:\ncsystem\proe\i_486nt\obj\

3. During the execution of a post, GPOST writes information to a series of scratch files.
Upon completion of the process, these files are automatically deleted by the system.
Scratch files are written to a SCRATCH directory.

The SCRATCH directory is defined one of the three following ways:

 If a configuration table config.tbl exists, the SCRATCH directory is defined as the


UNC$SCRATCH environment variable defined inside that file. The config.tbl file is
optional and therefore not a mandatory requirement for the process. If used, it must
be stored in the CAMSYS directory and set as follows (see example above):

# %pro_directory% = c:\ncsystems\proe
# %MC% = i_486nt
unc$scratch = c:\ncsystems\proe\i_486nt\scratch\
# end of configuration file

 If the configuration table config.tbl does not exist, and a directory named sc
exists below %MC%, then that directory is used as follows:

%pro_directory%\%MC%\sc\

In the example above, SCRATCH would be: C:\ncsystem\proe\i_486nt\sc\

 If neither the configuration table config.tbl, nor the above directory sc exist, then
the current working directory will be used as SCRATCH.
Appendix 3: System and Library File Locations

1. CAMSYS

a) System Configuration Files:


Config.tbl The optional system configuration file

b) Option File Generator Files:


OPTFILE.EXE The option file generator
Keyword_FIL.txt The keyword file for the FIL editor
Keyword_VTB.txt The keyword file for the VTB editor
Lathe.SCN The Lathe OFG screen file
Mill.SCN The Mill OFG screen file
Lathecom.doc The Common Help file for the Lathe OFG
Millcom.doc The Common Help file for the Mill OFG
Lathecom_Manual.doc The Formatted Common Listing
Millcom_Manual.doc The Formatted Common Listing
OPTFILE.HLP The context sensitive help file for the OFG
OPTFILE.CNT The context sensitive help file for the OFG
Tblfile3.lst The ASCII set of system Integer Codes
Tblfile3.dat The binary set of system Integer Codes
Uncl01.inf The lathe initialization file
Uncx01.inf The Mill initialization file

c) System Executables:
GPOST.EXE The PTC interface (replaces wxpost and wxpost11)
PTCPostm.exe The mill post-processor
PTCPostl.exe The lathe post-processor
PTCPostg.exe The merging post-processor
DBList.exe Builds the post-processor database

d) Default Option Files (used when creating a new post using the defaults):
Uncx01.d00 The default mill option file
Uncw01.d00 The default wire edm option file
Uncc01.d00 The default contouring/laser option file
Uncp01.d00 The default punch press option file
Uncl01.d00 The default lathe option file

e) Default User-defined FIL Files (used when creating a new post):


Uncx01.f00 The default mill FIL file
Uncw01.f00 The default wire edm FIL file
Uncc01.f00 The default contouring/laser FIL file
Uncp01.f00 The default punch press FIL file
Uncl01.f00 The default lathe FIL file
2. CAMLIB

a) System FIL Files (included after the user-defined FIL file):


Uncmil.f00 The system mill FIL file (included after the user FIL file)
Unctur.f00 The system lathe FIL file (included after the user FIL file)
Uncpun.f00 The system punch FIL file (included after the user FIL file)
Uncwir.f00 The system wire FIL file (included after the user FIL file)
Unclas.f00 The system laser FIL file (included after the user FIL file)

b) System Vocabulary Table Files (PPWORD files):


Uncmil.v00 The system mill VTB file (included into FIL first)
Unctur.v00 The system lathe VTB file (included into FIL first)
Uncpun.v00 The system punch VTB file (included into FIL first)
Uncwir.v00 The system wire VTB file (included into FIL first)
Unclas.v00 The system laser VTB file (included into FIL first)

c) System Startup Files:


Uncmil.s00 The system mill STB file (included into FIL after VTB)
Unctur.s00 The system lathe STB file (included into FIL after VTB)
Uncpun.s00 The system punch STB file (included into FIL after VTB)
Uncwir.s00 The system wire STB file (included into FIL after VTB)
Unclas.s00 The system laser STB file (included into FIL after VTB)

d) Default Mill Option Files:


Uncx01.d01 The 1st system supplied mill option file
Uncx01.d02 The 2nd system supplied mill option file
Uncx01.d03 The 3rd system supplied mill option file
Uncx01.d04 The 4th system supplied mill option file
Uncx01.d05 The 5th system supplied mill option file
Uncx01.d06 The 6th system supplied mill option file
Uncx01.d07 The 7th system supplied mill option file
Uncx01.d08 The 8th system supplied mill option file
Uncx01.d09 The 9th system supplied mill option file
Uncx01.d10 The 10th system supplied mill option file

e) Default Lathe Option Files:


Uncl01.d01 The 1st system supplied lathe option file
Uncl01.d02 The 2nd system supplied lathe option file
Uncl01.d03 The 3rd system supplied lathe option file
Uncl01.d04 The 4th system supplied lathe option file
Uncl01.d05 The 5th system supplied lathe option file
Uncl01.d06 The 6th system supplied lathe option file
Uncl01.d07 The 7th system supplied lathe option file
Uncl01.d08 The 8th system supplied lathe option file
Uncl01.d09 The 9th system supplied lathe option file
Uncl01.d10 The 10th system supplied lathe option file
Appendix 4: GPOST Commands and Utilities

To start the Option File Generator:

optfile –sy:2 [ –po:option_file_name ] [ -db:post_library_path ]

where:
-sy indicates which system is starting the OFG: 1 (Intercim), 2 (PTC). The default is 1.

-po (optional) indicates the desired option file to open upon starting the OFG.

-db (optional) defines the path to the directory containing the desired post library.

Example:

optfile –sy:2 –po:uncx01.p01 -db:C:\ncsystem\proe\i_486nt\gpost

To create a list of existing post-processors:

dblist -l:output_file_name [ -db:post_library_path ]

where:
-l specifies the name of output file containing the list of post-processors.

-db (optional) defines the path to the directory containing the desired post library.

Example:

dblist –l:pplist.txt -db:C:\ncsystem\proe\i_486nt\gpost


Appendix 5: GPOST Execution Flow
Appendix 6: Optfile Review Questions

Answer the following review questions using all available resources (i.e. Training Guide,
Pro/NC-GPost manual, experience or class notes):

1. Which modules is Pro/NC-GPost composed of ?

2. How are post-processors stored on the OS system?

3. List three alternatives to start the Option File Generator.

4. How can you run a post-processor?

5. What Post-Processor Options are available in Pro/NC?

6. What is the MACHIN statement and how can it be created?

7. What are the extensions on the two post-processor output files?

8. How can you ensure that the coolant code is output with the first Z move?
9. How can you separate registers with a blank?

10. How can you output the NC program number on the first line using an “O”-block?

11. How can you default the length offset number to the tool number?

12. How can you output an M30 code at the end of the NC program?

13. How can you set X values to “diameter” programming for a lathe?

14. How can you output NC Sequence comments as Operator messages?

15. How can you “square-off” rapid positioning motions on a milling machine after each
tool change (i.e. X and Y on one block, followed by Z on the next block)?

S-ar putea să vă placă și