0 Replies Latest reply on Dec 9, 2016 8:16 AM by Yong Ning

    How to  change coordinate of line in View with API

    Yong Ning

      Follow code, can be get coordinate of line.

      Coordinate  is

          line[0]

            start pt = (-60.1111448571599, 25.4136597821846, 0) mm

            end   pt = (63.4503085413511, 25.4136597821846, 0) mm

          line[1]

            start pt = (-60.1111448571599, 25.4136597821846, 0) mm

            end   pt = (-60.1111448571599, -24.9454199642674, 0) mm

       

       

      Help me, How to move coordiante of line?

       

      0.jpg

       

       

      ''

       

       

      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 SwDraw As DrawingDoc

              Set SwDraw = SwModel

          Dim SwView As View

              Set SwView = SwSelMgr.GetSelectedObject5(1)

          Dim vLines, lCount

              vLines = SwView.GetLines4(1)

              lCount = SwView.GetLineCount2(1)

              Stop

              For i = 0 To SwView.GetLineCount - 1

                   Debug.Print "    line[" & i & "]"

                      Debug.Print "      start pt = (" & vLines(i * 12 + 6) * 1000# & ", " & vLines(i * 12 + 7) * 1000# & ", " & vLines(i * 12 + 8) * 1000# & ") mm"

                      Debug.Print "      end   pt = (" & vLines(i * 12 + 9) * 1000# & ", " & vLines(i * 12 + 10) * 1000# & ", " & vLines(i * 12 + 11) * 1000# & ") mm"

              Next i

           

              Stop

      End Sub