Dear Community experts,
I am trying to create a spline by using a set of points from a text input file (tab delimited). I am using VBA. The file has X, Y and Z co ordinates. I read the file and then copy those values to a variant array.To do this, I convert the strings to values in between. Then I use this variant array to create a spline using regular spline creating code. I don't know why it does not create the spline. Program works in excel but not in solidworks. Experts please help. Files attached.
Regards,
Muthukrishnan
SolidworksApi macros
Your ReDim pts(i) As Double obliterates the entire array.
You need to use ReDim Preserve pts(i) As Double
Same for ReDim Preserve pts1(j - 1) As Double
and
ReDim Preserve crisps(j - 1) As String (akthough I think this line is unnecessary)
Attached is my code. By the way, I think there are possibly too many points (6000) in your text file to create a spline through. You might like to do 100 points at a time.
Hi Simon,
I tried 'preserve' in the command even before posting this query. But the code seems to run indefinitely, which baffles me. With limited number of points(say 100), the smoothness of the curve created is very similar to the conventional curve created through a file input method.
Many thanks for the reply.
You definitely need the Preserve statements.
I suggest doing 100 points at a time and so creating 60 separate SketchSplines