If you have XYZ point in a tab delimited text file, this macro will import the data and draw straight line segments between the points and ask you to name the sketch. If your XYZ data changes, then just re-run the macro and tell it what sketch to update. The lines will move to the new points.
The main benefit of this macro is that any references connected/mated to the original data will not be lost after an update because the lines/points are moving and not being replaced or renamed.
SolidworksApi macros
I found an error in the "update" portion of the macro. The text file needs to have coordinates between 4 and 8 characters long, e.g. 1.234567, -11.6543, 999.4567, 12.1, 1.65 are all acceptable coordinate components.
If you run the macro and import S1.txt and then run the macro to update your existing sketch using S2.txt the existing sketch updates.
I haven't tested it yet but thanks for the updates. Also I referred Jeff on (www.swgeeks.com) to use your macro and here are his comments
Thanks for posting this. Was able to send it to a customer to use right away. New there had to be a macro to read in X,Y,Z data somewhere out there.
Works good in 2012 by the way all the way out to 8 decimal places.
What is wrong? That macro always stop to this line: Set retval = Part.CreateLine2(Val(Coords(4) * 0.001), Val(Coords(5) * 0.001), Val(Coords(6) * 0.001), Val(Coords(1) * 0.001), Val(Coords(2) * 0.001), Val(Coords(3) * 0.001))
Hi! What am I doing wrong?
I am using SW2021. Always the macro is stopping to that line. In my txt file coordinates are 4 to 7 digits. I also have tried that S1.txt.
Could it be regional settings?