Professional Documents
Culture Documents
1
– page intentionally left blank –
2
1. Introduction
Pro/NC-GPOST Modules
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
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.
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:
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:
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.
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 Toolbar
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).
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.
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.
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.
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.
An “Edit box” can be updated by left-clicking the edit box then typing in the desired
information.
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.
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 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.
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.
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.
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.
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.
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.
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 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.
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.
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.
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.
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.
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:
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.
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”).
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:
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.
PARTNO / part_description
PPRINT / string
RAPID
CUTCOM / LEFT
RIGHT
37
CUTCOM / OFF
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)
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.Pnn
G-Post G-Post UNCX01.Pnn
MCD File
40
There are four main applications for FIL:
Variables
Labels
Operators
Functions
String Manipulation Functions
Logic Statements
Macro definition
CL Commands
File I/O
Specialized Post-processor functions (POSTF)
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.
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.
For example:
SYN / CM, CIMFIL, MC, MACRO
42
6.3. Variables
TOOLNM=TEXT/’1/4” BALL END MILL’
NTOOL=12
V1=VECTOR/0,0,1
P1=POINT/1,2,3
symbol=TEXT/string
symbol=TEXT/string_1, string_2, ---, string_n
For example:
T1=TEXT/’CHANGE TOOL’
T2=TEXT/’CHANGE ’,’TOOL’
T3=TEXT/T2,’ 12’
REPEAT, n, ‘characters’
43
For example to put 30 spaces before a string:
T1=TEXT/REPEAT,30,’ ’,’START SPINDLE’
For example:
RESERV/TOOLID,30, TOOLNM,30
TOOLID(1)=1
TOOLNM(1)=TEXT/’1/2 BALL END MILL’
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.
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.
In this format, type is a major word indicating the canonical form type - POINT, or
VECTOR.
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)
The DATA statement allows the input of several data items that vary from one
use of the program to another within a single statement.
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.
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
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
The OBTAIN statement can be used to extract scalars from a canonical form and
assign symbols to them. Its format is:
Type is a major word indicating the canonical form type - POINT, VECTOR, or
DATA.
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
48
6.6. Functions
The FIL language has several built-in functions:
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
The TEXT statement used in conjunction with a series of special keywords, allows for
various string manipulation operations.
tl = TEXT/MODIFY,t2,t3,t4,n1
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
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'
The RANGE modifier allows you to extract a portion of a string. The syntax is as
follow:
t1 = TEXT/RANGE,t2,n1,n2
Example:
TA = TEXT/'ABCDEFGHIJK'
TB = TEXT/RANGE,TA,3,5 $$ TB will be 'CDE'
51
The CONVS modifier enables you to add non-printing characters to a text string.
The syntax is as follow:
T1 = TEXT/CONVS,n
For example.
T1 = TEXT/’ABC’,CONVS,4 $$ EOT used by Maho
The string conversion modifiers CONVI, CONVF and CONVE allow for the
conversion of a scalar into an explicitly formatted string of characters.
CONVI,scalar, n
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 b7
T5=TEXT/CONVI,B,2 7
T6=TEXT/CONVI,C,4 b125
T7=TEXT/CONVI,C,3 125
T8=TEXT/CONVI,C,2 **
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 bbb7.6453
T7=TEXT/CONVF,B,6,4 ******
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:
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.
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.12360001
T2=TEXT/CONVE, B, 12, 6 b.12360001
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
The TIMES modifier generates the current date and time as a string.
Example:
T1 = TEXT/TIMES
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
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.
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:
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.
56
6.8.4. Logical Evaluation
A logical expression has the value true or false. The following relational operators
are available:
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
CASE/variable
WHEN/value
statements
…
WHEN/value,THRU,value
statements
…
WHEN/OTHERS
statements
…
ENDCAS
57
6.8.6. DO Loops
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
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( F10 ) S1, S1, S2
S1) SPINDL/200
JUMPTO/S3
S2) SPINDL/250
S3)
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
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:
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:
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.
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
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
PPWORD / word, IC
61
6.10.2. The PRINT Command
PRINT/ON-OFF
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.
This command provides a variable insert to output selected tape codes to the
punch file.
where:
a1-an are the required letter addresses and must be 1 through 26 to indicate the
alpha characters A through Z.
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.
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.
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.
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.
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.
REPEAT/OFF
Turns off all REPEAT commands and clears all stored REPEAT values.
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.
$$ CHANGE ALL 360 TO 0
T1=TEXT/'A360.0'
T2=TEXT/'A0.0'
REPLAC/T1,T2
$$ CHANGE + OR 360 TO 0
T1=TEXT/'A*360.0'
T2=TEXT/'A360'
T3=TEXT/'*'
REPLAC/T1,T2,T3
64
Example: Switch XY to YZ:
REPLAC/(TEXT/'X*'),(TEXT/'YTO_PASTE_BUF'),(TEXT/'*')
REPLAC/(TEXT/'Y*'),TEXT/'Y*XFROM_PASTE_BUF'),TEXT/'*')
T1=TEXT/'A*'
T3=TEXT/'*'
REPLAC/T1,(TEXT/'C0B0A*'),T3
REPLAC / OFF
Notes:
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 NSEQ TO NOTHING
REPLAC/OFF
T1=TEXT/'N'
T2=TEXT/''
REPLAC/T1,T2,1
$$ CHANGE NSEQ TO OBLOCK 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/'*')
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:
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
%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
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)).
rslt = FILEF(fn,op,t1)
Examples:
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
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
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
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
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
t1 = TEXT / READ, fn
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.
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
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
70
6.12. POSTF Commands (Post-processor Functions)
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.
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
Exercise Steps:
4. Enter 1 for the Machine Number. Your post-processor will then be named
UNCX01.P01.
6. In the list of default option files, select the ”FANUC 15M CONTROL” option:
76
8. Return to the main panel (by clicking OK), then save the post-processor.
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.
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).
77
15. Move the register M before S and T.
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.
Additional Tasks:
G90G80G94
G40G49
80
Exercise 2
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:
2. Select Mill for the Machine Type and enter 2 for the Machine Number. Your option file
will then be named UNCX01.P02.
4. Select TOSHIBA TOSNUC 500 SERIE CONTROL from the list of default option files:
81
6. In the Machine Tool Type category, set the Machine Type to 4-axis Rotary table.
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.
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).
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 ….
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:
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
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.
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:
a list of the machine tool specifications (i.e. max feeds, speeds, axes travels, etc)
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.
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.
3. In order to test your post-processor, the following manufacturing models are available:
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:
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
%
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.
5. Now you will want to add some shut-down codes at the end of the NC program:
91
To do so, create a routine 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:
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.
Additional tasks:
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).
2. The first step is to create a scalar variable in the global section of FIL to store the
sequence number multiplier: SEQNB.
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.
3. Create a FIL routine on MACHIN. Do not forget that tape output will be generated
only after the MACHIN statement is processed.
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.
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.
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.
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:
7. Save the post and post-process pplab14.ncl to see the results. You will notice quite a
number of errors being generated:
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.
Additional tasks:
”Clean up” the NC tape output using FIL routines or Optfile modifications:
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:
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:
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”:
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:
Now you can write a FIL routine on LOADTL to reset this variable at every tool change:
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:
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
%
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:
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
108
Set the maximum feedrate to 200 IPM
Select the Feedrates category, sub-panel UPM Mode
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
112
Set the format of this register and move the register Q after Z.
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.
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.
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
Modify the SPINDL FIL routine to output the AIR command after the processing of SPINDL.
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.
T1=TEXT/’( /’
T2=TEXT/’(‘
REPLAC/T1,T2
CLNM=TEXT/PART
INSERT/(TEXT/‘(‘,CLNM,’)$’)
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.
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
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.
2. Select the Common/PLABELs category and the sub-panel Search and look for the
words FEDRAT mode:
3. Add the following line to the current FIL on DEFSUB, just before CIMFIL/OFF:
121
Ignore SPINDL/OFF
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.
...
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
...
2. Add the following lines to the FIL routine on PARTNO to extract the substring after the /.
125
– page intentionally left blank –
126
– page intentionally left blank –
127
APPENDIXES
128
– page intentionally left blank –
129
Appendix 1: Sample FIL Files
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/ONOFFFLOODMIST 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, SUBTYPE
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 startup 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 Mcode for range
AUXFUN/(POSTF(1,1,1513)),NEXT $$ Mcode for spindle direction
POSTN/IN,19,(POSTF(1,2,10)),NEXT $$ Scode
PREFUN/(POSTF(1,1,534)),NEXT $$ load G90/G91 w/ next block
MCLON = POSTF(1,1,1962) $$ get last coolnt Mcode
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, REENTER'
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, nonnumeric 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/'NONNUMERIC VALUES NOT ALLOWED, REENTER'
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,' ,REENTER'
$$ .......................................................................
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=(91)*26+L1+22161 $$ COMPUTE JPARAD(X,9)
I1=POSTF(2,1,L2,1) $$ SET JPARAD(X,9)
DO/L10,N1=1,8 $$ ALLOW UPTO 8CHARS
L2=(N11)*26+L1+22161 $$ 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=(91)*26+L1+22161 $$ 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\
2. The GPost system library is found in a directory identified by the environment variable
CAMLIB, usually located in:
%pro_directory%\%MC%\gpost\
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.
# %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\
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
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
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:
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:
Answer the following review questions using all available resources (i.e. Training Guide,
Pro/NC-GPost manual, experience or class notes):
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?
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)?