What object am I getting?

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

The easiest way to check is by debugging into the code and see what object type the Watches window  shows. 

E.g. the following code …

Sub TestObjects()
Dim f As Face
Set f = ThisApplication.ActiveDocument.SelectSet(1)
Dim paramRange As Box2d
Set paramRange = f.Evaluator.ParamRangeRect
Dim oc As ObjectCollection
Set oc = f.Evaluator.GetIsoCurve(paramRange.MinPoint.X, True)
End Sub

… would show this in the Watches window when I select the side face of a cylinder:

ObjectType

In case of VB and VB.NET you can also use the TypeName function to find out the type name of an object:

Sub TestObjects()
Dim f As Face
Set f = ThisApplication.ActiveDocument.SelectSet(1)
Dim paramRange As Box2d
Set paramRange = f.Evaluator.ParamRangeRect
Dim oc As ObjectCollection
Set oc = f.Evaluator.GetIsoCurve(paramRange.MinPoint.X, True)
Dim item As Object
Set item = oc(1)
Call MsgBox(TypeName(item))
End Sub

Comments

One response to “What object am I getting?”

  1. Inventor Avatar
    Inventor

    This app may be of interest to developers wanting to find details of selected objects very easily.
    https://apps.exchange.autodesk.com/INVNTOR/en/Detail/Index?id=appstore.exchange.autodesk.com%3ainventorselectioninformationPaid%3aen

Leave a Reply

Discover more from Autodesk Developer Blog

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

Continue reading