About Rules and Forms in iLogic

The iLogic Browser lists iLogic rules, forms, global forms, and external rules.

About Rules

A rule is a small Visual Basic (VB.NET) program that can monitor and control other Inventor parameters, features, or components.

iLogic embeds rules as objects directly into part, assembly, and drawing documents. The rules determine and drive the design parameter and attribute values. By controlling these values, you can define the behavior of model attributes, features, and components.

Knowledge is saved and stored directly in the documents, like the way in which geometric design elements are stored.

About Forms

Create and connect a custom user interface to the parameters, properties, and rules of an Inventor part, assembly or drawing document.

Use drag and drop methods to design a user interface with no need for programming. Use the controls to drive changes to an existing design. Form definitions can be document specific and saved with a design document or stored for use across multiple documents.

Note: It is not necessary to have rules to create forms.

About External Rules

External rules can be used as iLogic rules, or as small programs that you run manually (like VBA macros). They are stored in text or VB files, outside of any Inventor document (part, assembly, or drawing). You can run them manually or from other rules.

When you view the list of external rules in the iLogic Browser, the list is the same for whatever document you have open. It is not tied to each individual document.

You can also run external rules as event-driven rules.

About Wizards

iLogic provides several wizards you can use to create sophisticated rules for certain tasks. These wizards are available on the Wizards tab of the Edit Rule dialog box:

The iLogic Browser Environment

In the iLogic Browser, rules are arranged under two tabs:

Forms are arranged under two tabs:

You can control visibility of the iLogic Browser on the ribbon View tab Windows panel User Interface iLogic Browser

Parameters in Rules

You can use standard Inventor parameter names in rules as Visual Basic variables. When you run the rule, the value of the parameter is assigned to the variable. For a numeric parameter, the value is a real number expressed in the document units specified in Tools Document Settings. Text parameters become String variables in the rule. True/false parameters become Boolean variables.

Parameters can appear in two different ways:

External Rules and Parameters

External rules do not run automatically in response to particular parameter changes. Unlike internal rules, parameter names are not automatically available as rule variables.

For example, the following rule statement does not work:

d1 = d0 * 0.5

Instead, use the following:

Parameter("d1") = Parameter("d0") * 0.5

This statement works on any part or assembly with parameters named d0 and d1. It can be used to operate on related parts that share something in common.

Default Entity Names in Rules

Before you use one of the following Autodesk Inventor entity names in a rule, change its name if it was assigned a default name when it was created:

Use a meaningful name. The name change makes it easier to see what the rule is doing.

Another reason to change default names is to make them more portable. In localized versions of Inventor, default item names are translated to the language of that version. The names are automatically changed in the model browser, but not in an iLogic rule. Therefore, the rule may be unable to find items using the default name. If someone else uses the model in a different language version of Inventor, the default names must be changed. This recommendation applies only to items that are called out by name in the rule. For example, the Measure functions can use work feature names. If you have work features, but you do not use them in Measure functions, then you do not have to rename them.One exception to this recommendation is embedded Excel spreadsheets. Do not rename them.

On non-English versions of Inventor, use an English name in the rule. For example:

"3rd Party:Embedding 1"
Note: Some entities such as iMates allow you to specify a name when you create them.

When rule runs

Rules usually run automatically in response to changes in parameter values, if the parameters are used directly as variables in the rule. You can also trigger rules by events.

A rule runs immediately after you edit it, unless it is suppressed. When rules run, changes in the parameters do not update the model until after the rule runs. If necessary, you can force parameter changes to take effect immediately using either:

How a Rule Is Processed

When you create or edit a rule, the rule text is converted into valid VB.NET code and then compiled. Some Inventor parameter names are not valid as VB.NET variable names. To allow for the full range of Inventor parameter names, iLogic internally substitutes new variable names for the Inventor parameters.

Keywords used as parameter names

Although you can use Visual Basic keywords as parameter names, it is not recommended for new documents. However, when you add rules to existing documents, you usually do not have to change any parameter names. If a name is the same as a keyword, and you require that keyword in the rule, you can:

Units in rules

You can use Inventor units in rules in the same manner as they are used in standard Inventor parameter equations.

Example - mixed document units

In this example, a part file uses document units of inches. In the iLogic Parameter Editor:

A rule has been written as:

result = x + y
MessageBox.Show(result,“Mixed Units Defined in Parameter Editor”)

When performing the addition, iLogic converts the value of parameter y from 12.5 mm to .4921 inches. A message box displays the value of 1.49212598425197 and indicates that mixed units are defined in the Parameter Editor.

Conversely, if the document units are defined as millimeters, then iLogic converts the value of parameter x from 1 in to 25.4 mm. A message box displays the value of 37.9 and indicates that mixed units are defined in the Parameter Editor.