I’m trying to select all the edges or faces associated with a hole feature. After selecting the feature, the Selection Manager shows that only one object is selected, even though the 3D area appears to highlight the associated edges or faces.
Option Explicit
Dim swApp As Object
Dim swModel As Object
Dim selSet As Object
Dim i As Long
Dim n As Long
Dim edgeCount As Long
Sub Main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
If swModel Is Nothing Then
swApp.SendMsgToUser "No active document."
Exit Sub
End If
Set selSet = swModel.SelectionManager
If selSet Is Nothing Then
swApp.SendMsgToUser "Selection manager not available."
Exit Sub
End If
n = selSet.GetSelectedObjectCount2(-1)
edgeCount = 0
For i = 1 To n
If selSet.GetSelectedObjectType2(i) = 3 Then
edgeCount = edgeCount + 1
End If
Next i
swApp.SendMsgToUser "Number of selected edges: " & edgeCount
End Sub
