AnsweredAssumed Answered

SelectEntity→How to record select entity?

Question asked by Yong Ning on Jun 6, 2017
Latest reply on Jun 6, 2017 by Peter Brinkhuis

RecordEnt.jpg

Now manual select edge. follow key code,

  tmp = SwView.SelectEntity(SwEnt, False)

Help me, How to record of manual select entity?

 

 

 

 

 

Private Sub del20170606()

    Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

        Set SwApp = Application.SldWorks

        Set SwModel = SwApp.ActiveDoc

    Dim SwSelMgr As SelectionMgr

    Dim SwDraw As DrawingDoc

        Set SwDraw = SwModel

    Dim SwView As View

        Set SwView = SwDraw.GetFirstView

        Set SwView = SwView.GetNextView

        Set SwModel = SwView.ReferencedDocument

        Set SwSelMgr = SwModel.SelectionManager

        Debug.Print SwModel.GetPathName

    Dim SwEnt As Entity

        Set SwEnt = SwSelMgr.GetSelectedObject5(1)

       tmp = SwView.SelectEntity(SwEnt, False)

        Stop

        Stop

End Sub

 

 

 

RecordEnt1.jpg

 

 

 

How to change box volume? | SOLIDWORKS Forums  https://forum.solidworks.com/message/281202#comment-281202

InsertMacroFeature→Area | SOLIDWORKS Forums  https://forum.solidworks.com/message/319064

 

 

2010 SOLIDWORKS API Help - Dimension Edge in Drawing Example (VBA)  http://help.solidworks.com/2010/english/api/sldworksapi/dimension_edge_in_drawing_example_vb.htm

 

 

 

 

 

 

 

Private Sub del3()

   Dim Str

   Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

       Set SwApp = Application.SldWorks

       Set SwModel = SwApp.ActiveDoc

   Dim SwDraw As DrawingDoc

       Set SwDraw = SwModel

   Dim SwSelMgr As SelectionMgr

       Set SwSelMgr = SwDraw.SelectionManager

   Dim SwView As View

       Set SwView = SwSelMgr.GetSelectedObject5(1)

       Set SwModel = SwView.ReferencedDocument

       Debug.Print SwModel.GetPathName

       Set SwSelMgr = SwModel.SelectionManager

       ''

   Dim SwDim As Dimension, SwDispDim As DisplayDimension

  

       Set SwDim = SwModel.Parameter("b3@Sketch")

       Debug.Print SwDim.FullName

       SwModel.ClearSelection2 True

       Str = "RD2@注解"

       tmp = SwModel.Extension.SelectByID2(Str, "DIMENSION", 0, 0, 0, False, 0, Nothing, 0)

       Debug.Print SwModel.GetPathName, SwSelMgr.GetSelectedObjectCount

       Set SwDispDim = SwSelMgr.GetSelectedObject5(1)

   Dim SwAnn As Annotation

       Set SwAnn = SwDispDim.GetAnnotation

      

   Dim Ss, Ss1

   Dim SwEnt  As Entity

       With SwAnn

           Ss1 = .GetAttachedEntityTypes

           Ss = .GetAttachedEntities

       End With

      

       Set SwEnt = Ss(0)

       tmp = SwView.SelectEntity(SwEnt, False)

       Stop

      

End Sub

Attachments

Outcomes