5 Replies Latest reply on Dec 19, 2013 1:36 PM by Alex Reds

# Macro to have evenly distributed points on a curve

Hi guys, I need your help. I have to create a macro that divide a curve (line, arch, spline, etc...) in a number of points decided by me. Do you know how can i write the function that divide my curve (for example a line) in several (for example 50) points equally spaced?Are there any macros or functions already written?

Thanks a lot

• ###### Re: Macro to have evenly distributed points on a curve

No one is able to help me?Anything??

• ###### Re: Macro to have evenly distributed points on a curve

Turn on your points. (View, Points)

Draw line then use (insert, reference geometry, point. Last selection on the bottom left is "along curve distance" there is a drop down that shows evenly distribute with input for the number of points. hope this helps. I think this works on a spline or circle. I did not check cause I am leaving for the day. Tom

• ###### Re: Macro to have evenly distributed points on a curve

Hi Tom, thanks for the answer. I know that SolidWorks is able to add points along a curve without using a macro, but I need to do that into a macro.

I need to write a macro that create something like this:

Can you help me?

• ###### Re: Macro to have evenly distributed points on a curve

You must measure the curve length to find the required distance between each point.

Then you must guess the position of the first point (probably using the U parameter).

Measure the length of the trimmed curve to find out if your guess is too far along the curve or not far enough.

And then move the point a little either way. Repeat until the point is within your required tolerance.

• ###### Re: Macro to have evenly distributed points on a curve

May you help me posting a piece of code so I can learn how to begin this macro?I am beginner of programming and I really need help.

Thanks