Retrieve coordinates equidistant points spline Solidworks

Hello

 

I created a 3D part containing a spline. For the purposes of machining, I would have to retrieve the 2D coordinates of points placed coincident on this spline at an equal distance (interpolation). And you can imagine how laborious it is to place these dots by hand with a gap of 0.1mm and then to record their coordinates...

So I look for another solution but two small problems arise for me: 1_placer the points, and then 2_récupérer their contact details.

I was able to find first of all on the net a macro allowing to retrieve the coordinates of sketch points (and not reference points, be careful). So I tried a lot of ways to place points at the same distance on this spline:

- using a linear repeat, but it doesn't work for a curve

- with "Tool>Sketch Tool>Segment", but that doesn't work for a spline either

- with a linear repetition of a vertical line and creating their intersection with the spline to create a sketch point. But these intersection points have to be created one by one, so manually, which wastes just as much time

-using the "Reference Geometry>Points>Distance along the curve" function to create points that I then converted to a sketch entity.

 

So my final solution is to go for a macro to do this. I then found another one that was quite effective. To use it, you have to draw the spline in a sketch, then place a reference point on it (but not coinciding with the starting point, too bad). You then have to save the part under a name and then select this point and launch the macro. The macro therefore creates a text file with the coordinates of this reference point, moving it a certain increment (stepSize) a certain number of times (nPoints).

So it's almost perfect.

But I'd like to replace the nPoints with a variable so that the "for" loop stops at the last point. That is to say that I retrieve the coordinates of all the points of the curve, with an increment of 0.1mm, until the end of it, but without going any further, and without stopping before the end. Ideally, the initial point and the end point would be the initial and final points of my spline (which is not even possible for the initial point at the moment because if we create a reference point on the initial point of the spline, the macro does not return the right values). So it would have to calculate itself (in relation to the size of the selected spline for example), and I wouldn't have to play with the number of points.

Could someone help me? Knowing that this can certainly be useful to others since Solidworks does not seem to do it automatically and does not allow you to directly retrieve the spline equation.

 

Thank you in advance!

 

Sbier

 


coordonnees_points_spline.swp

Hello

Is it possible to have the macro in a text file?

1 Like

Yes, of course!  :)


coordonnees_spline_solidworks.txt
1 Like

Watch this video

https://www.youtube.com/watch?v=1tyXfCxaf8U

There is also this tutorial but it does the opposite ;-)

http://www.lynkoa.com/tutos/3d/video-tutorial-creating-curves-importing-point-data-text-file-solidworks

See also this communication thread

http://www.lynkoa.com/forum/solidworks/comment-exporter-coordonnees-points-partir-solidworks

@+

 macro to retrieve the coordinates of splines in X Y Z for excel or text file

https://grabcad.com/questions/how-to-export-solidworks-spline-points-to-a-txt-file

Thank you so much gt22!

 

Unfortunately I have already seen and rewatched these videos, which did not help me since the macro I attached to my message is more efficient for what I want. It would just have to be able to stop placing the point as soon as we get to the end of the spline.

1 Like

And this last point you can't ignore?

The list of points -1

In fact, in this macro I can only say for example: I want to make 600 stitches in 0.1mm increments.

 

But I wouldn't like to have to give the number of points. I would like the number of stitches to be calculated according to the length of the spline. To have a just exact number of coordinate points to characterize my spline. I don't know if I was clearer...

I'm not a macro pro, but it should be possible to measure the length "l" of the spline and therefore deduce "n" (n=l/0.1)

1 Like

That's exactly what I'd like to try to do! :)

 

All you have to do is find the control to get the length of the spline and it should be playing!