AnsweredAssumed Answered

Macro doesn't import each file and point

Question asked by Tristan Clark on Mar 19, 2017
Latest reply on Mar 21, 2017 by Ivana Kolin

I have a macro that loops through .sldcrv files with XYZ coordinates in each as a point. For some reason, it'll run through every other file each time it is run. Also, it won't import all the points on the first run. I end up having to run the macro multiple times before all the points are imported. Any ideas? Here is the macro I am using:


Dim swApp As Object

Sub main()


Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc

swApp.ActiveDoc.ActiveView.FrameState = 1


Dim skPoint As Object

Dim num1 As Integer

Dim nsec As Integer


    nsec = 21

    For num1 = 1 To nsec

    Open "\sec" & num1 & ".sldcrv" For Input As #num1

    Part.SketchManager.Insert3DSketch True

    Do While Not EOF(num1)

    Input #num1, X, Y, Z

    Set skPoint = Part.SketchManager.CreatePoint(X, Y, Z)



    Close #num1

    Next num1


Part.ShowNamedView2 "*Isometric", 7


End Sub