Discover object model

<?xml encoding=”UTF-8″>By Adam Nagy

One of the easiest ways to find out where to look for information inside the object you’re interested in is to check it in VBA Watches window.

This article talks about the other options as well: http://modthemachine.typepad.com/my_weblog/2008/09/inventor-api-fundamentals-003—the-object-model.html

You just have to select the object in the user interface, then debug into a simple code like this and then you can hunt for the property you need:

Sub TestConstraint()
Dim obj As Object
Set obj = ThisApplication.ActiveDocument.SelectSet(1)
End Sub

If, for example, you want to get to the first document whose instance is involved in a constraint, just select the constraint in the user interface, and when debugging into the code you can find two ways to get to the PartDocument:
1) Constraint > EntityOne > ContainingOccurrence > Definition > Document

2) Constraint > AffectedOccurrenceOne > Definition > Document

FlushConstraint

 


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading