# Brep from Mesh in c++

**URL:** <https://discourse.mcneel.com/t/brep-from-mesh-in-c/134571>\
**Category:** Rhino Developer\
**Tags:** windows\
**Created:** [December 6, 2021, 8:11pm UTC](https://discourse.mcneel.com/t/brep-from-mesh-in-c/134571 "2021-12-06T20:11:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgraham](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mgraham/32/189551_2.png) [@mgraham](https://discourse.mcneel.com/u/mgraham)\
**Post date:** [December 6, 2021, 8:11pm UTC](https://discourse.mcneel.com/t/brep-from-mesh-in-c/134571/1 "2021-12-06T20:11:56Z")

</div>

I am writing an importer using c++. I am successfully creating meshes from vertexes and face indexes, but I would like improve/smooth the completed meshes.

Is there something in the c++ for CRhinoMeshObject that does something like:  
[https://developer.rhino3d.com/api/RhinoCommon/html/M\_Rhino\_Geometry\_Brep\_CreateFromMesh.htm](https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Brep_CreateFromMesh.htm)

I am also open to other suggestions on how do this

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/685184_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [December 6, 2021, 8:21pm UTC](https://discourse.mcneel.com/t/brep-from-mesh-in-c/134571/2 "2021-12-06T20:21:42Z")

</div>

Hi @mgraham,

The underlying SDK function, to the RhinoCommon function you reference, is `ON_BrepFromMesh`. See opennurbs\_brep.h for details.

That said, this isn’t a very useful function, in most cases, as it creates a faceted polysurface with a degree-1 NURBS surface for each mesh polygon/face which really isn’t anymore useful than a mesh. You might have more “smoothing” success converting the Mesh to SubD.

More on Mesh to NURBS:

[https://wiki.mcneel.com/rhino/meshtonurb](https://wiki.mcneel.com/rhino/meshtonurb)

– Dale
