|
Tool Parameter Functions
GPP2 supports three special new functions that return the value of any "tool" variable, of the first, last or next tool.
FIRST_TOOL (<tool-variable>) // first tool in run
LAST_TOOL (<tool-variable>) // last tool in run
NEXT_TOOL (<tool-variable>) // next tool
NEXT_PROC_TOOL (<tool-variable>) // tool of next procedure
The tool variable may be any of the system variables used in the CHANGE TOOL block (For example, TOOL_NUM or TOOL_NAME).
The functions do not have a fixed return type. They return a value that is either numeric or string, depending on the type of the requested tool variable. The GPP developer must be familiar with the tool variable types in order to use them correctly.
FIRST_TOOL (TOOL_NUM) Returns a numeric value
FIRST_TOOL (TOOL_NAME) Returns a string value
The variable argument must be one of the TOOL CHANGE variables. An attempt to use another variable (For example, X_CURPOS) will result in a compilation error.
A more detailed discussion on these functions and the subtle differences between NEXT_TOOL and NEXT_PROC_TOOL is provided in the GPP Theory of Operation document.
Note: The tool parameter functions cannot be used directly in OUTPUT and PRINT statements (these functions do not accept any expressions). In order to output NEXT_TOOL(TOOL_NUM) together with NEXT_TOOL(TOOL_NAME) the following code should be used (assume Str is a string variable):
Str = STR_FORMAT(NEXT_TOOL(TOOL_NUM) + " " + NEXT_TOOL(TOOL_NAME);
OUTPUT Str;
|