How to get geometry information from SelectSet object

How to get geometry information from SelectSet object

Anonymous
Not applicable
288 Views
1 Reply
Message 1 of 2

How to get geometry information from SelectSet object

Anonymous
Not applicable

Hi,
 
I want to get geometry information from selected entity(part or assembly).
 
I am using following code to get SelectSet.
 
 SelectSet selectedEntity = m_application.ActiveDocument.SelectSet;
 
for (int entityCount = 1; entityCount <= selectedEntity.Count; entityCount++)
{
         ComponentOccurrence compOccurrence = (ComponentOccurrence)m_application.ActiveDocument.SelectSet[entityCount];
}
 
From the compOccurrence I can get gemotry information easily. It is working if assembly is selected and not working if single face is selected of a part.
 
 
I need help to identify if single face, sketch or assembly is selected. And how to get geometry data if face of a part is selected.
 
Thanks
Sonam

0 Likes
289 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

Open the VBA object browser and search for "selectevents".

Take a look at the help for "AddSelectionFilter"

Is this what you were looking for?

 

Below is a copy and paste from that help document.

Public Sub TestSelection()
    ' Create a new clsSelect object.
    Dim oSelect As New clsSelect

    ' Call the pick method of the clsSelect object and set
    ' the filter to pick any face.
    Dim oFace As Face
    Set oFace = oSelect.Pick(kPartFaceFilter)

    ' Check to make sure an object was selected.
    If Not oFace Is Nothing Then
        ' Display the area of the selected face.
        MsgBox "Face area: " & oFace.Evaluator.Area & " cm^2"
    End If
End Sub
0 Likes