The Intent language supports calling .NET code directly in rules, including calling the .NET API, the Inventor API, and your own module.
This is the simplest example of a .NET API call in the Immediate pane, as shown below. Calls must start from the System namespace.
Intent >system.dateTime.now() --> <5/17/2012 9:18:07 AM> Intent >system.dateTime.now.toString() --> "5/17/2012 9:19:05 AM"
You can use the same example in a rule formula or rule body:
Uncached Rule NowString As String = "The local time is " & system.dateTime.now.toString()
You can access the top level Inventor application object with Autodesk.Intent.IntentAPI.Instance.HostAPI.HostApplication, which corresponds to ThisApplication in VBA. Creating a rule is the most efficient way to use this object:
Rule InventorApplication As Any = Autodesk.Intent.IntentAPI.Instance.HostAPI.HostApplication
With this rule you can access the entire Inventor API. Refer to the Inventor API Reference for details. Here are some simple examples:
Intent >InventorApplication.Caption --> "Autodesk Inventor 2012 - [Spiral Staircase.iam]" Intent >InventorApplication.Caption = "MyApplication" --> False Intent >InventorApplication.ApplicationAddins --> <System.__ComObject> Intent >InventorApplication.ApplicationAddins.count --> 48
See Interacting with the Inventor Host API for more information.
Place your dll in the search path, like C:\Program Files\Autodesk\Inventor ETO Components 20xx\Bin.