iLogic provides several variations of a function that can be used to run other functions.
Typically, you change a parameter in a rule to trigger the rule. This function is useful for rules without parameters, or rules flagged with the Don’t run automatically option.
To access these functions, expand the Run Other node under the System tab in the Snippets area of the iLogic Edit Rule dialog.
Runs another rule by specifying just the name of the rule. Use this function for rules such as report generators that do not affect the model, but can refer to many parameters. You can run any rule with this function.
Syntax
iLogicVb.RunRule(“ruleName”)
Example
iLogicVb.RunRule(“Rule0”)
Runs another rule stored in a component within an assembly.
Syntax
iLogicVb.RunRule(“componentName”, “ruleName”)
Example
iLogicVb.RunRule("PartA:1", "Rule0")
For other functions listed in the Run Other category of the Snippets area, see “Advanced API Functions” and “Advanced Rule Programming.”
Runs an external rule from a standard rule in an Inventor document.
Syntax
iLogicVb.RunExternalRule("ruleFileName")
"ruleFileName"
Specifies the name of the rule file, with or without the file extension. You can also specify a file path here, although it can affect the portability of the file. iLogic looks for the rule file in the following folders, in the order listed:
Rule filenames can be relative path names, based in any of these folders.
External rules run from another rule do not have to display in the Rule Browser; however, to edit the rule, add it to the Rule Browser.
Example
iLogicVb.RunExternalRule("color_by_vendor")
Runs an Inventor Visual Basic for Applications (VBA) macro. Macros can be stored in the document or in separate .ivb files. Use Alt + F11 to open the Microsoft VBA editor and view the available macros, and to load or edit macros. If the macro requires arguments, add them after the macro name.
You can call a VBA Function, but you cannot get a return value.
Syntax
InventorVb.RunMacro(“projectName”, “moduleName”, “macroName”)
Examples
InventorVb.RunMacro ("DocumentProject", "Module1", "DrawCustomLines" ) InventorVb.RunMacro ("ThreadMacros", "Module1", "ThreadsInit" ) InventorVb.RunMacro ("ThreadMacros", "Module1", "AddThreads", "3/8-16 UNC")
Required if you want to use external .NET code (see “Advanced Rule Programming”).
Syntax
AddReference “fileName.dll”