Router-CIM Automation Suite



Previous topic Next topic  


Previous topic Next topic  

Local and Mac Variables Defined

A MacVar Operation is the same as a LocalVar Operation. However, a Macro can have multiple MacVar definitions located anywhere in the Macro sequence. The LocalVar always appears just after the Panel Operation in a fixed position in the Macro sequence. All definitions below apply to Local Variables and Mac Variables.

A Variable is defined by a Name and a Formula. The Result is determined by the evaluation of the Formula.

Parameter Definitions:

Name - Ascii name of the Variable
Formula - an expression that defines the Variable's result
Result - the evaluated result of the Formula
Condition - a logical formula that evaluates to True or False. True and False or represented as 1 or 0 in the grid. If True, the Variable will be evaluated. If False, the Variable will be skipped, not evaluated and not available for reference by any Macro Operations.
Status - used only by the LocalVar Operation. Options or Tagged and Dynamic. These options are used by Router-CIM Automation suite.
Notes - text description of the Variable.

Variables are evaluated in the order of position in the Macro sequence. All defined variables are available to all following Operations.

Variable Naming Conventions

Variable names can not be a LISP function name, a CAL function name or any Protected Variable name defined by the Macro Builder
Characters used to define a variable name must begin with a letter and can not contain special character like <blank>=/<>[]{}()+-*~^

Variable Formula Restriction

A Variable's formula can only reference previously defined Variable names or XDIM, YDIM and ZDIM Panel variables.
A Variable's formula can be a CAL math expression, a Lisp Logical expression or a complex Lisp expression with a numeric result.

Reference the AutoCAD Programmers Reference manual for Lisp function description.

Reference the CAL command in the AutoCAD User Help for CAL function names and expression formats.


Variable Interface


Variables are presented in a grid format. The currently selected variable is indicated by an arrow in the numbered selector, contents are bold type and the grid row appears in a highlighted color.

To Edit an existing variable simply select the Name or Formula field and make the desired edit. Selecting the Result field will not cause an edit. The Result field is the results determined by evaluating the Formula. This occurs after the acceptance of the edits.

To Add a New variable select the Name field next to the last un-numbered row that has an * as its selector. Enter the name, press TAB key and enter the formula.

The Name and Formula fields support the Windows Clipboard. Right Click on the field and the Clipboard menu will display.

Grid Row Editing




Right Click on the Grid with display the Edit Menu.

The Edit menu provides for several different methods to edit the row sequence. These methods are available or not available depending prior edits. When an Edit method is not correct for the selected row, the method will be "grayed out" and not selectable.

These Edit methods are not to be confused with the Windows Clipboard functions. The changing of the grid row is controlled by the Macro Builder using its own internal functions. Even though the methods are similar to Clipboard functions these Edit methods are not Clipboard functions. You can not Copy rows and paste them into another application.

All Edit methods support multiple selection of rows. Multiple selection is performed by hold the Shift or Ctrl key while selecting multiple operations.

NOTE: If a variable name is used in a formula this dependence restricts the removing or deleting the variable name. Options to Remove or Delete the variable will be disabled as shown on the left.


Grid Row Editing Methods

Copy - will make a copy of the selected rows and store those rows in a temporary buffer to be inserted back into the grid at another row location.
Insert - if the temporary buffer contains operations that have been copied or removed, this will insert the collected rows at the ( before ) current selected row.
Remove - will place the selected rows into a temporary buffer and remove the selected rows from the grid. These rows can be insert back into the grid at another row location.
Delete - will delete the selected rows from the grid permanently. A Yes/No question will be asked to validate that you want to delete. No Undo is available.
Move - by picking on a numbered selector on the left of the variable name AND holding down the mouse left button the dragmovecursor drag cursor will appear. Move the selected rows up/down in the grid to a new location.

Grid Cell Editing

After changing a cell content press the TAB key to accept the edit and go to the next cell in the row or press the ENTER key to accept the edit and go to the next row.

Formula Formats

There are three formula formats available:

Numeric - a CAL formatted math expression that evaluates to a numeric result.
Logical - a LISP formatted logical expression that evaluates to True or False
Lisp - a complex LISP expression that evaluates to a numeric result.


CAL evaluates expressions according to standard mathematical rules of precedence:

Expressions in parentheses first, starting with the innermost set
Operators in standard order: exponents first, multiplication and division second, and addition and subtraction last
Operators of equal precedence from left to right

Numeric Expressions

Numeric expressions are real integer numbers and functions combined with the operators in the following table.

Numeric Operators



( )

Groups expressions


Indicates exponentiation

* , /

Multiplies, divides

+, -

Adds, subtracts

The following are examples of numeric expressions:


3 + 0.6

(5.8^2) + PI

Reference the CAL Help in AutoCAD for a complete list of functions available.

IMPORTANT NOTE: A CAL expression's structure is Operand followed by Operator followed by Operand; standard mathematical expressions. A CAL expression DOES NOT START WITH A = SIGN IN ITS DEFINITION. Examples: A + B or (A + B). NO EQUAL SIGN.


A Logical statement can be formatted in two forms:

= A > B - formatted starting with a = sign followed by an Operand, then the Operator, ending with a Operand
=(> A B) - formatted as a Lisp expression. Starts with a = sign to indicate a Lisp expression. See AutoCAD Developer Help, AutoLisp functions.

A logical must start with a = sign. After the = sign either format can be used.

