Mesh.Smooth help with specified vertices

Hi, I am trying to smooth a set of defined vertices of a mesh, but it seems Mesh.Smooth doesn’t support a list of vertices, or I am doing something wrong:

def RhinoSmooth(mesh,grips):
    from System import Array
    IEnumerateGrips = Array[int](grips)
    tol = float(1)
    for i in range(500):
        mesh.Smooth (IEnumerateGrips, tol, True, True, True, True, 0)
    return mesh

I get this error:
Message: expected float, got Array[int]

But if I remove the option IEnumerateGrips from mesh.Smooth (IEnumerateGrips, tol, True, True, True, True, 0) then it works on the entire mesh just fine.

Any help would be great!

I see that IF I make the mesh as a document object and manually select the vertices the Rhino command -Smooth with 500 steps is faster than running mesh.Smooth 500 times.

BUT using

for grip in grips:

Takes a very long time (up to 60 seconds) on a 6000 poly mesh, so is there a fast Rhino Common way to select the grips I know I want?

Wish: rs.SelectObjectGrips(mesh_id,grips) would be a nice command.

Looks like you’re missing the plane input parameter at the very end. The way you’re using it in your post is like the first overload of the method. Pass the function also a Rhino.Geometry.Plane.WorldXY.

1 Like

Thank you SO much Nathan!
I thought the plane was optional… and would probably have pounded my head against that wall for quite some time!


1 Like