Get Edges for Vertex Example (VBA)
This example shows how to get a list of the edges that meet at the selected
vertex.
'-----------------------------------------------------
'
' Preconditions: Model document is open and a vertex is
selected.
'
' Postconditions: All edges that meet at the selected
vertex are selected.
'
'-----------------------------------------------------
Option Explicit
Sub main()
Dim
swApp As
SldWorks.SldWorks
Dim
swModel As
SldWorks.ModelDoc2
Dim
swSelMgr As
SldWorks.SelectionMgr
Dim
swVert As
SldWorks.Vertex
Dim
vEdgeArr As
Variant
Dim
vEdge As
Variant
Dim
swEdge As
SldWorks.Edge
Dim
swEnt As
SldWorks.entity
Dim
bRet As
Boolean
Set
swApp = Application.SldWorks
Set
swModel = swApp.ActiveDoc
Set
swSelMgr = swModel.SelectionManager
Set
swVert = swSelMgr.GetSelectedObject5(1)
swModel.ClearSelection2 True
vEdgeArr
= swVert.GetEdges
For
Each vEdge In vEdgeArr
Set
swEdge = vEdge
Set
swEnt = swEdge
bRet
= swEnt.Select4(True, Nothing):
Debug.Assert bRet
Next
vEdge
End Sub
'-----------------------------------------------------