VX Design Automation Language

 

The VX macro interpreter handles program control, sub-macros, local variables, global variables, arrays, IF/ELSE/ELSEIF, ENDIF, WHILE/ENDWHILE, GOTO, etc. VX supports the use of macros as sub-routines, which may have argument lists and return values. This documentation is divided into the sections listed below. Also refer to the NOTES section at the end of this page. Sample VX macros are also available.

 

Add-on programs that automate time-consuming, repetitive, and tedious tasks are now available for VX users. These add-ons, developed by VX engineers and customers using the VX Design Automation Language, are free to download from the VX website and can be customized to meet customers' specific needs.

 

To download and share macros to extend VX and automate complex processes, log on to the VX Support page and go to the Customer Resources section.

 

Basic Macro File Form

 

The instructions and data of a VX macro should be entered in a plain text file. Multiple macros may be included in a file.

 

A macro file is interpreted one line of macro code at a time. By default, a line of code is a newline-terminated line of text within the macro file. A backslash '\' or forward slash '/' at the end of a line causes the macro interpreter to consider the next line as a continuation of the previous line.

 

A line preceded by a pound sign '#' is treated as a comment, and is ignored during macro execution. The line continuation characters (\ or /) do not apply to comments (every line of a comment must be preceded by '#').

 

 

The following case-insensitive "keywords" are reserved by the macro language:

 

MACRO

ENDMACRO

DATA

ENDDATA

GLOBAL

GOTO

RETURN

IF

ELSEIF

ELSE

ENDIF

WHILE

ENDWHILE

LABEL

 

 

 

Keywords must be separated from subsequent text by at least one blank space or tab.

 

If a logical line begins with a reserved keyword, it is interpreted according to the keyword. If it doesn't begin with a keyword, but contains an assignment operator '=', it is interpreted as the assignment of an expression to a variable. If none of the above apply, the line is interpreted as a expression according to the general rules that govern VX equations. Macro commands may be embedded in an expression. Each command has a return value (typically 1 or 0) that is the value used within the expression.

 

A macro command begins with a case-insensitive command name followed by comma-delimited arguments, all of which is enclosed within brackets. The brackets are essential for the macro interpreter to treat the expression as a command.

 

The following is an example:

 

