Macro Processor Detail
The integral macro processing facility compiles the macro sequences defined in the postprocessor configuration file at the time the” MACHIN/name, number” statement is processed.
Macros Called Via Postprocessor Command in CL File
During postprocessor execution, all incoming CL records are compared with the list of commands and/or activated functions for which the user has defined macro processes. If a match occurs, the user macro is executed before any other CL records are processed. If multiple macros are defined for the same major command word, the postprocessor will search for all possible matches by looking at the longest command syntax to the shortest.
Macro Command Syntax
Calls to the macro processor are normal postprocessor commands you specify when defining the macro. For example, a macro named” SPINDL” will call the corresponding macro processeach time a SPINDL command appears in the CL file. If amacro is named “SPINDL/#1,RPM,CLW”, the macroprocessor will only be called when all major and minor words are present. The numeric field (#1) becomes a local variable that can be used throughout the macro, but is not available after the macro terminates.
Macros Called Via Functional Invocation
Macros named “>INPUT”, “>OUTPUT”,”> BREAK”, “>LINEAR”, “>CIRCLE”,”> ERROR”,”>TOOLLIST”, “>FEEDRATE”, “> CYCLE”,”>TLCHNG”, “>MODEMILL”, and “>MODETURN”will execute at the appropriate functional entry point if activated within a normal macro via the command syntax “name=ON”.All functional areas can be active concurrently, providing alternative processing techniques and several methods for getting the exact output you desire. The call to “>INITAL” is on by default, and the call is made after the machine number has been read from the CL file.
Macros which Supplement or Replace Standard Processing
Macro processes can be defined to supplement or completely replace normal postprocessor action. Supplemental macros are intended to add MCD or logic either before or after normal postprocessor activity, whereas replacement macros are not seen by the postprocessor logic at all.
Before Normal Processing: Macro definitions preceded by a minus sign (“-SPINDL/…”) will be executed before normal processing of the SPINDL/… logic by the postprocessor.
After Normal Processing: Macro definitions preceded by a plus sign (“+SPINDL/…”) will be executed after normal processing of the SPINDL/… logic by the postprocessor.
Replace Normal Processing: Macro definitions with no minus or plus sign (“SPINDL/…”)will be executed, but normal postprocessor logic will be completely bypassed. In this instance, the user is completely free (and responsible) to set specific logical control SPECs, issue non-standard MCD, and activate functional entry point switches, etc.
The macro command line can be defined to include up to 19 local numeric variables, referred to throughout the macro definition as #1 through #19. For example, an input statement with two variables that can be referenced within a given macro might be:
“SPINDL/ #1, RPM, RANGE, #2”.
The local variables #1 and #2 are not retained after the macroexecutes.
A specialized, high-level programming language has been implemented to provide full programming power needed for complex logical decision-making when necessary. A user macro can issue any non-recursive auxiliary postprocessor commands, GOTO/ commands, and even issue a FINI command to terminate processing. Macros can contain any mixture of the following statement types:
IF (exp) THEN JUMPTO/command_line statements
ELSE and ENDIF statements
$$ Comment Lines
structured MCD blocks
GOTO/ motion records
verified postprocessor commands
variable assignment statements
A full compliment of mathematical function calls allow the ability to capture the intent of the function being altered without hard-coding specific values into a macro process. The supported functions are:
ABS, INT, SIN, COS, TAN, ATAN, ATAN2, MIN, MAX, and SQRT.
These functions along with any other calculations are allowed anywhere a numeric value is appropriate.
Special Intrinsic Functions
Several specialized intrinsic functions are provided which allow the user to easily access words and/or character strings in a CL file record. The functions GETARG and GETSTR will return the value of the word or character string token which appears immediately following (in the CL file record) the argument passed to the function. The ATOI function is provided to convert an ASCII text string found in CL file records such as PARTNO and PPRINT into a numeric quantity.
MCD Output Automatically Formatted
Fully verified direct MCD image can be generated at user-defined strategic points within the logic of a macro process. There is no restriction on placement of MCD data; it can be freely interspersed with other program statements, postprocessor statements, or within logical branches. MCD image can be designated to be:
merged with the next MCD block
output with/without sequence numbers
merged with the next MCD motion block
output as normal MCD
output with the secondary sequence “O” block address
String Formatting To MCD File
Strings of textual information can be interspersed with inputor computed values to accommodate even the most obtuse requirement.
BASIC/FORTRAN-Like Controls: A complete set of formatting controls is provided to control zero suppression, register accuracy, special character representations, and the inclusion of computed variables.
PARTNO and PPRINT Tokens: Extensive string manipulation of character data passed via PARTNO, INSERT, or PPRINT statements allows part name handling, operator message handling, and other string handling capabilities.
Read/Write Access From/To 600+ Specs: All data managed by the postprocessor can be accessed from within a user macroprocedure. This includes all SPEC(…) information and a rich selection of run-time data fields such as current spindle speed, current feed rate, table position, and many more. SPEC updates allow user macro control of the internal data that controls the general postprocessor’s logic flow during an execution, such that subsequent CL file information can be treated differently based upon user-definable conditions. User control is completely equivalent to the level of flexibility previously achievable only via separate FORTRAN compilation and linking.
Access to Current MCD Register Values
The 36 entry MCD register values can be used to control the logic of a user macro procedure. For example:
“IF ( @Z .LT. SPEC(234) ) THEN”; or
“IF (@Z < SPEC (234) ) THEN". Global User Variables Global variables can be shared between macro processes by simply assigning them a non-conflicting 1-8 character name. For example, a permanent record of the active range number from the input statement: "SPINDL/ #1, RPM, CLW, RANGE, #2" can be created by: !sprange = #2. This variable (i.e. sprange) can be subsequently referenced in other macros by entering the variable in parentheses anywhere a numeric field is appropriate. You can assign up to 106 variables in any one custom postprocessor implementation. Array Access An array is available for storage/retrieval of variable length run-time information such as tool lists, a series of GOTO points, etc. Scan/Rewind CL file The GET/command is available to read forward on the CL file to look for information before actually processing MCD. This powerful feature can be used for defining and recalling CNC parametric macro sequences, intelligently pre-screening CL data, and many other useful tasks. User controls are available to cause the CL input routines to: search for a specific postprocessor command search for the next linear/circular move selectively rewind after macro processing rewind to a specific CL-record Manipulation Of Output Data The functional process named ">OUTPUT” can access MCD register contents just before redundancy checking and formatting. Any and/or all output registers can be temporarily suspended and recalled for selective output generation. This feature allows macro access to computed MCD register values for automated formatting activities, and customized MCD block breakup.
Process a CL file record
IntelliPost® has the ability to PROCESS a cl file record after it has been gotten with a GET/command. This capability easily enables the user to alter the sequence of records in a CL file to suit his own application. After PROCESSing, the IGNORE command may be used to instruct IntelliPost® not to reprocess the same command the next time it is read during normal processing.
The RUN/ facility, when used in conjunction with MCD/OFF-ON, allows selective pre-processing of the CL file to examine down stream events. The difference between “GET/” and ” RUN/”is that” RUN/” fully executes all postprocessor logic whereas “GET/” simply scans forward on the CL file. The modifier on the “RUN/” command indicates how far the System is to process, i.e. “RUN/LOADTL” will process until the next LOADTL statement is encountered. All system variables are set as if you had normally encountered the LOADTL, i.e. active sequence number, cycle time, tool position, etc. are set normally at the tool change point. You can store permanent(global) variables, and use this information after rewinding the CL file back to its initial position. The system always keeps track of the current position and machine states, such that all previous conditions are reinstated after an “MCD/ON” command is issued.
Nested Macro Calls
The system allows for nested macro calls. If some procedure or mathematical calculation is to be performed several times in one or more macros, it makes sense to isolate this procedure in a separate macro, and call it at the appropriate time. Macro calls may be nested up to 5 deep.
Perform Logical Tests on CL-Record Fields
Each entry in a CL record can be examined from within a macro to provide sophisticated logical control for special events/logic equivalent to that previously attainable only in a custom FORTRAN-written postprocessor.