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