A Logical variable formula can be formatted as a Lisp expression. The structure starts with a left parenthesis, followed by an logical operator, followed by two operands to be compared, then closing with a right parenthesis. Each separated by a space. Example: =(> 1 0) evaluated to True. 1 is greater than 0. Lisp expressions are in the form of prefix notation ( postfix notation ) that places the operators to the left of their operands.

An example of a Logical variable formula using a Lisp expression: =(IF (> VALUE1 25) T (IF (= VALUE2 10) T NIL))) This example reads as IF VALUE1 > 25 THEN TRUE ELSE IF VALUE2 = 10 THEN TRUE ELSE FALSE.  This expression will evaluate as True or False depending on the conditions in the expression. The expression can be as complex as needed up to 1024 characters.

IMPORTANT NOTE: A LISP expression MUST START WITH A  = ( equal sign ). This is required to indicate to the formula field that this is Lisp.


A complex variable formula is formatted as a Lisp expression. Any lisp expression with the use of lisp functions can be used. See AutoCAD Developer Help, AutoLisp functions.

An example of a complex variable formula using a Lisp expression: =(IF (> VALUE1 25) 25 (IF (= VALUE2 10) 5 75))) This example reads as IF VALUE1 > 25 THEN 25 ELSE IF VALUE2 = 10 THEN 5 ELSE 75.  This expression will evaluate as 25, 5 or 75 depending on the conditions in the expression. The expression can be as complex as needed up to 1024 characters.

IMPORTANT NOTE: A LISP expression MUST START WITH A  = ( equal sign ). This is required to indicate to the formula field that this is Lisp.

Character limit for a LISP expression is 1024 characters.

The last evaluated expression must result in a numeric result.

A Special Variable named LISP

If you name a variable with the special name of LISP a lisp expression in the formula field is required. This Lisp expression should not start with a = sign and must start with a right parenthesis (. Any legal Lisp expression can be used and does not have to have the last evaluation be a numeric result. The Result in the Macro builder will always be zero. The LISP variable name can not be reference by any other formula in the Macro. It is a dummy name and should not be considered a Variable name that can be reference by other formulas. Example: (dofunc 5.0). This is a Lisp expression that calls a predefined function named dofunc and passes to the function one parameter 5.0.

Condition Format

The condition format is the same as the Conditional Builder. See the Condition Builder in the Editor Interface section of this Help. An example of a condition is A > B. Notice it starts with an Operand followed by a logical Operator and ending with an Operand. No parentheses are used.

Status Options

Status options include blank ( the default ), TAGGED and DYNAMIC. These status options TAGGED and DYNAMIC are used by Router-CIM Automation Suite.

Reference the Router-CIM Automation Suite documentation for a complete understanding of using variables in automation jobs.


Tagged variables are variables that can be carried to the Router-CIM Automation program with a macro.  By using Tagged Variables, you would not have to go back to Router-CIM to change the variables value.


When would I use the Tagged Variables feature and what type of variables would go into it?

For example, let's say we designed a basic door in the Macro Builder, but we want the ability to quickly change the dimensions of the door on a regular basis. By assigning variable names and proper formulas to the individual features of the door, we can quickly change the size of the door features in Router-CIM Automation Suite without going back into the Macro Builder.

Selecting the TAGGED option of Variable status in the local variables grid will cause both the name and the value of the chosen variable to be displayed in the Router-CIM Automation Suite interface when preparing automation jobs. Only these Tagged Local variables are available during Router-CIM Automation Suite.


The Variables TOEKICK_X, TOEKICK_Y, SHELVES and NUMBER_HOLES are given the values of 5, 4, 3, and 2, respectively and they are also designated as tagged. The macro has accomplished the following:

These "tagged" variables will appear in the Router-CIM Automation Job window when this particular macro is opened in Router-CIM Automation Suite. You are able to make edits to these variables in Router-CIM Automation Suite and have them saved for the particular job you are working on. The changes to the variables will only be reflected in the current job and not in the original macro.
These variables are used when creating formulas which define the parts of the macro. By having variables in the formula opposed to strictly numbers allows the freedom of  changing the macro dimensions in the Router-CIM Automation Suite Job Editor.
Rather than creating a whole new macro from scratch, you can now change the Local Variables values associated with an existing macro, copy and save it under a new name, and have this reflected in the new macro


When a Router-CIM Automation Suite job is built there is an overriding set of variables that stay active for each Macro that is used. Unlike Local and Global variables, these variables can be used in the Macro dimensions of the Router-CIM Automation Suite interface. When a Dynamic variable is created there will be a scan done of all the Macros in a job so that all the Dynamic variables previously created are made available. Dynamic variables are not limited to variable definitions in the Macros.

Dynamic Variables are defined in two locations when using the Router-CIM Automation Suite:

In the Local Variables in the Macro Builder - similar to tagging a variable by specifying the variable as a Dynamic in the Macro.
In the Dynamic Variables list in the Router-CIM Automation Suite Job Editor.

Reference the Dynamic Variable documentation in the Router-CIM Help.


Text that describes the variable. Optional.

Validation Process

All variable definitions go through a strict validation process when Accept is selected. It is important to know how this process works. The basic rules are simple:

A Variable Name can not be a protected name, CAL function or LISP function name
A Variable Formula that uses variable names must use names that have been previously defined in the evaluation sequence
Variable names and formulas can not contain special characters

Any violation of these rules will result in a validation error and corrections have to be made prior to a successful Accept.

Important Note: If you use complex Lisp statements the validation process is ignored. Complex Lisp statements can not be validated by the validation process. Care must be taken when using Lisp statements. A bad Macro can be developed which can cause an evaluation error. Reference the Evaluation Error section to understand how to resolve those issues.