RhinoCommon access to Smooth Command?

Hi All,

I need to run smooth command on a mesh programatically and Id prefer not to run it from script (messy).

i have searched but cannot find it in the Rhinocommon docs? If its not available what would the equivalent process be in Rhinocommon?

thank you.

Also where is this?

http://developer.rhino3d.com/wip/api/RhinoCommonWin/html/M_Rhino_Geometry_Mesh_WithEdgeSoftening.htm

I cant seem to call it either?

@ChristopherBotha, you might write your own smoothing algorithm. Just get the vertex neighbours of every mesh vertex (v) and then move v to to the average position of all its neighbours.

Here is some info about it: Laplacian smoothing - Wikipedia

You may also control if a vertex v is on an open border (a naked vertex) using

Rhino.Geometry.Mesh.GetNakedEdgePointStatus

and exclude it from averaging if you want the mesh borders of open meshes unchanged…

Rhino WIP

c.

Thanks, been looking at that as last resort, but as it already exists in rhino id prefer not reinventing the wheel :wink:

That is the WIP documentation. If you are looking for v5 scripting you check http://developer.rhino3d.com/api/RhinoCommonWin/html/T_Rhino_Geometry_Mesh.htm

It looks like WithEdgeSoftening is a new thing.

Hi Chris,

In the Rhino WIP C++ SDK, the RhinoSmoothMesh function provides the functionality of the Smooth command. As this is not exposed in RhinoCommon yet, I’ve added a YouTrack item to do so.

https://mcneel.myjetbrains.com/youtrack/issue/RH-38462

– Dale

3 Likes

Sweet, thank you. Im stuck at about this far.

because im an ornery kind of guy i dug around and found the laplacian routines written for unity. Most of the commands are easy to port over (Vector3D to vector3d etc) and I had to write my own mathf.approximate for determining neighbour epsilon equality, Where i am stuck now the function is expecting the vertex list in vector3d not point3d.

The unity dll does this automatically in format vector3D[] vectors = mesh.vector3d().

I can extract from rhino mesh.vertex a point3d and point3f list but no vector3d list.

I cant seem to extract an edge list to vectors either?

may be simpler to convert the routine to do the math on point3ds… but im lazy…

Hi Chris,

I don’t know the Unity mesh format or why it wants vectors - sorry.

– Dale

Hi Dale.

Self resolved. EBKAC. The routine wants vertices and edges. I reread it.

Its not Unity as Unity also has no smoothing algorithms its written in C# to augment.

Near finished porting it over the Mathf function is tricky to get right as my mesh softens sometimes and other times it crashes out. The approximate function in mathf uses some fuzzy logic to determine neighbours because my self intersecting meshes crash out.

The softening also results in a slight downscale on each iteration which I’m trying to factor…

Purely a “for fun” project to keep my teeth sharp.

RH-38462 is fixed in the latest WIP

1 Like