2 Replies Latest reply on Feb 13, 2017 6:58 AM by Karthikeyan Karamchandran

    How to get SKETCHPOINT name

    Yong Ning

      0.jpg

       

      Record MACROS, Have sketchpoint  name, result is true

       

      00.jpg

       

      no sketchpoint name ,result is false

      000.jpg

       

       

       

       

       

      Private Sub deldel()

         Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

             Set SwApp = Application.SldWorks

             Set SwModel = SwApp.ActiveDoc

         Dim SwSelMgr As SelectionMgr

             Set SwSelMgr = SwModel.SelectionManager

             tmp = SwModel.Extension.SelectByID2("Point13", "SKETCHPOINT", 1.171609138888, 0.5654, 0, False, 0, Nothing, 0)

             Stop

             tmp = SwModel.Extension.SelectByID2("", "SKETCHPOINT", 1.171609138888, 0.5654, 0, False, 0, Nothing, 0)

               Stop

      End Sub

       

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

      Help me , follow code,

      how to get sketchpoint name?

      selectByID2→Select is True.

       

       

      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 SwPt As SketchPoint

              Set SwPt = SwSelMgr.GetSelectedObject5(1)

              With SwPt

                  Debug.Print .X, .Y, .Z

              End With

          

      End Sub

        • Re: How to get SKETCHPOINT name
          Ivana Kolin
          With SwPt
               Debug.Print .X, .Y, .Z, "Point" & .GetID(1)
          End With
          
          • Re: How to get SKETCHPOINT name
            Karthikeyan Karamchandran

            It's better to avoid point names for selections, if selection is the only requirement for which you are looking for the sketch point name, you have a hot cake in hand, that is the sketch point object. You can select using Sketch Point Object.

             

            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 SwPt As SketchPoint

                    Set SwPt = SwSelMgr.GetSelectedObject5(1)

                    SwPt.Select(False);

               End Sub