Rebuild curve non-uniform...batch?

I have a BUNCH of closed curves, each with a BUNCH of points. I need to rebuild each one to have fewer points.

Rebuild curve non-uniform works perfectly, but only if I do each curve one at a time, since some curves are much bigger than others.

Can someone suggest the best way to select all of my thousands of curves, and have the Rebuild Curve Non-Uniform command run on each one, rather than on all of them at once?

Thank you,


FitCrv is an alternative to RebuildCrvNonUniform. With FitCrv you specify a tolerance and FitCrv rebuilds the curve within the specified tolerance while reducing the number of control points if possible. FitCrv however does no provide for specifying the maximum number of points. I’ve used FitCrv successfully on sets of curves as well as individual curves. My experience is FitCrv frequently does a better job of preserving the curve shape than RebuildCrvNonUniform with the same tolerance setting.

Not too hard with a script - basically collect all your curves, then loop through them one by one, calling RebuildCrvNonUniform on each one. The thing is you would need to develop some differentiated parameters for each curve and feed them to the command string on each loop, depending on what you want the outcome to be - otherwise the result will not be any different then just selecting all the curves and running the command once.

Below is a script from my library that does this based on curve length - you choose an approximate point spacing along the curve and it figures out the rest. These days, I do most of this stuff in Grasshopper, as it allows for a live preview.

HTH, --Mitch (2.0 KB)

Thanks for the answers!

@davidcockey FitCrv doesn’t seem to be producing as desirable results for me as RebuildCurveNonUniform, but I’m still playing with it…

@Helvetosaur I think that a script without any differentiated parameters per curve would be perfect, because:

When I run RebuildCurveNonUniform on one curve it looks good:

Then running it again with the exact same settings on another curve looks good:

BUT, selecting both and running the command gives the smaller curve way too many points:

I know how to setup a looping function in grasshopper using Anemone, but don’t think RebuildCurveNonUniform is available in GH, and still not sure where to start with scripting this.