0 Replies Latest reply on Jun 8, 2014 11:44 PM by Vishaldeep Singh

    i want to make two curves

    Vishaldeep Singh


      in the attachment there is excel file and macro file.

      there is a special symbol "$" in the  excel sheet and i want upto $ sign the curve1 with points in column 1,2,3 and 2nd curve with point in colummn 4,5,6 and after $ sign the curve should generate in curve 3 with points in column 1,2,3 and curve 4 with points in column 4,5,6.


      so my question is is this thing possible in macro coding. what will be the modification required.



      Dim swApp As SldWorks.SldWorks

      Dim swModel As SldWorks.ModelDoc2

      Dim swSketchMgr As SldWorks.SketchManager

      Dim swExcel As Excel.Application

      Dim exSheet As Excel.Worksheet

      Dim i As Integer

      Dim sVal As String

      Dim xpt As Double

      Dim ypt As Double

      Dim zpt As Double

      Sub main()

      Set swApp = Application.SldWorks

          Set swModel = swApp.ActiveDoc

          Set swExcel = GetObject(, "Excel.Application")

          Set exSheet = swExcel.ActiveSheet

          Set swSketchMgr = swModel.SketchManager




      i = 1

            Do While exSheet.Cells(i, 1).Value <> ""

              sVal = exSheet.Cells(i, 1).Value

              If sVal = "$" Then


                  swModel.ClearSelection2 True




              xpt = exSheet.Cells(i, 1).Value * 0.001

              ypt = exSheet.Cells(i, 2).Value * 0.001

              zpt = exSheet.Cells(i, 3).Value * 0.001

              boolstatus = swModel.InsertCurveFilePoint(xpt, ypt, zpt)

               End If

          i = i + 1


          boolstatus = swModel.InsertCurveFileEnd

      End Sub