AnsweredAssumed Answered

How get feature name in create circle.

Question asked by Yong Ning on Dec 21, 2015
Latest reply on Dec 21, 2015 by Yong Ning

0.jpg

follow code.

         SwSktSeg.Select2 True, 0 →  can be select

 

         Set SwFeat = SwSelMgr.GetSelectedObject5(1) → don't set SwFeat

 

*****************************************************

Private Sub ll()

   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 SwSktSeg  As SketchSegment, SwFeat As Feature, SwSketch As Sketch

      With SwModel

         'tmp = .Extension.SelectByID2("上视基准面", "PLANE", 0, 0, 0, False, 0, Nothing, 0)

         tmp = .Extension.SelectByID2("上视", "PLANE", 0, 0, 0, False, 0, Nothing, 0)

         Set SwSktSeg = .CreateCircleByRadius2(0, 0, 0, 24)       

         SwSktSeg.Select True

         SwSktSeg.GetSketch       

         .InsertSketch2 True

         Set SwSketch = SwSktSeg.GetSketch

       

         SwSktSeg.Select2 True, 0

         Stop

         Set SwFeat = SwSelMgr.GetSelectedObject5(1)

      End With

End Sub

Outcomes