Open NURBS C# 3DM BRep/Extrusion to Mesh Geometry Conversion Issue

I am trying to convert 3DM BRep and Extrusion geometry data into 3DM Mesh data. I have two 3DM files: one contains a Box extrusion in Rendered mode, called BoxWithRender.3dm, and the other contains the same Box extrusion in Wireframe mode, called BoxWithWireFrame.3dm. I am reading the Box extrusion using the OpenNURBS API and attempting to convert the Box Extrusion object into Mesh geometry data.

When I use the BoxWithRender.3dm file, the Box extrusion geometry is successfully converted to Mesh geometry. However, when I use the BoxWithWireFrame.3dm file, the Box extrusion geometry does not get converted into Mesh geometry.

In summary, the conversion works successfully when the source file is in Rendered mode, but fails when the source file is in Wireframe mode.

I am using below api’s
For Extrusion => Extrusion.GetMesh(MeshType.Any)
For BRepFace => BRepFace.GetMesh(MeshType.Any)

The opennurbs library will not convert an extrusion or brepface to mesh, or create a mesh for you, opennurbs is a file I/O library for the 3dm file format. As you have noticed, when mesh(es) are present in the file, you’ll get them; otherwise you won’t.

Hi @menno Thanks for your response.
But I am able to convert the BRep and Extrusion geometry into Mesh when the file was in Rendered mode!

You are not converting then. Saving in Shaded or Rendered mode makes it so that Rhino saves the mesh along with the object. This is what you get.

To get a mesh you have three options:

  1. create your code so that it runs in Rhino - that way you have access to the meshers
  2. save the file in Rhino with one viewport in Rendered or Shaded mode
  3. write your own mesher for the various geometry types

edit: add in Rhino clarification to point 2.

Could you please share the api to save the Wireframe mode file into Shaded or Rendered mode by using OpenNURBs C#

Note that for my second point this is something you need to do in Rhino. I’ll adapt my reply so that it is clear.

As @menno mentioned the public OpenNURBS SDK does not ship meshers. Are you using the Rhino3dm nuget package to create code that writes and reads 3dm files outside of Rhino?

Yes, I am using Rhino3dm Nuget package to read and write 3dm file!

In that case you will have to either use Rhino to open and resave the file. Or you have to bring your own mesher. The Rhino3dm package does not provide you with one.

Ok @nathanletwory, Thanks!