Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
william
1050 Views, 2 Replies

Get solid body name from selected face in assembly or part document

Hello All
I am looking to select a face in either an assembly or part environment, and extract the solid body name from the selected face. 

The difficulty I have run into is, in an assembly the selected face is a kFaceProxyObject and in a part it is a kFaceObject. 

Is there an easy way to access the solid/surface body it belongs to and report the name? 
Any tips? 

 

Links to related threads below

Inventor 2019 Help | Proxies | Autodesk

Solved: iLogic - obtain solid body name using selected feature - Autodesk Community - Inventor

 

Where I have got to so far with the code, 

ThisApplication.StatusBarText = "Select a Face"
Dim doc = ThisApplication.ActiveDocument
Dim entity = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select a Face")

doc.SelectSet.Select(entity)


Dim oSelectSet As SelectSet = doc.SelectSet


Dim Types As ObjectTypeEnum() = [Enum].GetValues(GetType(ObjectTypeEnum))

For Each obj As Object In oSelectSet
    
    For Each Type As ObjectTypeEnum In Types
        If obj.Type = Type Then
            MsgBox(Type.ToString)
        End If 
    Next
    
Next