Get surfaces from document

Hello,

which is the best way to obtain, from a c++ plug-in, the meshes representing all the surfaces contained in a document?

Several times I need to do that in my code, but I’m always a little bit confused by the severals way it is possible to represent a surface in Rhino. We have of course meshes, but also breps, and extrusions. Are they all ON_Surfaces?
Did I miss some surface type? Maybe some type of surface groups?

I would like to just write a function that allows to its callers to get all the “surfaces” (as mesh representation), open or not, present into the document.

An example would be very appreciated, but if exists, also a link to a page resuming all the possible Rhino supported surface representation would be of help.

Thank you in advance,
Alberto

Hi @margari,

In Rhino, along with other objects, there are surfaces, polysurfaces, extrusions, and meshes.

  1. A surface is a Brep with a single face. It is represented in the document as a CRhinoBrepObject.

  2. A polysurface is a Brep with more than one face. It is represented in the document as a CRhinoBrepObject.

  3. An extrusion is not a Brep, but it can take on Brep form if/when needed. It is represented in the document as a CRhinoExtrusionObject.

  4. A mesh is represented in the document as a CRhinoMeshObject.

Note, a Brep is made up of one or more ON_Surface-derived objects.

The easiest way to get meshes from objects is to use the RhinoGetRenderMeshes SDK function. Here is an example:

cmdSampleExtractRenderMesh.cpp

– Dale