Reference: Macro Functions
The following functions are available for use when recording SmartCAM Macros. The Function column displays the function name, as well as the data type of the return value and parameters. See the key for what the various data types are.
The function parameter(s) are often labeled as specific information types; such as an element number or a variable name. In most cases, an Expression can be used instead of the specific value. As long as the expression resolves into the correct data type and range. For example, an element number is an integer between 1 and TOTEL() (total number of elements in data base). So, any expression used must also resolve into an integer value in the valid range of element numbers.
Math Functions
A description of the available math functions, for use in macros, is contained in the Automation/Customization - Macro Development Fundamentals - Fundamentals: Math topic.
Macro Branching, Looping, And Control Statements
Function | Description |
---|---|
IF, ELSE, ELSEIF, ENDIF
|
Conditional branching statements, which allow the program to run code only if a certain
condition or set of conditions are met. Statement starts with an IF statement,
which opens the block, the IF is followed by the condition to be met enclosed in Parens. If the
condition is met, all code between the opening IF statement and the closing ENDIF
statement is executed.
The IF block can be expanded to include an
The
For a more comprehensive explanation see Conditional Branching. |
WHILE, ENDW
|
The WHILE block is for conditional looping. Meaning, running the same block of code at least once but
usually multiple times. The block starts with the opening WHILE statement, followed by the test condition; while the
test condition is TRUE the block of code will continue to run. Once the code reaches the end of the block, as noted by
the closing ENDW command, it will jump back to the top and check the test condition again. If TRUE, it will
run the block of statement again. If the condition is no longer true, it jumps down to the ENDW statement and starts
on the very next line.
For a more comprehensive explanation see Conditional Looping. |
GOTO, @LABEL
|
The GOTO command is used for unconditional branching. When a GOTO statement is run, it immediately
tells SmartCAM to find the named @LABEL and begin running the very next macro statement after it.
For a more comprehensive explanation see Unconditional Branching. |
HALT
|
HALT , when encountered, immediately stops the macro execution. It is generally used during macro
development, to quickly stop the running macro in order to verify information.
|
INCLUDE S
|
INCLUDE is used to include one macro file into another. For example, one macro file could include all
the variable declarations and could be included in another macro; which uses the variables. Or, perhaps if there is a
block of macro code used regularly, you could store it in its own .MCL file and include that MCL where you need the
macro code inserted.
The include statement is followed by a quoted literal string which contains the path and filename of the file to include.
For a more comprehensive explanation see Including Variable Declarations. |
Properties of an Element
Geometric Properties for Elements
Function | Description |
---|---|
D=ANG(elmt)
|
Angle value of line, swept value of arc. Returns total (swept) angle for
circular hole pattern. Returns text element (dimension) rotation.
If element is a cone surface, will return the cone angle relative to its axis. |
D=BANG(elmt)
|
For circular hole patterns, returns the Hole Axis value (b-axis angle) for the hole pattern. |
D=CEX(elmt)
|
Center point
If the provided element number is for a surface, will return the top center coordinate position for cones, cylinders, toruses, and spheres. |
D=CBX(elmt)
|
Center bottom point of conic surface or helix. Returns specific coordinate for bottom of
center axis point for given element.
If the provided element number is a surface, it will return the bottom center coordinate position for cones, cylinders, toruses, and spheres. |
D=CPX(elmt, pt)
|
Control point for polylines or splines. Pt is the control point number and starts with 1. For hole patterns, returns the hole position ordinates for each hole. Holes are numbered starting at 1. |
D=EANG(elmt)
|
End angle. Returns end angle of circular hole patterns and helices. |
D=ENX(elmt)
|
End point. For hole pattens, returns the ordinates for the last (end) hole in the pattern.
If the provided element is a surface, will return the maximum position for that surface. For example, if there was a Cylinder centered at XYZ=0 and had a radius of 1 and a height of 1; then ENX would return 1, ENY=1, and ENZ=1. |
D=ERAD(elmt)
|
End radius of arc or helix. |
D=ETAN(elmt)
|
Angle (degrees) of curve tangent at end point of curve, in the workplane of the curve. Supports: lines, arcs and helices. |
D=LEN(elmt)
|
Length value. When used on a hole or hole pattern, returns the hole depth. |
D=LENE(elmt)
|
Path length of element You cannot use the measure functions LENE() and
LENP() on a helix. If you use these in a macro to measure a helix, SmartCAM will display
an error message.
Returns the height of a text element (dimension). |
D=LENP(elmt)
|
Path length of profile You cannot use the measure functions LENE() and
LENP() on a helix. If you use these in a macro to measure a helix, SmartCAM will
display an error message. |
D=MDX(elmt)
|
Mid-point of the element.
Returns the mid-point ordinate for lines, arcs, helixes, points, user commands, markup note leaders, and grooves. |
D=RAD(elmt)
|
Radius value. For circular hole patterns, returns the radius of the pattern.
If element is a surface will return the primary radius for cones, cylinders, toruses, and spheres. Otherwise returns -1. |
D=RAD2(elmt)
|
Secondary radius value. For surface types cone, cylinder, and torus it returns the secondary
radius value, otherwise it returns -1.
Note that for Cylinders the primary and secondary radius values are the same. |
D=STAN(elmt)
|
Angle (degrees) of curve tangent at start point of curve, in the workplane of the curve. Supports: lines, arcs and helices. |
D=STANG(elmt)
|
Start angle. Returns start angle for circular hole patterns and helices. |
D=STX(elmt)
|
Start point. For hole patterns, returns the ordinates for the first (start) hole in the pattern.
If the provided element is a surface, will return the minimum position for that surface. For example, if there was a Cylinder centered at XYZ=0 and had a radius of 1, the STX would return -1, STY=-1, and STZ=0. |
Element Attributes
SmartCAM elements can have attribute data associated with them. Attribute data is assigned to a given element, using a given name (the attribute name). The data is not visible in SmartCAM, but can be queried in macros or code generator template files. Once queried the data can be acted upon.
The attribute data can be string, decimal, or integer values. Each attribute is a pair - the attribute name and the attribute data. Attribute names are not case sensitive, so "ATTRIB" and "attrib" are the same. An attribute name can consist of any combination of human-readable characters, there is no restriction on the length of an attribute name, but longer names leave more room for typos and other errors. Attributes can be assigned to any SmartCAM entity; anything you can find in the List View can have a user attribute assigned to it.
As a hypothetical example, suppose a user wrote a macro that added blends onto all profiles in the active group. When creating the arcs to blend the profiles, the macro could assign attribute data to the newly added arc elements. The user could have another custom macro that can modify the blends in some fashion, the macro would check each arc element found to see if a given attribute exists, if it does, it knows this particular arc element was created by the previous macro and can be modified.
There are two types of attributes: user and system. User attributes can be created, modified, and removed by users. System attributes are created by SmartCAM and users cannot modify or remove this data.
See the Element Attributes topic, in the Code Generation section. This lists the System attributes that are currently exposed and available for use.
Function | Description |
---|---|
I=DELATTRIB(elmt, S)
|
Used to delete user attributes (not SmartCAM created and maintained system attributes).
The first parameter is the element number to modify, the second parameter is a string containing the name of the user attribute to remove from the element. Function returns an integer: 0 if attribute not found, or 1 is attribute found and removed. |
D=DGET(elmt, S, D)
|
Returns decimal user attribute data from a given element. The first parameter is the element to check. The second parameter is a string that contains the name of the attribute to check for. The final parameter is a decimal value to return, if the attribute cannot be found. |
D=DSET(elmt, S, D)
|
Assigns a decimal user attribute to a given element. The first parameter is the element to
add (or update). The second parameter is a string that contains the name of the attribute
to add. The final parameter is a decimal to assign to the attribute.
If the element attribute is new, DSET returns the value that was assigned to the element - the third parameter. If the attribute already exists, and is being updated, DSET returns the previous attribute value. |
D=DSYS(elmt, S, D)
|
Returns a decimal system attribute from a given element. The first parameter is the element to check. The second parameter is a string that contains the name of the attribute to check for. The final parameter is a decimal to return, if the attribute cannot be found. |
I=IGET(elmt, S, I)
|
Returns integer user attribute data from a given element. The first parameter is the element to check. The second parameter is a string that contains the name of the attribute to check for. The final parameter is an integer value to return, if the attribute cannot be found. |
I=ISET(elmt, S, I)
|
Assigns an user integer attribute to a given element. The first parameter is the element to
add (or update). The second parameter is a string that contains the name of the attribute
to add. The final parameter is an integer to assign to the attribute.
If the element attribute is new, ISET returns the value that was assigned to the element - the third parameter. If the attribute already exists, and is being updated, ISET returns the previous attribute value. |
I=ISYS(elmt, S, I)
|
Returns an integer system attribute from a given element. The first parameter is the element to check. The second parameter is a string that contains the name of the attribute to check for. The final parameter is an integer to return, if the attribute cannot be found. |
S=SGET(elmt, S, S)
|
Returns string user attribute data from a given element. The first parameter is the element to check. The second parameter is a string that contains the name of the attribute to check for. The final parameter is a string value to return, if the attribute cannot be found. |
S=SSET(elmt, S, S)
|
Assigns a string user attribute to a given element. The first parameter is the element to
add (or update). The second parameter is a string that contains the name of the attribute
to add. The final parameter is a string to assign to the attribute.
If the element attribute is new, SSET returns the value that was assigned to the element - the third parameter. If the attribute already exists, and is being updated, SSET returns the previous attribute value. |
S=SSYS(elmt, S, S)
|
Returns a string system attribute from a given element. The first parameter is the element to check. The second parameter is a string that contains the name of the attribute to check for. The final parameter is a string to return, if the attribute cannot be found. |
File Handling
These commands are used when working with external text files. These are used in combination with the
following macro functions: F_OPEN[],
F_CLOSE[], F_WRITE[],
F_WRITE[], F_READ[]
and F_DELETE[]
.
For examples of using the SmartCAM macro file handling functions, see the Text (ACSII) Files section of the Macro Recipes topic.
Function | Description |
---|---|
I=F_EOF(path)
|
Reports whether you have reached the end of the file, that you are reading. Values: 0 = Not End of File, 1 = End of File You provide the path and filename as the argument to this function. The filename must
have already been opened, using the |
I=F_ERROR()
|
Reports whether is an error accessing a file. Returns a numeric code which describes the error
type.
Return codes are:
|
S=F_ERRSTR()
|
Returns the error description, as a text string, for file errors. Related to
F_ERROR() . |
I=F_EXIST(path)
|
Reports whether a file exists or not. Values: 0 = File does not Exist, 1 = File Exists Provide the path and filename, of the file to check, as the argument for this function. |
I=F_LINE(path)
|
Returns the line number for the last line read by F_READ[] . |
Properties for Profiles
Supported profiles can be built from lines, arcs, and polylines.
Function | Description |
---|---|
D=AREA(elmt)
|
Calculates the area of a closed profile. The elmt parameter is an element in the
profile. Returns the area of the profile. The area is returned as a negative number if the
winding direction of the profile is clockwise, and a positive area value is the winding
direction is counter-clockwise.
If element number is a surface element, will return the calculated area for that surface. |
I=IS_CLOSED(elmt)
|
Reports whether a profile is closed or open. The elmt is a element in the profile. Values: 0 = Not Closed, 1 = Closed |
I=WINDING_DIR(elmt)
|
Winding direction of a profile. The elmt parameter is a element in the profile. Values: -1 = CW, 0 = Undetermined (mixed), 1 = CCW |
Exist Functions
Function | Description |
---|---|
I[]=ALL_LAYERS()
|
Returns an integer array of all the layers defined in the current process model. The layers do not need to be associated with any geometry, but if not assigned to geometry, the layer needs a description; otherwise, this function will not return its number. The array results are sorted into ascending numerical order - same order as displayed in the Layers List View. |
I[]=ALL_STEPS()
|
Returns an integer array of all the Steps defined in the current process model, where the value returned is the Step Number. The Steps do not need to be used, they just need to be defined. The array results are returned in the order they would display in the Planner and List View. |
I[]=ALL_TOOLS()
|
Returns an integer array of all the Tools defined in the current process model, where the value returned is the Tool Number. The Tools do not need to be used, they just need to be defined. The array results are returned in the order they would display in the Planner and List View. This function is for non-Turning applications: Milling, Fabrication, and EDM. |
I[]=ALL_TUR_TOOLS(Turret #)
|
Returns an integer array of all the Tools, on the selected Turret, defined in the current process model, where the value returned is the Tool Number. The Tools do not need to be used, they just need to be defined. The array results are returned in the order they would display in the List View. This function is for Turning applications. |
I=GRP_EXIST(Grp Name)
|
Checks to see whether the provided Named Group name exists. Values: 0 = Does Not Exist, 1 = Exists |
I=IS_UNKNOWN_D(Variable)
|
Checks to see whether the provided decimal Variable has been assigned a value. When a variable is
created, it is assigned a value of UNKNOWN until an actual value is assigned. Values: 0 = Any other value, 1 = Is UNKNOWN You directly pass in the Variable as the argument: |
I=IS_UNKNOWN_I(Variable)
|
Checks to see whether the provided integer Variable has been assigned a value. When a variable is
created, it is assigned a value of UNKNOWN until an actual value is assigned. Values: 0 = Any other value, 1 = Is UNKNOWN You directly pass in the Variable as the argument: |
I=LAYER_EXIST(laynum)
|
Checks to see whether a Layer officially exists and is persistent. For a layer to
exist it must either be used to create geometry or it must have a description. Values: 0 = Does Not Exist, 1 = Exists |
I=LAYER_USED(laynum)
|
Checks to see whether a Layer has been used to create geometry. Values: 0 = Not Used, 1 = Used |
I=STEP_EXIST(stpnum)
|
Checks to see whether a Step exists. Values: 0 = Not Used, 1 = Used |
I=STEP_USED(stpnum)
|
Checks to see whether a Step has been used to create geometry. Values: 0 = Not Used, 1 = Used |
I=TOOL_EXIST(toolnum)
|
Checks to see whether a Tool exists. Non-turning applications only. Values: 0 = Not Used, 1 = Used |
I=TUR_TOOL_EXISTS(turret, toolnum)
|
Checks to see whether a Tool exists. Used in Turning applications only. Values: 0 = Not Used, 1 = Used |
I=TOOL_USED(toolnum)
|
Checks to see whether a Tool has been used to create geometry. Non-turning applications only. Values: 0 = Not Used, 1 = Used |
I=TUR_TOOL_USED(turret, toolnum)
|
Checks to see whether a Tool has been used to create geometry. Used in Turning
applications only. Values: 0 = Not Used, 1 = Used. |
I=VAR_EXIST(varname)
|
Checks to see whether a variable exists. A variable exists once you assign data to it, for
default variables, or once you define the variable type (i.e., "DECIMAL:#VAR ").Values: 0 = Does Not Exist, 1 = Exists The parameter is expecting a STRING containing the name of the variable, not the variable itself.
The parameter, as shown, is using a literal string for the variable name. It can also use a string variable. |
I=VAR_DEFAULT(varname)
|
Checks to see whether a variable is set to the Default value. The default value is the
value assigned to the variable when it is created. A variable set to the default value has been
created, but has likely not yet been used. The default value depends upon the variable type,
they are: INTEGER = 0 DECIMAL = 1000000.0 STRING = "" (empty string) Values: 0 - Different From Default, 1 = Same As Default The parameter is a string representing the variable name, not the variable itself. This can
be a literal string or a string variable. See |
I=WKPLN_EXIST(wkpln name)
|
Checks to see whether a Workplane exists, using the workplane name as the function parameter.
A workplane exists once it has been defined. Values: 0 = Does Not Exist, 1 = Exists |
I=WKPLN_USED(wkpln name)
|
Checks to see whether a Workplane has been used, using the workplane name as the function
parameter. A workplane is used when geometry references it or is created on it. Values: 0 = Not Used, 1 = Used |
Array Functions
Function | Description |
---|---|
ARRAY[]=ALLOCATE(I, [S|D|I])
|
Allocates memory for a STRING , INTEGER , or DECIMAL array
variable. First parameter is an integer that specifies the number of array slots to create. The
second parameter is the default value for the array slots. The default value must match the type
of array - for example, if allocating memory for an integer array, do not use a string default.
|
I=REALLOCATE(ARRAY[], I, [S|D|I])
|
Reallocates memory for an array, can be used to grow or shrink the size of an array. The
first parameter is the array variable to reallocate, second is the new size of the array, and
the third is the default value for new elements. Function returns an integer containing the
new size of the array.
|
I=SIZE(ARRAY[])
|
Returns the size of the array - the number of array elements. Single parameter is the array variable. Returns an integer with the number of elements in the array. |
String Manipulation Functions
The Function column displays the function name, as well as the data type of the return value and parameters. See the key for what the various data types are.
Function | Description |
---|---|
D=ATOD(S)
|
Returns the decimal value represented by the valid decimal representation at the beginning of the string expression (S). If (S) does not begin with a valid decimal representation it returns 0. |
I=ATOI(S)
|
Returns the integer value represented by the valid integer representation at the beginning of the string expression (S). If (S) does not begin with a valid integer representation it returns 0. |
S=CAT(S1,S2)
|
Returns the concatenation of the string expression (S2) onto the end of the string expression (S1).
String concatenation can also be handled with the "+" operator. Example:
|
I=FIND(S1,S2,I)
|
Returns the position of string expression (S2) in string expression (S1), optionally ignoring
the first (I) characters before attempting to find a match.
This function searches Example:
The optional
If |
S=FMT(N,S)
|
Returns the string created by formatting a numeric expression (N), based on the format (S).
Refer to the Numeric Formats topic, in the Code Generation section of Learning SmartCAM, for detailed information on numeric formatting. Example:
When used with the concatenation operator "
|
S=GET_NAME(path)
|
Returns the filename when it matches the form filename.ext from the end of a full path. |
S=GET_PATH(path)
|
Returns the path segment of a full path and filename. |
I=ISALNUM(S)
|
Checks the character, passed in as a string to see if it is an alphanumeric character; a letter
or a digit [A-Za-z0-9 ]. If a letter, the case of the letter does not matter.
Returns a zero if the character is not either a letter or number. It returns a value greater than zero if the character is a letter or number. It will return a -1 if you pass an empty string variable to the function. If the string you pass to the function contains more than 1 character, only the 1st character will be checked. Use the MID(), LEFT(), RIGHT() functions to check other letters in a larger string.
|
I=ISALPHA(S)
|
Checks the character, passed in as a string, to see if it is an alphabetic character; a
case-insensitive letter between A to Z.
Returns a zero if the character is not a letter. It returns a value greater than zero if the character is a letter. It will return a -1 if you pass an empty string variable to the function. If the string you pass to the function contains more than 1 character, only the 1st character will be checked. Use the MID(), LEFT(), RIGHT() functions to check other letters in a larger string.
|
I=ISDIGIT(S)
|
Checks the character, passed in as a string, to see if it is a digit; a numeric character
[0 to 9].
Returns a zero if the character is not a digit. It returns a value greater than zero if the character is a digit. It will return a -1 if you pass an empty string variable to the function. If the string you pass to the function contains more than 1 character, only the 1st character will be checked. Use the MID(), LEFT(), RIGHT() functions to check other letters in a larger string.
|
I=ISLOWER(S)
|
Checks the character, passed in as a string, to see if it is a lowercase letter.
Returns a zero if the character is either an uppercase letter or not a letter. It returns a value greater than zero if the character is a lowercase letter. It will return a -1 if you pass an empty string variable to the function. If the string you pass to the function contains more than 1 character, only the 1st character will be checked. Use the MID(), LEFT(), RIGHT() functions to check other letters in a larger string.
|
I=ISPUNCT(S)
|
Checks the character, passed in as a string, to see if it is a punctuation symbol; these
symbols include periods, commas, exclamation points, pound signs, quotes, and so forth.
Returns a zero if the character is not punctuation. It returns a value greater than zero if the character is a punctuation symbol. It will return a -1 if you pass an empty string variable to the function. If the string you pass to the function contains more than 1 character, only the 1st character will be checked. Use the MID(), LEFT(), RIGHT() functions to check other letters in a larger string.
|
I=ISSPACE(S)
|
Checks the character, passed in as a string, to see if it is a space character. Whitespace
characters include the spaces and tabs.
Returns a zero if the character is not a space character. It returns a value greater than zero if the character is a whitespace character. It will return a -1 if you pass an empty string variable to the function. If the string you pass to the function contains more than 1 character, only the 1st character will be checked. Use the MID(), LEFT(), RIGHT() functions to check other letters in a larger string.
|
I=ISUPPER(S)
|
Checks the character, passed in as a string, to see if it is an uppercase letter.
Returns a zero if the character is either a lowercase letter or not a letter. It returns a value greater than zero if the character is an uppercase letter. It will return a -1 if you pass an empty string variable to the function. If the string you pass to the function contains more than 1 character, only the 1st character will be checked. Use the MID(), LEFT(), RIGHT() functions to check other letters in a larger string.
|
S=ITOA(I)
|
Returns a string representation of the integer expression (I). |
S=LEFT(S,I)
|
Returns (I) number of characters from the left side of the string expression (S). Example:
|
S=LTRIM(S)
|
Returns a string with all white-space characters trimmed from the left side of the string
expression (S). White-Space characters are spaces, tabs, and line-feeds.
For example:
Notice the white-space characters on the right side of the string still exist. |
S=MID(S,I1,I2)
|
Returns the next (I2) number of characters from the string expression (S) starting from
the (I1) position in the string expression. Example:
|
S=REPLACE(S,S1,S2)
|
Finds string expression (S1) in string expression (S) and replaces it with string expression (S2). |
I=RFIND(S1,S2,I)
|
Returns the position of string expression (S2) in string expression (S1) beginning the search
from the end of (S1), optionally ignoring the last (I) characters before attempting to find
a match.
This function searches
The optional
If |
S=RIGHT(S,I)
|
Returns (I) number of characters from the right side of the string expression (S). Example:
|
S=RTRIM(S)
|
Returns a string with all white-space trimmed from the right side of the string expression
(S).White-Space characters are spaces, tabs, and line-feeds. For example:
Notice the white-space characters on the left side of the string still exist. |
S[]=SPLIT_STR(S1,S2)
|
Explodes contents of string (S1) by breaking apart the string when any character in delimiters list (S2)
is encountered. Results are returned in a String Array.
After running this code fragment, the
Functions of this nature are very helpful when working with lists of data, perhaps a line from a Spreadsheet's CSV text format files. |
I=STREQUAL(S1,S2)
|
Returns 1 if the results of the string expressions (S1) and (S2) are identical, 0 if not.
This allows string equivalence to be tested by the |
S=STRIP_EXT(path)
|
Returns a string with the file extension stripped from the end of the path. |
I=STRLEN(S)
|
Returns the number of bytes in the string expression (S). Double-byte characters count as 2. |
S=STRSUB(S,I,I)
|
STRSUB has been replaced with MID(). |
S=STRTMP(S)
|
This function is no longer supported. |
S=TO_LOWER(S)
|
Returns a string where all characters in the string expression (S) are converted to lower case. |
S=TO_UPPER(S)
|
Returns a string were all characters in the string expression (S) are converted to UPPER case. |
S=TRIM(S)
|
Returns a string with all white-space characters trimmed from both the left and right sides of
the string expression (S). White-Space characters are spaces, tabs, and line-feeds.
For example:
Notice the white-space characters on the both sides of the text are trimmed out. |
System Filenames and Paths
Function | Description |
---|---|
INCLUDE "S"
|
Allows one macro file to be included into another. This macro statement includes the
referenced file, into the currently running macro, at the location where the INCLUDE statement
is located.
The INCLUDE statement is very useful for declaring all macro variables in a single file, then including the file at the start of the main macro. This establishes all the needed variables and their data types in a single easy to edit package. The INCLUDE statement is followed by a quoted path and filename of the macro file to include. See the Fundamentals: Variables topic for more information and examples of use. |
S=GET_APP_PATH()
|
Returns the folder where SmartCAM program files reside. |
S=GET_CNC_PATH()
|
Returns the folder where SmartCAM will write NC code files. This is the path
where SmartCAM will write the files, to find the current NC code file use the
CODFILE() macro command. |
S=GET_COMM_PATH()
|
Returns the SmartCAM common files path. This is where SmartCAM's support files are installed; such as sample data, machine and template files, default settings, among others. |
S=GET_CTG_PATH()
|
Returns the folder where SmartCAM will look for Custom Tool Graphic (CTG) files. |
S=GET_JOF_PATH()
|
Returns the folder where SmartCAM will look for the Job Operations Planner (JOF) file. |
S=GET_MCL_PATH()
|
Returns the default folder for SmartCAM Macro Command Language (MCL) files. This is
the default path where SmartCAM will look for or write MCL files, to find the current running
Macro filename, use the MCLFILE() macro command.
|
S=GET_SMF_PATH()
|
Returns the folder where SmartCAM will look for SmartCAM Machine Files (SMF).
This is the path where SmartCAM will look for the files, to get the exact file, use
the SMFFILE() macro command.
|
S=GET_TEMP_PATH()
|
Returns the folder where SmartCAM stores temporary files. |
S=GET_USER_PATH()
|
Returns the folder where SmartCAM User Configuration files reside. These are the
.INI and Keep Default SU files that users can modify.
|
S=CGTFILE()
|
Returns the current Code Generator Template path and file name |
S=CODFILE()
|
Returns the current Code path and file name |
S=JOBFILE()
|
Job file path plus job #DESC filename |
S=MCLFILE()
|
Returns the current Macro path plus current executing Macro name |
S=SHPFILE()
|
Returns the current Process Model path and filename. |
S=SMFFILE()
|
Returns the current Machine file path plus .smf file name |
S=TMPFILE()
|
Returns the current Template file path plus .tmp file name |
S=VERSION()
|
Returns the current application's Header text. The string contains the following information,
separated by spaces: Application name, version number, platform, build date,
build time.
Example: |
Status
Function | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
I=IB_CLEAR_ON()
|
Returns whether or not the Insert Bar Clear field is enabled.
Values: 0 = Off, 1 = On |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=IB_PTOP_ON()
|
Returns whether or not the Insert Bar Profile Top field is enabled.
Values: 0 = Off, 1 = On |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
D=CYLDIAM(elmt)
|
Returns the Cylinder diameter of the given element. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
D=ENV_XE()
|
The end of the view envelope | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
D=ENV_XS()
|
The start of the view envelope | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
D=GRP_DIAG()
|
Returns the longest diagonal measurement of a bounding box oriented parallel to the world XY_PLANE axes, and surrounding the active group. The accuracy of the bounding box is determined by the Surface Entity Bounding Box Mode setting in the Utilities - Options - Performance Options. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
D=GET_IB_CLEAR()
|
Returns the current Insert Bar (IB) Clear value.
This function is only relevant when working with Steps, not Layers. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=GET_IB_OFFSET()
|
Returns the current Insert Bar (IB) Offset value.
Values are: 0 = Left, 1 = Right, 2 = None This function is only relevant when working with Steps, not Layers. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
D=GET_IB_LEVEL()
|
Returns the current Insert Bar (IB) Level value. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
D=GET_IB_PTOP()
|
Returns the current Insert Bar (IB) Profile Top value. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
S=GET_IB_WKPLN()
|
Returns a string containing the current Insert Bar (IB) Workplane Name. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=GET_SURF_ENV_MODE()
|
Returns the current Surface Entity Bounding Box Mode setting from Performance Options.
Values are: 0 = Default, 1 = Exact This function can be used in conjunction with the SURF_ENV_MODE_SET macro command, in order to read the current setting, change to a different setting, and then restore the original setting. The bounding box calculation is used by View - Envelope and the GRP_DIAG() function. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=GRP(I)
|
Returns the element number of an element in the active group. Where the integer parameter is
the Group Element Index.
If the parameter is "0" and an active group exists, GRP returns the number of elements in the active group. If the parameter is in the valid range of total elements in the group, GRP returns the element number of the nth element in the active group. If there is no group or the element is out of range, GRP returns -1. Use "1", as the parameter, for the first element in the group. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=INSCNT()
|
Current status of the Insert Container button, on the Insert Properties bar.
Values: 0 = Off, 1 = On |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=LAST_STEP()
|
Returns the highest Step number currently defined in the open process model. If there are no defined steps, it returns 0 (zero). The Step does not need to be used, it only needs to exist. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=LAST_TOOL()
|
Returns the highest Tool number currently defined in the open process model. If there are no defined tools, it returns 0 (zero). The Tool does not need to be used, it only needs to exist. For non-turning applications. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=LAST_TUR_TOOL(I)
|
Returns the highest Tool number, for a given turret, defined in the open process model. If there are no defined tools, it returns 0 (zero). The tool does not need to be used, it only needs to exist. Provide the turret number as the argument for this function. For turning applications. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=LAYER_BY_NAME(S)
|
Returns the layer number of the first layer with a given name. The argument for this
function is a string that contains the layer name to search for. The layer number for the
first matching name is returned.
If there is no matching layer name, then Passing in an empty string ( The layer name string is case-sensitive. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=LAYER_MASKED(layer number)
|
Is the layer masked?
Values: 0 = Not Masked, 1 = Masked |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=LNUM()
|
Returns the active layer number or -1 if a step number | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=MATCHPROP()
|
Current status of the Match Properties button, on the Insert Properties bar.
Values: 0 = Off, 1 = On |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=OPNLIST(I)
|
Returns values from the job operations setup list, based on the following settings:
If the integer parameter is 0 and the job operations setup has steps defined, OPNLIST returns the number of steps in the step list. If the parameter is 0 and no steps exist, returns a 0. If the integer parameter is a valid index in the step list, returns the step number of that step list entry. If the parameter is greater than the total number of entries in the step list or less than 0, returns a -1. OPNLIST formerly TNLIST(idx). |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
S=OPDESC(stpnum)
|
Returns the string description of the Operation Type. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=OPTYPE(stpnum)
|
Returns the SNCS number for a step number | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=SECTION_STATUS()
|
Determines whether View - Section is enabled or not. Returns 1 if Section is enabled. Returns 0 if Section is not enabled. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=SEL_FILTER_ON()
|
Current status of the Selection Filter button, on the Group toolbar and readout line.
Values: 0 = Off, 1 = On |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=SEQBA()
|
Determines the insert mode.
Values: 0 = Before, 1 = After |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=SEQEL()
|
Determines the current selected insert element number | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=SNUM()
|
Returns the step number of the active step, or -1 if layer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=STEP_INCR()
|
Returns the current Step increment, the value added to the currently highest Step number when a new Step is created. Using this function and LAST_STEP() can calculate what the next step number will be, when a new Step is defined. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=STEP_MASKED(stpnum)
|
Is the step masked?
Values: 0 = Not Masked, 1 = Masked |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=SUBCOUNT()
|
Returns the number of subs present in the process model. The subindexes begin at 0. So if SUBCOUNT() returns 5, the subindexes go from 0 to 4. See also SUB(). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=SUB_IS_USED(subindex)
|
Returns 1 (YES) if the sub is currently being used in the process model, and 0 (NO) if it is not. See also SUB(). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
S=SUBNAME_FRM_EL(elmt)
|
Returns the sub name if the element is a SubCall. Otherwise returns an empty string. See also SUB(). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
S=SUBNAME_FRM_IDX(subindex)
|
Returns the sub name for the given sub index. See also SUB(). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=SUBREPTS(elmt)
|
Returns the number of repeats for a SubCall.
Returns 0 if the element is not a SubCall or there are no repeats. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=SUBTYPE_FRM_EL(elmt)
|
Returns the sub type if the element is a SubCall.
Values: 0 = Not a subcall, 1 = Normal Sub, 2 = Drill Sub See also SUB(). |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=SUBTYPE_FRM_IDX(subindex)
|
Returns the sub type for the given sub index.
Values: 0 = Not a valid sub index, 1 = Normal Sub, 2 = Drill Sub See also SUB(). |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
S=TDESC(stpnum)
|
Returns the tool description for step number | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
S=TLCMT(stpnum)
|
Returns the tool comment for the step number | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
D=TLDIA(stpnum)
|
Returns the diameter of the tool for the given step number | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
D=TLEN(stpnum)
|
Returns the length of the tool for a given step number | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=TLTYPE(stpnum)
|
Returns a number indicating the type of tool for a step number.
It returns a single integer value, use the following table to interpret the return value.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=TOOL_INCR()
|
Returns the current Tool increment, the value added to the currently highest Tool number when a new Tool is created. Using this function and LAST_TOOL() can calculate what the next tool number will be, when a new Tool is defined. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=TOTEL()
|
Determines the number of elements in the database | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
S=TURTOOL(elmt)
|
Returns a string with the Turret number and Tool number, in the format: Turret:Tool .
Returns 0 if a layer. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=UNITS()
|
Returns the process model's current units.
Values: 0 = Inch, 1 = Metric |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=WKPLN_COUNT()
|
Returns the number of workplanes currently defined. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=WKPLN_MASKED("wkpln name")
|
Is the workplane masked?
Values: 0 = Not Masked, 1 = Masked Enter the name of the workplane, exactly as displayed user interface, in quotes. Example:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
D=WKPLN_WRAD(plane index)
|
Returns the workplane wrap radius.
Returns 0 if the plane is not wrapped or doesnt't exist. See Also: PLN(elmt) and PLNNUM(wkpln name) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I=WKPLN_WRAPPED(plane index)
|
Is the workplane wrapped?
Values: 0 = Not Wrapped, 1 = Wrapped See Also: PLN(elmt) and PLNNUM(wkpln name) |
Plane Orientation Functions
Function | Description |
---|---|
D=PLNIX(I)
|
Uses Workplane index as parameter and returns xyz components of a plane's IJKT orientation vectors |
I=PLNNUM(wkpln name)
|
Get plane index from name, PLNNUM(plane-name) |
Utility Functions
Function | Description |
---|---|
I=DIAGMSG(S)
|
Sends a text string to the Utility - Diagnostic text area. You can review this text, by opening the Diagnostic window. Returns the integer 1 is successful. |
D=MEAS_2D_EL(D, D, elmt)
|
Measures the 2D distance between a point and element. The first two decimal parameters are the X and Y locations for the point to measure against. |
D=MEAS_2D_PT(D, D, D, D)
|
Measures the 2D distance between two points. The four decimal parameters are the X and Y locations of the first and second point. |
D=MEAS_3D_PT(D, D, D, D, D, D)
|
Measures the 3D distance between two points. The six decimal parameters are the X,Y,Z values for the two points. |
D=STEPOVER_CUSP(D, D)
|
Calculates the arc center distance between 2 overlapping arcs placed tangent to a line, based on a specified cusp height and radius. The cusp height is measured perpendicular to the line, and represents the distance from the line to the cusp peak. The cusp height must be greater than 0 and less than the radius, and the radius must be greater than 0. |
Date and Time
Function | Description |
---|---|
S=DATE()
|
Returns a string containing the current system date. The returned string is an
eight character filled string, for example: 2-Feb-2009 is returned as 02/02/09.
The |
S=SYSTIME()
|
Returns a string containing the current system time. The returned time uses the format:
Hour:Minute AM/PM. For example: 10:42AM .
The |
Related Topics