Iteratively Smooth Curve

Hi,

I am trying to iteratively smooth a curve (basically I am trying to do what the Smooth command in Rhino does but in Grasshopper) but it doesn’t appear to be working. Can someone give me some tips for making this work, for Python in Grasshopper, like it does when you run the Smooth command on a curve in Rhino?

smooth crv test.gh (7.7 KB)

image

Thanks
Devin

does anyone know how to do this?

In python you can run this command in a for loop.
Number of smooth steps are “for” iterations.

Yes. I know. I have done that in the Python script attached. Here is the code. Is this what you mean?

import rhinoscriptsyntax as rs
import Rhino as r

output = []


for i in curves:
    temp = []
    for j in range(steps):
        if j == 0:
            temp.append(i.Smooth(smfactor, True, True, True, False, r.Geometry.SmoothingCoordinateSystem.World, smplane))
        else:
            nextup = temp[j-1]
            nextup.Smooth(smfactor, True, True, True, False, r.Geometry.SmoothingCoordinateSystem.World, smplane)
            temp.append(nextup)
        if j == steps-1:
            output.append(temp[-1])
    


a = output

Did you duplicate the curve and reassign after smooth?
After each iteration you need to update previously smoothed curve.

In C# works file, should be python too, unless I am missing your point.

Ah, I see. Thanks