Inventor Host API reference

The Inventor Host API is accessible from rules . With the following rule , you can access the entire Inventor API. It corresponds to ThisApplication in VBA.

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 the Inventor API Reference for details about the Inventor API.

Note: You cannot call Set_ properties from the Immediate window. To set a value, use a rule . Also, all "=" are interpreted as an equals test, not a set.

GetHostObject()

GetHostObject( p As Part) As Any

The GetHostObject method returns the .NET reference that represents the Inventor object that p defines. If p does not define an Inventor object, the method returns NoValue . The method uses bound values and does not evaluate anything. See the Inventor API Reference for details about what can be called for the particular object. Where applicable, values are returned in Inventor database units: centimetres for length and radians for angles.

Examples

Root

Intent >GetHostObject(Me)
--> <Inventor._DocumentClass>
Intent >GetHostObject(Me).FullFileName
--> "C:\Users\Public\Documents\Autodesk\Inventor ETO 2012\Inventor\Samples\Spiral Staircase.iam"
Intent >GetHostObject(Me).Type
--> <kDocumentObject>

Drawing sheet

Intent >GetHostObject(Me).type
--> <kSheetObject>
Intent >GetHostObject(Me).DrawingViews
--> <System.__ComObject>
Intent >GetHostObject(Me).DrawingViews.Count
--> 3
Intent >GetHostObject(Me).DrawingViews.Get_Item(1)
--> <System.__ComObject>
Intent >GetHostObject(Me).DrawingViews.Get_Item(1).Name
--> "Front"

Linear dimension

Intent >GetHostObject(Me)
--> <System.__ComObject>
Intent >GetHostObject(Me).Type
--> <kLinearGeneralDimensionObject>
Intent >GetHostObject(Me).ExtensionLineOneVisible 
--> True
Intent >GetHostObject(Me).IntentOne
--> <System.__ComObject>
Intent >GetHostObject(Me).IntentOne.IntentType 
--> <kPointEnumIntent>
Intent >GetHostObject(Me).IntentOne.PointOnSheet
--> <System.__ComObject>
Intent >GetHostObject(Me).IntentOne.PointOnSheet.x
--> 18.7777841101695
Intent >GetHostObject(Me).IntentOne.PointOnSheet.y
--> 27.8127309322038

Autodesk Intent API

You can access the Intent API object with Autodesk.Intent.IntentAPI.Instance.HostAPI. The most efficient way to use this object is to create a rule :

Rule IntentAddinAutomation As Any = Autodesk.Intent.IntentAPI.Instance.HostAPI