1 Reply Latest reply on Oct 2, 2013 10:23 AM by Yong Ning

    Convert Entities→Drawing line with API

    Yong Ning

      Aim →Convert Entites drawing line

       

       

      5.jpg

       

      Help me,

      How to choose the arrow point in the picture below。

       

       

      4.jpg

        • Re: Convert Entities→Drawing line with API
          Yong Ning

          Find code is

           

           

          Private Sub tt3()

            Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

            Dim SwSelMgr As SelectionMgr, tmp

            Set SwModel = Application.SldWorks.ActiveDoc

            Dim SwCurve As SketchSpline

           

            Set SwSelMgr = SwModel.SelectionManager

            Set SwCurve = SwSelMgr.GetSelectedObject5(1)

           

            Debug.Print SwCurve.GetLength,

            Debug.Print SwCurve.GetPointCount

            ss = SwCurve.GetPoints

            Dim Pt1(2) As Double, Pt2(2) As Double

            For ii = 0 To 2

              Pt1(ii) = ss(ii)

              Pt2(ii) = ss(ii)

            Next ii

            Dim Pt(2) As Double

            Dim SwLine As SketchLine

           

            Set SwLine = SwModel.CreateLine2(Pt1(0), Pt1(1), Pt1(2), Pt2(0) - 0.02, Pt2(1), Pt2(2))

            SwModel.SketchTrim 2, 1, Pt2(0), Pt2(1)

            'Set SwLine = SwModel.CreateLine2(Pt1(0) - 0.04, Pt1(1) - 0.2, Pt1(2), Pt2(0) - 0.04, Pt2(1) + 0.2, Pt2(2))

            Set SwLine = SwModel.CreateLine2(Pt1(0) - 0.04, Pt1(1) - 0.02, Pt1(2), Pt2(0) - 0.04, Pt2(1) + 0.02, Pt2(2))

            SwModel.SketchTrim 2, 1, Pt2(0) - 0.04, Pt2(1) + 0.02

            With SwLine

              ss1 = .GetStartPoint

              ss2 = .GetEndPoint

              ss = ss2(1) - Pt1(1)

              Pt(0) = ss1(0)

              Pt(1) = Pt1(1) - ss

              SwModel.SketchTrim 2, 0, Pt(0), Pt(1)    . 

            End With

           

          End Sub