[Print,"Hello World]

 

Names used to identify macros, data blocks, labels and variables can be up to 31 characters long. They are case sensitive and should not contain any blank spaces, commas, parentheses, quote marks, non-printable characters, or characters used in arithmetic or logical expressions

(e.g. +, -, *, <, >, /).

 

The first line of a macro is "MACRO macro_name", where "macro_name" uniquely identifies the macro. The last line of a macro is ENDMACRO. 

 

MACRO MacroName

 

# This is a comment

[Print,"Hello World"]

 

ENDMACRO

 

Blank spaces at the beginning and end of macro lines are ignored.

 

 

Macro Execution

 

To run a macro, type "$run macro_filename" from the command line (excluding the quote marks). The specified macro file will be loaded into memory. VX will look for a macro within the file whose name is the same as the filename, minus the filename's extension. It will execute this macro.  If it doesn't find a macro named the same as the file, it will look for a macro named "main".  The filename may be entered as a path.

 

If it is not a full pathname, VX will search for the file in the your user directory first, then the directories listed in the VX Search Path Form, then the VX installation directories. You'll potentially run into problems if you create macro files with the same names in different directories. Use "File>Search Path..." to add directories to the list of directories that VX searches to find a file.

 

The first time a macro is run, it is pre-processed and loaded into memory. Subsequent executions of the macro use the version already loaded into memory. If you want to force the latest version of a macro file to be re-loaded into memory, run the macro from the command line using:

 

$load macro_name

 

 You can create a shortcut for running a macro as follows:

 

Create a plain text file named "vxCommands" in your user directory or one of the VX installation directories. Enter the shortcut as a keyword less than 16 characters long, followed by a comma, then a command string less than 48 characters long. Lines in vxCommands preceded by pound signs are ignored (i.e. they are treated as comments).

 

When a keyword in vxCommands is typed from the command line, preceded by an exclamation mark '!', the corresponding command string is executed as if it were typed at the command prompt.

 

The following is a sample vxCommands file:

 

#

# VX command shortcuts (shortcut_name,command_string)

#

fil,!FtFlltConst

mac,$load test.vxm

boss,!FtBossExt

# end of file

 

Typing "!mac" from the command line will load the macro file named "test.vxm" and run the macro named "test".

 

If an error occurs during macro execution, an error message is displayed and macro execution is terminated. The error message will indicate the macro file line number where the error occurred.

 

You can cause VX to run a macro automatically at runtime by invoking it with the following syntax "vx -macro <macro filename>".

 

 

Constants

 

Numeric constants may be included in expressions as integer or floating point values. Floating point numbers may be expressed using exponential notation.

 

String constants are expressed as ASCII text bounded by quote marks. A quote mark inside outer quote marks must be preceded by a backslash '\' so it is not interpreted as a terminating quote mark.

 

 

Variables

 

A macro variable can be assigned either a double precision number or a null-terminated ASCII string. A variable is automatically created the first time data is assigned to it. Subsequent assignments overwrite the previous value or string.

 

A numeric or string variable may be indexed as a one-dimensional array by suffixing the variable name with an array index contained inside brackets (i.e. array[5]). Indices must be greater than or equal to zero. An array index may be a constant, another variable or an expression that evaluates to an integral value. An array is automatically lengthened if an assignment is made using an index larger than the current array length. When an array is lengthened, elements that are not explicitly assigned data by the macro are automatically zero'd.

 

If data is assigned to a variable without an array index, the data is assigned to the first element of the variable (array index = 0).

 

An array may contain a mix of numbers and strings. It can be initialized using a comma-delimited list of values, as show below:

 

PointCoord = 10,25,15

 

A numeric variable is assigned a value using the equal sign (=). The expression on the right hand side of the equal sign is passed through the evaluator used for VX equations (see documentation on Equation Sets). When a variable name is encountered in an expression, VX searches local macro variables first, then global macro variables, then variables defined within the active VX object (i.e. feature parameters, part variables). A string variable evaluates to zero in a numeric expression.

 

The following are examples of numeric data assignment:

 

Count = 5

NumArray[0] = 10

NumArray[1] = Array[0] * Count

NumArray[Count] = NumArray[1] + 2

 

A string variable may be assigned ASCII text data from a single string variable or string constant using the equal sign (=). A string constant is a text string within quote marks. A string variable may be assigned data from a numeric variable, or a plus-delimited sequence of variables and constants (either numeric or string) using the "<=" operator. When a numeric variable is included in a string expression, the numeric value is converted to a string using the default C language "%g" format.

 

The followings are examples of string data assignment:

 

TextVariable = "this is a string constant"

String[0] = TextVariable

String[1] <= NumericVariable

String[2] <= String[0] + "another string" + NumericVariable

 

Global variables are defined with the GLOBAL keyword. The keyword may reside inside of outside of a MACRO/ENDMACRO block. The GLOBAL keyword is followed by a unique name, followed by an equal sign, followed by a comma-delimited list of values. The values are assigned to the variable beginning with array index 0. Once a macro file containing the global variable declaration is loaded, the global variables may be accessed from any other macro that is executed. The following is an example of a global variable declaration:

 

GLOBAL GlobalVariable = 23, "Hello World", 1024

 

GlobalVariable[0] and GlobalVariable[2] are numbers.

GlobalVariable[1] is a string (its numeric value is zero).

 

Non-global variable declarations are all local to the macro within which the variables are first referenced. They may not be accessed from outside the macro, except with the "==" operator, which is discussed in the following section on "Sub-Macros."

 

The variable name "VxData" should be reserved for use by VX "Inquire"

commands.

  

 

Sub-Macros

 

A macro may be called as a subroutine with arguments.

 

The arguments are named in a comma-delimited list following the "MACRO MacroName" statement. When "MacroName" is invoked as a submacro with the [CallMacro,macro_name,arg1,arg2,...] command, variables or constants included as arguments in the [CallMacro] command are used to initialize local variables in the sub-macro. These variables will be named using the argument names declared in the "MACRO" definition and initialized with copies of the arguments included in the [CallMacro] command's argument list. If arguments are passed to a macro, but there is no corresponding declaration of argument names in the MACRO definition, the arguments will be copied to local variables named "arg0", "arg1", etc.

 

Note that "macro_name" is NOT a macro file name.  It is the name of

a MACRO definition within the file.

 

The following is an example of a macro calling a macro:

 

# start macro definition

MACRO testmain

 

# call a macro to add two numbers

InputNum = 25

OutputVal = 0

ReturnVal = [CallMacro,AddNumbers,InputNum,30,OutputVal]

[Print,"Return value = ",ReturnVal,",Output value = ",OutputVal]

 

ENDMACRO

 

# test definition of two macros in the same file and '==' operator */

MACRO AddNumbers num1,num2,num3

num3 == num1 + num2

RETURN (num3 + 10)

ENDMACRO

 

The MACRO named "AddNumbers" adds arguments "num1" and "num2" together. In the example, "num1" is passed in from a variable, "num2" is a constant (30). The example shows two ways of getting the result back to the calling macro. One way is with the RETURN keyword, which exits the active macro and returns a numeric value the calling macro.  (if RETURN is not followed by a numeric value, 0.0 is returned)

 

The other way is with the '==' operator, which assigns data both to the specified local variable, and to the variable (if any) in the calling macro that was used to initialize the local variable via the [CallMacro] argument list. The '<==' argument may be used to assign string data to a local variable and its "parent" variable in the calling procedure.

 

 

Conditional Execution

 

The VX expression evaluator supports conditional execution within a single line of code using the syntax described in the documentation on Equation Sets. Macro commands contained within brackets can be inserted in the expression in the place of variables.

 

 

The following is an example (count is a numeric variable):

 

count = 4

(count < 3) then [count=count+1] else [Print,"count is not less than 3"]

 

The in-line conditional must have a "then" statement, but does not have to have an "else" statement.

 

The GOTO keyword redirects macro execution to the line with a specified LABEL. The LABEL keyword is followed by a unique name. The GOTO statement is followed by a unique label name. The following is an example:

 

The following is an example:

 

LABEL FirstLabel

(count < 3) then GOTOFirstLabel else GOTOLastLabel

LABEL LastLabel

 

The macro language supports conditional execution of blocks of data using the following construct:

 

IF (conditional expression) <optional statement>

<statement>

     .

     .

     .

ELSEIF (conditional expression) <optional statement>

<statement>

     .

     .

     .

ELSE <optional statement>

<statement>

     .

     .

     .

ENDIF

 

The above construct must begin with an IF and end with an ENDIF on a separate line. ELSEIF and ELSE are optional. The <optional statement> following IF or ELSEIF is treated like the first separate line of code in the block of code following the condition.

 

Program loops may be constructed using the WHILE/ENDWHILE keywords, as illustrated below:

 

WHILE (conditional) <optional statement>

<statement>

<statement>

ENDWHILE

 

The code following a conditional expression if the expression evaluates to a non-zero value. See the documentation for Equation Sets to learn about the acceptable syntax for conditional expressions.

 

Conditional constructs may be nested.

 

 

System Commands

 

This section documents "system" commands that may be used in macro statements and expressions. If an error occurs during a command, an error message is displayed and macro execution is terminated. Unless otherwise specified, macro system commands return 1. Arguments shown inside <...> are optional.

 

ArrayLen

ArrayReset

CallMacro

CharGet

CharSet

DebugOff

DebugOn

ExitMacro

FileBottom

FileDelete

FilePath

FileRead

FileTop

FileWrite

LoadMacro

NumInt

Print

SetDelimiter

StringClean

StringCompose

StringInput

StringIsBlank

StringLen

StringParseAll

StringParseEnd

StringParseStart

StringSame

SystemCommand

TimeGet

TimePause

TimeString

VarConcat

VarCopy

 

 

[ArrayLen,variable_name]

Returns the number of elements in the array identified by "variable_name".

[ArrayReset,variable_name]

Resets the length of the specified array to zero elements.

 

[CallMacro,macro_name,arg1,arg2,...]

Calls the specified macro with the specified arguments.  The sub-macro can assign data to a variable included in the "CallMacro" command's argument list -- but the variable must be initialized prior to "CallMacro". The RETURN statement may be used to end execution of the sub-macro and return a numeric value to the parent macro. If a RETURN statement is not included before ENDMACRO, then a value of 1.0 is returned.  If a RETURN statement is included, but is not followed by a value, 0.0 is returned.  Be sure NOT to include the *.vxm extension in "macro_name."

 

 

[CharGet,string,n]

 

Returns the ASCII value of the nth character (numbered from zero) of the specified string literal or variable. If "string" is an array, it is treated as a single string composed by concatenating all the elements of the array. If "n" is less than zero or greater than the string's length, 0 is returned.

 

[CharSet,string,n,char]

Sets the nth character (numbered from zero) of "string" to "char", which is forced to a character value. If "n" is less than zero, or greater than the length of "string", this command doesn't modify the string and returns 0. Otherwise, it returns 1. "string" must be the name of a string variable.

[DebugOff]

When this command is encountered in a macro, the macro interpreter will start executing the active macro continuously, instead of line-by-line (see [DebugOn]).

 

[DebugOn]

When this command is encountered in a macro, the macro interpreter will display a small "Debug" GUI form at the bottom of the screen and begin stepping through macro execution line-by-line, showing the next line to be executed and waiting for the user to press the ">" icon to execute the line.  Pressing the ">|" icon will cause the macro to

resume continuous execution.   Pressing the "Stop" icon will pause macro execution, allowing you to start stepping through it again.  Pressing the "Escape" icon will completely exit macro execution. Taking down the "Debug" GUI form will cause the macro to resume

continuous execution. You can press the "Escape" icon on the main GUI topbar to abort macro execution.

 

 

[ExitMacro,<string>]

Displays "string" in the VX message area, if it is included in the argument list. Then terminates macro execution.

 

 

[FileBottom,filename]

Goes to the bottom of the specified file. If the specified file hasn't been opened yet, it is opened by this command. Once a file is opened, it remains open until the macro terminates.

 

 

[FileDelete,filename]

Deletes the specified file.

 

 

[FilePath,filename]

If "filename" does not contain a path specification, the local directory, directories specified in "File/Search Path" and VX installation directories are searched to find the file. If the file is found in one of those directories, it's full path is output to "filename". If "filename" is input with an absolute or relative path, it is not modified. "filename" must be specified by the name of a local macro variable.

 

 

[FileRead,filename,num,output_variable]

Reads text from the specified file from the current file position until "num" characters are read, a new-line character is read or an end-of-file condition is encountered. The text is stored in the specified variable. If the read ended with a newline character, the newline character is not included in the output. If the end of the file is encountered, an empty string is output and 0 is returned. Otherwise, 1 is returned.

 

If the file is not already open, it is opened by this command. Once a file is opened, it remains open until the macro terminates.

 

 

[FileTop,filename]

Goes to the top of the specified file. If the specified file hasn't been opened yet, it is opened by this command. Once a file is opened, it remains open until the macro terminates.

 

 

[FileWrite,filename,arg1,arg2,...]

Writes the text defined by the arguments (arg1, arg2, ...) to the specified file. If the file is not already open, it is opened by this command. If it did not already exist, it is created. If an argument evaluates to the string "\n", a newline character ('\n') is inserted in the file. Once a file is opened, it remains open until the macro terminates.

 

 

[LoadMacroFile,macro_filename]

Loads the specified macro file. This has to be done before a macro in the file can be invoked with the [CallMacro] command. If a filename is specified without a path, this command will search the local directory, directories specified in "File/Search Path", then VX installation directories to find it.  Note that "macro_filename" must include the file's extension (e.g. .vxm).

 

This command will not reload a file if it has already been loaded. This check is only done by filename. So if you have already loaded "test.vxm" from one directory, this macro will not load a macro file with the same name from another directory -- unless a re-load is forced from the VX command line using the "$load" command.  Be sure to include the *.vxm extension in "macro_filename."

 

[NumInt,number]

 

Rounds the input number to the nearest integer and returns the result.

 

 

[OutputDelete,extension]

Deletes the output file whose path is composed from the pathname of the active macro with its extension replaced by the input extension.

 

 

[OutputFile,extension,pathname]

 

Composes the pathname of an output file for the macro that is currently executing.   It is the complete pathname of the active macro with the macro file's extension replaced with the input extension.

 

 

[PathCompose,directory,filename,pathname]

 

Composes a pathname from the input directory name (directory) and file name (filename).

 

 

[PathDir,pathname,directory]

 

Extracts the directory component of the specified path\filename.

 

 

[PathFile,pathname,filename]

 

Extracts the filename from the specified pathname.

 

 

[PathMacro,macro_pathname]

 

Gets the pathname (directory\filename) of the macro that is current executing.

 

[Print,arg1,arg2,...]

Prints the ASCII string formed by concatenating the string representations of the comma-delimited list of arguments to the VX message output area. If an argument is an array, string representations of all elements of the array will be concatenated in the order they occur in the array with each string separated from the previous string by the delimiter defined using [SetDelimiter]. The default delimiter is a comma followed by a blank space.

 

If an argument is enclosed in parentheses or brackets, it is interpreted as a numeric expression. The result of the expression is included in the output string. Each "Print" statement is followed by a newline.

 

 

[SetDelimiter,delimiter_string]

 

Defines the delimiter used by the [Print] command to concatenate an array of strings into a single string. By default, the delimiter is a comma followed by a blank space. The default is restored each time a macro is executed.

 

 

[StringClean,string_variable_name]

Removes leading and trailing blank spaces from the specified string variable.

 

 

[StringCompose,arg1,arg2,...]

 

Composes an ASCII string formed by concatenating the string representations of the comma-delimited list of arguments, excluding the first argument. The resulting string is output to the string variable specified by the first argument. The string is composed according to the rules followed by the [Print] command.

 

[StringInput,prompt,default_input_string,output_variable_name]

Gets string input from the user via a pop-up GUI form. The macro is aborted if the user presses "Cancel" on the GUI form. If the user presses "Okay", with no input, a blank string is output.

 

 

[StringIsBlank,string_variable_name]

Returns 1 if the string is empty or only has white-space characters. Otherwise, returns 0.

 

 

[StringLen,string]

Returns the number of characters in "string", not including the null-terminator. "string" may be either a variable or a constant or a string expression ('+' delimited list of strings).

 

 

[StringParseAll,string_in,delimiter,string_out,count]

Parses an input string (string_in) into an array of strings (string_out) based on an ASCII delimiter input as a single character in quote-marks. The number of strings parsed from "string_in" is output via "count", if "count" is included in the argument list.

 

 

[StringParseEnd,string_in,delimiter,string_out]

Moves the portion of "string_in" between its end and the specified character delimiter (or start of string) to "string_out". The delimiter is not included in the output. The string that is moved to "string_out" is removed from "string_in" along with the delimiter -- operating on the assumption that "string_in" is a variable, not a string literal.

 

 

[StringParseStart,string_in,delimiter,string_out]

Moves the portion of "string_in" between its start and the specified character delimiter (or end of string) to "string_out". The delimiter is not included in the output. The string that is moved to "string_out" is removed from "string_in" along with the delimiter -- operating on the assumption that "string_in" is a variable, not a string literal.

 

 

[StringSame,string1,string2,<case_insenstive>]

Returns 1 if "string1" and "string2" are the same. Returns 0 if they are not the same. Does a case-insensitive comparison if there is a third argument of any kind.

 

 

[SystemCommand,command_string]

Execute "command_string" as a system command. See documentation for C language "system()" function.

 

 

[TimeGet,command_string]

Returns the number of seconds elapsed since 00:00:00 UTC, Jan 1, 1970.

 

Example: CurrentTime = [TimeGet]

 

 

[TimePause,number_of_seconds]

Suspends macro execution for the specified whole number of seconds.

 

 

[TimeString,time_in_seconds,time_string]

Converts the number of seconds returned by [TimeGet] to an readable ASCII string describing the current time and date.

 

 

[VarConcat,variable1,variable2]

Add copies (i.e. concatenate) of elements of "variable1" to the end of the array identified by "variable2".

 

 

[VarCopy,variable1,variable2]

Copy the contents of "variable1" to "variable2". If "variable1" is an array, all elements of the array are copied. Existing elements of "variable2" are overwritten.

 

 

VX Application Commands

 

This section documents general-purpose macro commands for interfacing with VX CAD/CAM. These commands may be used in macro statements and expressions. If an error occurs during a command, an error message is displayed and macro execution is terminated. Unless otherwise specified, VX application commands return 1. Arguments shown inside <...> are optional.

 

The key command for driving VX CAD/CAM from a macro, [vxSend], is documented in this section. [vxSend] sends keywords and inputs to VX as if they were being typed into the VX command line or invoked by pressing buttons on VX menus. It allows the macro language to be used to simulate user input to VX CAD/CAM -- thus driving the software from the macro language.

 

When [vxSend] is used to log a command with VX, and the command errors out, macro execution will usually continue uninterrupted -- unless an error handling macro has been specified using [vxErrHandler]. If a macro logs the name of a sub-macro as an error handler, that sub-macro will be executed when VX template-driven command errors out. The error handling macro can then decide what to do, like setting a global error flag or aborting macro execution using [ExitMacro].

 

Some macro commands utilize entity class numbers. A class number uniquely identifies a particular class (i.e. type) of entities. Some key class numbers are listed in the table below.

 

 

Key Class Numbers

Entity

Class #

Entity

Class #

Entity

Class #

Shape/Faceset

42

2D Point

65

Datum

95

Face

43

Layer

67

Parting Line

106

Edge

46

Sketch

70

Hatch

111

Feature

48

Parametric Entity

72

Light Source

118

NURBS Curve

54

Text

76

Interpolated Curve

119

3D Line

56

Dimension

77

Variable

120

2D Line

58

Annotation Text

83

Equation Set

121

Poly Line

59

Block

86

Symbol

123

3D Circle

60

3D Drawing Sheet View

87

Trace

133

2D Circle

61

Component

88

 

 

3D Arc

62

Part

89

 

 

2D Arc

63

Drawing Sheet

90

 

 

3D Point

64

Drawing Packet

91

 

 

 

 

vxClassName

vxCompAdd

vxCompRoot

vxCrvEval

vxCrvParam

vxEdgeFaces

vxEntActive

vxEntByName

vxEntClass

vxEntEndPnt

vxEntDim

vxEntList

vxEntFaceset

vxEntFtr

vxEntIsCrv

vxEntLabel

vxEntMat

vxEntName

 

 

vxErrHandler

vxFaceEdges

vxFaceEval

vxFaceParam

vxFtrInput

vxShapeFaces

vxFacesetFaces

vxFtrLast

vxFindEnt

vxFileActive

vxFindNew

vxGetFile

vxGetOption

vxGetResponse

vxGetAngle

vxGetDistance

vxGetEntity

vxGetNumber

vxGetString

vxGetPoint

vxGetFile

vxInteract

vxOpId

vxPartComp

vxPartShapes

vxPartFacesets

vxRootIndex

vxRootList

vxSend

vxSend2

vxSendEnt

vxUnitsGet

vxUnitsSet

vxUnitsToSys

vxUnitsToUser

vxVersion

 

 

 

[vxClassName,class_number,class_name]

Outputs an ASCII name via "class_name" (string variable) describing the entity class identified by "class_number" (numeric variable). If the class number is invalid, an empty string is output.

 

 

[vxCompAdd,part,matrix]

 

Instances the part specified by "part" into the target part as a component whose position and orientation is given by "matrix".  "Part" is an ascii string that specifies an existing part as "file_name,part_name" or "part_name".  If a filename is not specified, it is assumed that the part exists in the active file.  "Matrix" should encode a transformation matrix as an array of doubles formatted as shown in [vxEntMat].

 

 

 

[vxCompRoot,comp_index,root_object]

 

Gets the root object instanced by the specified component.  "Root_object" is an ascii string that specifies the root object by the file it resides in and its name (i.e. "file,name").  The component specified by "comp_index" is assumed to reside in the active file.

 

Note: that [vxEntMat] can be used to retrieve the transformation matrix that specifies a component's position and orientation relative to its parent.

 

 

[vxCrvEval,curve_index,t,point,normal]

 

Evaluates the NURBS representation of the curve entity specified by "entity_index".  Outputs the point coordinates (x,y,z) and normal direction at (dx,dy,dz) at the specified "t" parameter value.   Use [vxCrvParam] to get the parameter limits.

 

 

[vxCrvParam,curve_index,limits]

 

Outputs the minimum and maximum t parameter values of the NURBS representation of the specified curve entity.  The parameter limits are output via "limits" as an array of two numbers (tmin,tmax).

 

 

[vxEdgeFaces,edge_index,face_list,face_count]

Outputs a list of indices of the faces connected to an edge. It is assumed the entity resides in the active file.

 

 

[vxEntActive,entity_index,<class_number>]

Outputs the index of the entity that is currently activated for editing (e.g. part, sketch, sheet, plan). "entity_index = -1" is output if there isn't an active entity. If optional "entity_class" is included in the argument list, the active entity's class number is output.

 

 

[vxEntByName,entity_name,entity_index]

 

Searches the active target object for the entity with the specified name.  If it is found, it's index is output via "entity_index".  If it is not found, "entity_index = -1" is output.

 

 

[vxEntByName2,entity_name,entity_index_string]

 

Searches the active target object for the entity with the specified name.  If it is found, it's index is output via "entity_index_string" int the format "#entity_index".  .  If it is not found, "#-1" is output.

 

[vxEntClass,entity_index,class_number]

Outputs the class number (numeric variable) of the specified entity. It is assumed the entity resides in the active file. If "class_number = -1" is output, the entity could not be located.  Class numbers are documented at the beginning of this section.

 

 

[vxEntEndPnt,entity_index,dimension,coordinates]

 

Outputs the end point coordinates of the specified curve entity.  "dimension" is the desired dimension (2 or 3) of the points.  "coordinates" is a numeric array of endpoint coordinates (2D output is x1,y1,x2,y2; 3D output is x1,y1,z1,x2,y2,z2).  The points are defined in the entity's local coordinate space.  It is assumed the entity is a valid curve in the active file.

 

 

[vxEntDim,entity_index,entity_dimension]

Outputs the dimension (numeric variable) of the specified entity. The number 2 is output for 2D entities, 3 for 3D entities, 0 if the entity is not geometry. It is assumed the entity resides in the active file.

 

 

[vxEntList,options,entity_list,count]

 

Gets a list of the entities in the target object (e.g. part, sheet) that pass the selection filter encoded in the input "options"

string.  See [vxGetEntity] for information about the format of the "options" string.  The output entity list consists of an array of integer entity indices.  The number of indices in the list is output via the numeric variable "count".

 

This command is equivalent to executing a "Pick All" within the target object using the specified pick filter.  Therefore, blanked entities are ignored.  Also, an entity pick may be promoted to its parent entity, depending on the pick filter.  For example, if "options" is input as "/edge/face/,", only faces will be added to "entity_list", since all of the edge selections will be mapped to their parent faces.  If a pick filter includes faces and shapes, all faces will be mapped to their parent shape.  If a pick filter includes features (i.e. history operations), geometry entities will be mapped to the feature that created them.

 

 

[vxEntShape,entity_index,shape_index]

[vxEntFaceset,entity_index,faceset_index]

Outputs the index of the shape (shape_index) that the specified face or edge (entity_index) belongs to.  It is assumed the entity resides in the active file.  If "shape_index = -1" is output, the entity could not be located or didn't belong to a shape.

 

 

[vxEntFtr,entity_index,feature_index]

Outputs the index of the parent feature (feature_index) of the specified entity (entity_index). It is assumed the entity resides in the active file. If "feature_index = -1" is output, the entity could not be located.

 

 

[vxEntIsCrv,entity_index]

Returns 1 if the specified entity is curvilinear. Otherwise, returns 0. Macro execution is aborted if the entity cannot be located within the active file.

 

 

[vxEntLabel,entity_index,entity_label]

Outputs a label (string variable) for the specified entity. The label is composed of the entity's class followed by its name or, if it doesn't have a name, its index. It is assumed the entity resides in the active file.

 

 

[vxEntMat,entity_index,matrix]

Outputs the 4x4 transformation matrix associated with the specified entity. The matrix is output as an array of doubles in the following format: xx,xy,xz,0.0,yx,yy,yz,0.0,zx,zy,zz,0.0,dx,dy,dz,1.0

     

     xx,      yx,      zx,      dx

     xy,      yy,      zy,      dy

     xz,      yz,      zz,      dz

       0       0       1

 

Macro execution is aborted if specified entity cannot be located. If the entity doesn't have a transformation matrix associated with it, the identity matrix is output.

 

 

[vxEntName,entity_index,entity_name]

Outputs the name (string variable) of the specified entity. It is assumed the entity resides in the active file. A blank string is output if the entity doesn't have a name.

 

 

[vxErrHandler,macro_name]

Activates "macro_name" as the macro that is called when a template-driven VX command errors out. Template-driven command names are preceded by an exclamation mark (e.g. !CdFileNew). In some cases, the error handling macro is called when a "$" command errors out. When an error handling macro has not been defined, macro execution is terminated when a template-driven command errors out.

 

 

[vxFaceEdges,face_index,edge_list,edge_count]

Outputs a list of indices of the edges that belong to a face. It is assumed the face resides in the active file.

 

 

[vxFaceEval,face_index,u,v,point,normal]

 

Evaluates the NURBS representation of the face entity specified by "entity_index".  Outputs the point coordinates (x,y,z) and normal direction at (dx,dy,dz) at the specified "u" and "v" parameter values.  Use [vxFaceParam] to get the parameter limits.

 

 

[