The iLogic Browser lists iLogic rules, forms, global forms and external rules.
A context menu is available for items in the iLogic Browser. The commands included in the menu vary depending on the item selected.
In the iLogic Browser, rules are arranged under two tabs:
Forms are arranged under two tabs:
Once the iLogic Browser is shown, it remains displayed until closed manually. This setting is retained across sessions.
The visibility of the iLogic Browser can be toggled on and off by activating or deactivating the iLogic Browser check box. This check box can be found in the User Interface drop-down list located on the Windows panel of the View tab.
Additionally, you can dock the iLogic Browser on either side of the Autodesk Inventor window.
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.
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:
When a rule starts running, iLogic reads the values for these parameters from the model into the rule. When the rule has finished running, iLogic saves the changed values back to the model.
To save the values before the rule has finished running, use the RuleParametersOutput function. This function is useful if you want to change the model immediately.
When you assign values using this method, the values are saved to the model immediately, before the next line in the rule runs. When you read a value using the Parameter function, it is immediately read from the Inventor model.
Change 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 for yourself and others using the model to see what the rule is doing.
Another reason to change default names is to make them more portable. In localized versions of Autodesk 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 Autodesk Inventor, use an English name in the rule. For example:
"3rd Party:Embedding 1"
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:
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:
Rule text is converted internally to valid VB.NET code, which is not visible and is stored with the rule. This type of storage eliminates the need for iLogic to generate the code whenever the rule is run. The code only changes when you edit the rule.
The VB compiler error messages actually refer to this intermediate code. In rare cases with some complex code, you can receive an error that does not correspond to the rule code. When this situation occurs, simplify your code. If necessary, verify that you have a Sub Main() and End Sub statement.
When iLogic converts the rule to valid VB.NET code for compilation, it replaces units with conversion factors.
You can use Inventor units in rules in the same manner as they are used in standard Inventor parameter equations.
In this example, a part file uses document units of inches:
d0 = 4.5 in d18 = 7.2 in sum = d0 + d18MessageBox.Show(sum,”Document Units - Inches”)
Unless otherwise specified, iLogic assumes the units of the numbers are defined as the document units. In this case, the sum equals 11.7. A message box displays the value and indicates that the document units are expressed in inches.
To assign a value of 7.2 mm to the parameter d18, instead of 7.2 in, specify that d18 is expressed in millimeters:
d0 = 4.5 in d18 = 7.2 mm sum = d0 + d18 MessageBox.Show(sum,”Document Units - Inches”)
In this case, the sum equals 4.78346456692913. A message box displays the value and indicates that the Document Units are expressed in inches
To perform the previous calculation for a part file with document units expressed in millimeters, include the inch unit for any parameter expressed in inches (such as d0 = 4.5 in).
Finally, if you omit the unit of length from a statement, iLogic uses the Document Units value.
Example - mixed document units
In this example, a part file uses document units of inches. In the iLogic Parameter Editor:
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.
The unit specification is applied before any other mathematical operation is performed and has precedence over all other operators. Unit names:
The following are examples of valid use of unit names:
12 in 144 in 144 in^2 125.2 mm 60 mi/hr
You can use compound unit specifications in rules. Compound unit specifications follow the Inventor format. To incorporate a complicated unit specification into a rule, create an equation for it in the Parameters dialog box. Then, use Capture Current State on that parameter in the Rule Editor.
External rules can be used as iLogic rules, or as small programs that are 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.
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:
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.
Before you create a rule, first create any parameters that you want to include in the rule.
In an assembly document, select the 3D Model tab to display the assembly components, or select the File Tree tab to display the subassembly and part files. Expand a part file item to display the parameters and features within that file.
For example, capture the current state of a parameter to insert the parameter and its current value, such as d0 = 4.0 in.
Parameters are always captured with their units, but units are not required when you write new equations. You can right-click on a parameter group to capture the state of all parameters of a specific type. You can also right-click on a feature or component to capture its current IsActive state (suppressed or unsuppressed).
To rename a rule, click twice slowly (two discrete clicks) on the name in the iLogic Browser to enable editing, and then change the existing name.
Use the drop-down lists on the toolbar above the rule text area within the Edit Rule dialog box to insert syntax strings into a rule, instead of entering the syntax manually. Once inserted, you can customize the strings as necessary. Choices are available for:
Use the choices in the Snippets area of the Edit Rule dialog box to insert code snippets in a rule. You can then modify the inserted snippet as necessary.
Work with collapsible code regions
Create collapsible code regions and comments
Define collapsible code regions and comments to reduce clutter in the rule text area.
Manipulate outlining of collapsible code regions and comments
Use the following context menu choices in the rule text area to work with collapsible code regions and comments:
Prevent a rule from running automatically
Run a rule without displaying Inventor dialog boxes
Run dependent rules immediately when referenced parameters change value
Prevent a rule from running when parameters change
iLogic does not pre-process the code in a rule identified as Straight VB code; therefore, Inventor parameter names are not recognized in the rule. The rule should contain Classes or Modules that can be called from other rules. Use this option to share code between rules, or as a way to keep code modular. However, note that shared code is more difficult to write.
Choose alternative font style and size for Rule Editor
Select syntax for Capture Current State
This option affects only assemblies, when Capture Current State is used on a parameter in a component within the assembly:
Alternatively, clear the checkbox to exclude the component names (for example, PartA.ipt.d0 = 5.6 in).
To run a rule manually, right-click on the rule in the iLogic Browser, and select Run Rule from the context menu.
To ensure that the parameters in the rule are synchronized with the model, select Regenerate Rule from the context menu before running the rule.
To run another rule explicitly within a rule, use the iLogicVb.RunRule function.
Reorder the tree in the iLogic Browser
Drag and drop any rule in the iLogic Browser to change its order in the tree. Any rule at or below the rule you drop moves down in the tree.
To synchronize the parameters in a specific rule with your model.
This command reconnects the rule to Inventor parameters, recompiles the rule, and then runs it.
Regenerate all rules in the current document
Use this command to synchronize the parameters in all rules with your model.
Alternatively, you can use the Regenerate All Rules command on the ribbon. Select .
Delete all rules in a document
Use this command when you have finished configuring the model and want to save or export a sample configuration. All rules are removed.
The iLogic Browser includes a tab for external rules. From this tab, you can load an external rule or create a new one.
To make an existing rule external:
Save external rules as .iLogicVb files (this extension is recommended), or as .vb or .txt files. Save external rules to a folder that can be found when running them from another rule. iLogic looks for external rule files in the following folders, in the order listed:
The iLogic Browser provides a context menu for the top node (External Rules in Files) and for each rule in the tree.
You can include an icon for an external rule that displays in the iLogic Browser. Create a .bmp file (size 16 X 16 is recommended) with the same name as the rule file, in the same folder.
For example, if your external rule is named Custom Checks Rule.iLogicVb, name the icon file as Custom Checks Rule.bmp.
After you create the bitmap image, restart Autodesk Inventor to display the icon. You cannot edit the icon while Autodesk Inventor is running.
To edit an external rule, open the Edit Rule dialog box, and double-click the rule in the tree to edit it.
You can also use an external program such as Notepad to edit a rule. After you save it, use Reload From File from the context menu in the tree to bring the changes into Inventor.
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
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.
Use wizards to create special rules
Control a dialog box based on model parameters
The Open DLL File dialog box displays the contents of the iLogicAdd folder, which contains previously created DLL files.
Capture the current display view
Use this wizard to create a rule that generates a message box.
For example, if you have chosen YesNoCancel as your button scheme, and your default button is No, select 2.
Display diagnostic information when parameter values fall outside specified range
Use a rule to display a dialog box
You can use a rule to display a dialog box for user input. The dialog box can be contained in the rule; however, it is easier and more flexible to include it in an external DLL (class library).
Use Visual Studio version 2005 or 2008. Visual Basic Express is available as a free download from Microsoft.
Get started with Visual Basic 2008
A new window displays, with the Solution Explorer in the top right corner.
A graphical view of your dialog box displays in the Windows Form Designer. You can use this interface to add controls to your dialog box.
The ToolBox on the left side of the screen lists the controls that you can add to the dialog box. For this project, you add a TextBox to show the value of an Inventor parameter and allow you to edit that parameter.
Public Class Dialog1
Public d0 As Double
d0 = TextBox1.Text
You are almost ready to build the project. When you perform the build operation, Visual Basic creates a DLL file. You can specify where Visual Basic creates this file by modifying the output path for the build operation.
AddReference "ClassLibrary1" Sub Main() dim dlg as new ClassLibrary1.Dialog1 dlg.d0 = d0 i = dlg.ShowDialog() if (i = vbOK)then d0 = dlg.d0 end if End Sub
This rule sends the current value of the Inventor parameter d0 to the dialog box, then shows the dialog box. The person using the dialog box can edit the value in the dialog. When this person clicks OK, the value from the dialog is assigned back to the parameter.
To create a dialog box that enables you to display and modify some parameter values:
A graphical view of your dialog box displays in the Windows Form Designer. You can use this interface to add controls to your dialog box.
The code editor displays in a new subroutine named Dialog1_Load.
TextBox1.Text = d0
Public Class Dialog1
Public d0 As Double
d0 = TextBox1.Text
Imports System.Windows.Forms Public Class Dialog1 Public d0 As Double Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click d0 = TextBox1.Text Me.DialogResult = System.Windows.Forms.DialogResult.OK Me.Close() End Sub Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click Me.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.Close() End Sub Private Sub Dialog1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TextBox1.Text = d0 End Sub End Class
A DLL is created when the project is built. You can either:
The following sample rule uses the dialog box:
AddReference "ClassLibrary1" Sub Main() dim dlg as new ClassLibrary1.Dialog1 dlg.d0 = d0 i = dlg.ShowDialog() if (i = vbOK) then d0= dlg.d0 end if End Sub
This rule sends the current value of the Inventor parameter d0 to the dialog box, and then shows the dialog box. The person using the dialog box can edit the value in the dialog box. If that person clicks OK, the value from the dialog box is assigned back to the parameter.
You can generate similar code for a dialog box automatically. On the Edit Rule dialog box, select the Wizards tab, and then select Create Rule for a Dialog.
Create and connect a custom user interface to the parameters, properties, and rules of an Inventor part, assembly or drawing document.
Use the forms to control and modify the model. The form can be:
Copy and paste an existing form within the same document, to another document, or to the Global Forms tab.
Delete a form when it is no longer needed. Right-click in an empty area of the iLogic Browser tab to display the Forms and Rules Editor where you can delete a form.
Right-click on a rule or parameter in the iLogic Browser to display the context menu for that item.
For a rule, the context menu commands include:
Runs the rule. Use this command to test the rule, or to ensure that the model is up-to-date. You can also use this command to run rules that do not run automatically.
Opens the Edit Rule dialog box for the selected rule.
You can also double-click the rule in the browser to edit it.
Regenerates the selected rule. This command reconnects the rule to the Inventor parameters that it references, then recompiles and runs the rule.
Suppress Rule (or Unsuppress Rule)
A suppressed rule does not run automatically. You can run a suppressed rule manually.
Deletes the rule. You can also delete a rule using the Delete key. To delete all rules, use the Delete All Rules command on the ribbon.
For the document at the root of the iLogic Browser tree, the context menu commands include:
This command performs the same action as the Add Rule command on the ribbon.
Runs all rules in the document. If the document is an assembly, this command also runs all rules in all subassemblies and parts. You can use this command to verify that the model is up-to-date. Execution stops when the first error is encountered. If you receive an error, edit the offending rule and repeat this command.
You can also use this command if you changed something in the model that is driven by a rule. Rules only run in response to parameter changes. Anything else that a rule can set, such as feature or component suppression, iPart configuration, manual changes, or iProperties, can be changed independently.
Rules are run in the order in which they appear in the browser, unless specified otherwise by inclusion of the iLogicVb.RunRule("ruleName") function.
Run All Rules ensures that the model is in the state specified by the rules.
Reconnects the rules to Inventor parameters, recompiles the rules, and then runs them. Like Run All Rules, this command processes rules in subassemblies and parts.
Right-click in an empty area to display the context menu for the tab.
Adds a blank form and opens the Form Editor dialog box for the new form.
Opens the Forms and Rules Editor dialog box to add or edit the controls on the tab.
Right-click on a form to display the context menu for the form.
Opens the Form Editor dialog box for the selected form.
Copies the selected form. Right-click in an empty area of the tab to paste the form.
Create and connect a custom user interface to the parameters, properties, and rules of an Inventor part, assembly or drawing document.
Use the Edit Rule dialog box to define a new rule or change an existing rule.
Use this dialog box to create a rule for a custom dialog box based on the parameters in the model.
Access: | ![]() ![]() ![]() |
Browse for DLL | Displays the Open DLL dialog box, which allows you to select a DLL to populate the dialog box with the class and variable names. |
DLL Name | Displays the name of the selected DLL file. |
Dialog or Class Names | Displays the dialog box or class names for a selected DLL file. You can select or deselect the dialog box or class names. Deselect to omit from the rule. |
Variable Names | Displays the variable names for a selected DLL file. You can select or deselect the variable names. Deselect to omit from the rule. |
OK | Creates the rule. |
Cancel | Cancels the operation. |
Use this dialog box to create a rule that captures the current display view based on a selected size option.
Save and Restore current view extents | Restores the view to the orientation and zoom settings from when the rule captured the view. |
Don’t change view size on restore | Moves the model to the center of the display and sets the orientation, but does not change the zoom. |
Fit to model extents on restore | Moves the model to the middle of the display and fills the display (same as Zoom All). |
OK | Adds text to the rule. |
Cancel | Cancels the operation. |
Use this dialog box to create a rule that generates a message box.
Title | The title that appears at the top of the message box. |
Buttons | The combination of buttons that appear on the message box. |
Default Button | The number of the default button, based on its relative placement in the Buttons selection. |
Icon | The status icon to display in the message box. |
Prompt Text | The text to display in the message box, surrounded by quotes. |
Preview | Displays a preview of the message box, based on your current selections. |
OK | Adds text to the rule. |
Cancel | Cancels the operation. |
Use this dialog box to create a rule that displays diagnostic messages when parameter values are outside of a specified range.
Name | The name of the parameter. |
Max. Value | The maximum value allowed before triggering the message. |
Min. Value | The minimum value allowed before triggering the message. |
Max. Violation | The text to display when the parameter value exceeds the maximum value allowed. |
Title (for Max. Violation) | The title to display on the message box. |
Min. Violation | The text to display when the parameter value falls below the minimum value allowed. |
Title (for Min. Violation) | The title to display on the message box. |
Default | Resets the messages to their default text. |
OK | Creates the rule. |
Cancel | Cancels the operation. |
Advanced rule creation techniques
You can write iLogic rules using only Autodesk Inventor parameter assignment statements, predefined iLogic functions, and simple VB.NET code. However, you are not limited to these techniques. You can use more advanced features of VB.NET in a rule. Visual Basic 2005 or 2008 can be used to create external DLL files that can be called from rules. You can also call DLL files written in C# or C++.
Visual Basic 2008 (.NET Framework 3.5) syntax is supported within the rule code.
The following statements can be used at the top of the rule, before the main rule code:
AddResources "filename.resources"
Option and Imports are standard VB.NET statements.
Option Explicit Off is the default. It allows you to use local variables without declaring them.
Option Strict Off is the default. Option Strict On also works for most rules.
Option Infer On is the default.
The main rule code is an "implicit" subroutine. To add more subroutines, functions, properties, or Classes, declare a Sub Main() as follows:
Sub Main() can be used in any rule, regardless of whether the rule has additional code. For more detailed information about explicitly declaring your rule class, see “How is a rule processed?”
Uses special iLogic syntax. Adding a DLL name to an AddReference statement is like using the AddReference command and browsing for a DLL in Visual Studio or Visual Basic Express. Only .NET assemblies are supported. The DLL can be a standard Microsoft assembly, as in the Microsoft.NET\Framework directory.
For example, consider the following statement:
AddReference "System.Drawing.dll"
In this statement, the .dll extension is optional.
You can also specify a user-created or third-party class library as a reference. User-created or third-party DLLs must all be in one directory. By default, these DLLs are located under the Autodesk Inventor installation directory, in an iLogicAdd subdirectory, such as:
C:\Program Files\Autodesk\Inventor [Version]\Bin\iLogicAdd
You can change this location using the iLogic Configuration command. You can also add references to DLLs in the main Autodesk Inventor Bin directory (for example, C:\Program Files\Autodesk\Inventor [Version]\Bin).
The AddReference statement does not support a full path specification. You can only specify a filename. Add references to assemblies in the Global Assembly Cache (GAC), using a qualified name such as:
AddReference "VsWebSite.Interop, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”
You can also create or access registered COM objects in a rule using CreateObject or GetActiveObject. It is not necessary to use AddReference for a COM DLL.
Includes the code from the specified rule as VB code, compiled with the main rule. The specified rule cannot be a standard rule. It must have the Straight VB code option enabled in the Options panel of the Edit Rule dialog box. iLogic does not pre-process the code in such a rule. The rule contains Classes or Modules that can be called from other rules. Use this statement to share code between rules, or to keep code modular.
AddVbRule "Other Rule"
Operates similarly to AddVbRule, except that the VB code is stored in an external file instead of a rule. As with AddVbRule, the code must have the Straight VB code option enabled. This statement is useful for sharing common code between models. The file specification must be a relative path name. iLogic searches the directory of the current Autodesk Inventor document, and in other directories, using the same search order employed for external rules.
AddVbFile "fileName.vb"
Adds resources such as strings or bitmaps. The resources must be compiled with Visual Studio.
AddResources "fileName.resources"
Duplicate Imports statements are not allowed. The following default Imports statements are implicitly used in all rules:
If you use MessageBox in a rule, then iLogic automatically adds the following statement:
Imports System.Windows.Forms
If you use ThisApplication or other Autodesk Inventor objects, then iLogic automatically adds the following:
Imports Inventor
iLogic provides advanced functionality that allows you to pass context information as rule arguments into the rules you run. This information can be used to modify the behavior of a rule without having to create a duplicate rule.
You pass rule arguments using functions available in the IiLogicAutomation interface (for external clients), and in iLogicVB (for other rule code and internal clients). These arguments are made available within a rule via the RuleArguments property.
For IiLogicAutomation, the functions available include:
Function RunRuleWithArguments(ByVal doc As Inventor.Document, ByVal ruleName As String, ByVal ruleArguments As Inventor.NameValueMap) As Integer
Function RunExternalRuleWithArguments(ByVal doc As Inventor.Document, ByVal ruleName As String, ByVal ruleArguments As Inventor.NameValueMap) As Integer
Function RunRuleDirectWithArguments(ByVal rule As iLogicRule, ByVal ruleArguments As Inventor.NameValueMap) As Integer
For iLogicVB, the functions available include:
Function RunRule(ByVal ruleName As String, ByVal ruleArguments As Inventor.NameValueMap) As Integer
Function RunRule(ByVal compoOrDocName As Object, ByVal ruleName As String, ByVal ruleArguments As Inventor.NameValueMap) As Integer
Function RunExternalRule(ByVal ruleName As String, ByVal ruleArguments As Inventor.NameValueMap) As Integer
To create rule arguments, use the Inventor API to create a new NameValueMap object. It is then passed to one of the functions when running the rule.
Access an argument passed to the rule
x = RuleArguments(“myArg”)
Determine if an argument has been passed to the rule
If RuleArguments.Exists(“myArg”) Then...
Pass the set of arguments to another rule using RunRule
iLogicVB.RunRule(“someOtherRule”, RuleArguments.Arguments)
If you use Sub Main(), the rule follows standard VB.NET format for a class, except that the Class... and End Class statements are not visible, and the statements before Sub Main() are outside the class. Therefore, place all assignment statements inside a Sub, Function, or Property. You can include declaration statements for class member variables such as Private temp As Double = 4.5 outside of a subroutine or function.
You can add Sub, Function, Property, and Class definitions after Sub Main()... End Sub. Any Class you add is nested in the main rule Class for that rule and cannot be used from another rule. To add an independent Class or Module, explicitly declare the rule Class using the following:
Class ThisRule ' ... Sub Main End Sub ' ... End Class
You can then add another Class or Module (or more than one) outside of this code. Class ThisRule becomes your main rule Class, and iLogic calls Sub Main (within it) to run your rule.
To include a Moduleor Class that is visible to multiple rules, put it in an external assembly (DLL). You can put more than one in the same DLL. You can also use AddVbRule to put them in a rule identified as "Straight VB code" within the Inventor document (). Or, use AddVbFile to put them in an external VB file.
When you develop advanced VB.NET code, use Visual Studio or Visual Basic Express rather than coding directly in a rule. You can then cut and paste relatively small snippets of code from Visual Studio into a rule. You can even paste in an entire dialog box Class (although resources are not easily supported). For larger units of code, or where required, create an assembly and use it as an external DLL from a rule.
You can store objects that are instances of a user-defined Class using the iLogic rule Shared Variable functions. To store these objects, serialize the Class, or it must be derived from MarshalByRefObject.
You can write your own external DLLs in .NET and call them from a rule. To debug a DLL, set the build output path under Project Properties Compile to iLogicAdd (under the Inventor Bin directory). Then, choose Inventor.exe for Start external program in your project properties in Visual Studio. This method allows you all the benefits of the debugging environment, including Edit and Continue.
External DLLs are useful when using a rule to display a dialog box for user input.
To access the Inventor API from a rule, use the ThisApplication property to access the Inventor application. Use ThisDoc.Document to access the document that contains the current rule.. You can create and modify features. Use Parameter.Param to get direct access to an Inventor.Parameter.
To use the Inventor API from your own DLL, add a reference to Autodesk.Inventor.Interop.dll in your Visual Basic project. It displays in the Add Reference dialog box on the .NET tab. For Inventor 2011, the version is 15.0.0.0.
Use iLogic interfaces in external DLLs
All iLogic functions are grouped under interface objects such as Parameter, iProperties, iPart, and so on. You can pass iLogic interface objects as arguments to functions in external DLLs. To use these objects in your project, add a reference to Autodesk.iLogic.Interfaces.dll. Select the Browse tab in the Add Reference dialog box, and browse to the iLogicBin directory, under the Inventor bin directory (usually in C:\Program Files\Autodesk\Inventor [Version]\Bin\iLogicBin).
Documentation for the iLogic interfaces is provided in Autodesk.iLogic.Interfaces.xml. You can use the Object Browser in Visual Studio to read the interface descriptions. These descriptions include the names of the objects which implement the interfaces in rules. For example, the Feature object in a rule implements the ICadFeature interface.
Use this dialog to create or edit a custom user interface form.
Drag and drop items from the tabs to the Form design tree to add controls on the user interface design. Only existing parameters and rules display on the tabs.
Design the user interface in the form design tree area.
Drag and drop an item to the form design tree.
Define the properties for the highlighted item in the form design tree. Properties vary depending on the item selected.
Allow Control Resizing | If set True, enables the Resize Controls right-click option on the form. This option allows you to resize controls and groups. |
Edit Control Type | Defines the control type to use to edit this parameter. |
Enabling Parameter Name | Defines the name of an Inventor true/false parameter. Setting this parameter to True enables this control. |
Font | Defines the font for this control. |
Font for Contents | Defines the font for the controls that are within this form or group. |
Image | Defines the image file to display in this control. |
Label | Defines the text to display for this element in the form. |
Maximum Width | Defines the maximum width for this control. The number indicates the number of characters in the specified font. |
Minimum Width | Defines the minimum width for this control. The number indicates the number of characters in the specified font. |
Modal | If set False, you can interact with the model and use other functions while the form is active. |
Picture Parameter Name | Defines a picture control that changes based on the parameter value. Assign a parameter to the picture control instead of assigning an image. Use with a Picture Folder containing pictures with images assigned to the parameter values. See Use images in a form. |
Predefined Buttons | Defines the buttons to show at the bottom of the form. Select from a list of predefined sets. |
ReadOnly | If set True, sets the parameter as not editable from the form. |
Show Item Border | If set True, displays all borders around controls. |
Show on Place Component | If set True, displays the form when placing this model as a component in an assembly. This setting affects Place Component and Place iLogic Component. If the template file has a form, this setting also affects Create In-Place Component. |
Text Location for Contents | Defines the text location for the controla that are within this form or group. |
Tooltip | Defines the tooltip text to display when the mouse hovers over the control. |
Visual Style | Defines the visual style or skin for the form. Select from a list of options. |
Forms and Rules Editor dialog box
Use this dialog to add or edit controls to launch forms and trigger rules from the iLogic Browser.
Drag and drop a rule to the Form design tree to add a button on the iLogic Browser. Use the button to trigger the rule.
Design the iLogic Browser in the form design tree area.
Drag and drop an item to the form design tree.
![]() | Form | Adds a blank user interface form. Customize the form using the Form Editor dialog box. |
![]() | Group | Groups items together on the iLogic Browser. Groups are boxed and collapsible. |
![]() | Tab Group | Creates a tabbed group within the iLogic Browser. |
![]() | Row | Creates a row allowing you to organize controls horizontally. Controls are organized vertically by default. |
![]() | Empty Space | Adds a blank space on the iLogic Browser tab. |
![]() | Label | Adds a text label on the iLogic Browser tab. |
![]() | Splitter | Adds a resizable splitter bar on the iLogic Browser tab. |
Define the properties for the highlighted item in the form design tree. Properties vary depending on the item selected.