Variables Functions Reference (iLogic)

You can use shared variable functions or new array (standard Visual Basic) functions.

To access the Variables functions, expand the Variables node under the System tab in the Snippets area of the iLogic Edit Rule dialog.

Shared Variable functions

iLogic shared variables are shared between rules and stored in memory. Unlike Inventor parameters, they are not associated with any part or assembly. You can use shared variables instead of Inventor parameters to pass data between rules. You can also use them to store data that cannot be stored in Inventor parameters. The following examples demonstrate their use:

SharedVariable(“Thread1”) = “1/4-20 UNC”

Assigns a text value to a shared variable called Thread1. If the variable does not exist, it is created.

s0 = SharedVariable(“Thread1”)

Assigns the value of a shared variable to a text parameter. The variable type is known because you created it previously.

SharedVariable(“Distance1”) = 7.2

Assigns a number to a shared variable.

d0 = SharedVariable(“Distance1”)

Assigns the value of a shared variable to a numeric parameter.

if SharedVariable.Exists(“Thread1”) then

Tests whether a parameter exists. If the parameter was created in another rule, this function returns True.

SharedVariable.Remove(“Thread1”)

Removes (deletes) a shared variable. Although not required, this function is recommended if you know you no longer need the variable.

SharedVariable.RemoveAll()

Removes all shared variables. Use this function with care in a rule. If any unrelated parts and assemblies are open that use shared variables, use the Free iLogic Memory command instead.

New Array functions

The New Array functions are standard Visual Basic functions you can use to define different types of arrays and set initial values. For more information on these functions, refer to the Visual Basic help.

New Double Array

Defines a new Double type array and sets initial values.

MyDoubleValues = new double(){1.2,2.2,3.3}

New Integer Array

Defines a new Integer type array and sets initial values.

MyIntegerValues = new integer(){1,2,3}

New String Array

Defines a new String type array and sets initial values.

MyStringValues = new string(){string1,string2}

New Object Array

Defines a new Object type array and sets initial values.

MyObjectValues = new object(){“string”,true,1.234}

New Array List

Defines a new ArrayList type variable and add some values to it.

Dim MyArrayList As New ArrayList
MyArrayList.add(“string”)
MyArrayList.add(1.234)
MyArrayList.add(True)

For Each Loop

Loops through the values in an Array or ArrayList variable.

for each oval in MyVariableHere
msgbox(oval)
next