Follow code , can be select edge of shell. don't select ellipse edeg.
result is ellipse, not center line.
Private Sub del20161217()
Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2
Set SwApp = Application.SldWorks
Set SwModel = SwApp.ActiveDoc
Dim SwSelMgr As SelectionMgr
Set SwSelMgr = SwModel.SelectionManager
Dim SwDispDim As DisplayDimension
Set SwDispDim = SwSelMgr.GetSelectedObject5(1)
Dim S, S1, S2
Dim SwAnn As Annotation, Annotations
Set SwAnn = SwDispDim.GetAnnotation
With SwAnn
S = .GetPosition
S1 = .GetLeader
Debug.Print S(0), S(1)
End With
Dim tmp
tmp = SwModel.Extension.SelectByID2("", "EDGE", S(0), S(1) + 500 / 15 / 1000, 0, True, 0, Nothing, 0)
tmp = SwModel.Extension.SelectByID2("", "EDGE", S(0), S(1) - 500 / 15 / 1000, 0, True, 0, Nothing, 0)
SwModel.InsertCenterLine2
Stop
Stop
End Sub
SolidworksApi macros