Getting feature from selected edge in drawing

' Is there a way to get the feature from a selected edge in a drawing ?

' I want to create a program to put Dowel symbols only on Hole Wizard - dowel holes only in a drawing view without having to select the edges manually

' currenly this macro puts dowel symbols on all edges which are circles.

Option Explicit

Dim swCurve                         As SldWorks.Curve

Dim x As Long

Dim dview As String

Dim Part As Object

Dim swSheet                 As SldWorks.Sheet

Dim temp As Variant


Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swModelDocExt As SldWorks.ModelDocExtension

Dim swSelMgr As SldWorks.SelectionMgr

Dim swSelData As SldWorks.SelectData

Dim swComp As SldWorks.Component2

Dim swView As SldWorks.View

Dim swEnt As SldWorks.Entity

Dim vComps As Variant

Dim vEdges As Variant

Dim itr As Long

Dim bRet As Boolean

Sub main()

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

Set swModelDocExt = swModel.Extension

Set swSelMgr = swModel.SelectionManager

Set swSheet = swModel.GetCurrentSheet

Set swView = swModel.GetFirstView
Set swView = swView.GetNextView
dview = swView.GetName2
Debug.Print "    " & dview & " [" & swView.Type & "]"

'While Not swView Is Nothing
'       dview = swView.GetName2
'       Debug.Print "    " & dview & " [" & swView.Type & "]"
'       Set swView = swView.GetNextView
'Wend

bRet = swModel.ActivateView(dview)

bRet = swModelDocExt.SelectByID2(dview, "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)

Set swView = swSelMgr.GetSelectedObject5(1)

swModel.ClearSelection2 True

'Get all visible components

vComps = swView.GetVisibleComponents

'Print name of first visible component

Debug.Print vComps(0).Name2

' Get all edges on the first visible component

vEdges = swView.GetVisibleEntities(vComps(0), swViewEntityType_Edge)

'Iterate through and select all edges on visible component

Set swSelData = swSelMgr.CreateSelectData

swSelData.View = swView

x = 0
Dim myDowelSymbol As Object
For itr = 0 To UBound(vEdges)

    Set swEnt = vEdges(itr)
   
   
    Set swCurve = vEdges(itr).GetCurve

    If swCurve.IsCircle Then

                        bRet = vEdges(itr).Select4(True, swSelData)

                        swModel.InsertDowelSymbol
                        x = x + 1
                        swModel.ClearSelection2 True
                       
                        End If


Next itr


Debug.Print "Number of holes = " & x

End Sub

SolidworksApi macros