Surface types in RhinoCommon

Hi,

I took some type on the RhinoCommon documentation and I found so many surface classes (not Mesh) and not sure what is the difference.

What is the difference?

In Rhino.DocObject:
BrepObject Class, RhinoObject and SurfaceObject as well as

In Rhino.DocObject Custom:
CustomBrep Object

in Rhino.Geometry:
Brep Class, Surface Class, NurbsSurface Class.

They are all different but in the Object Type Enumeration we have only two type of surfaces; Brep and Surface. I am still not sure what the difference is between them.

In Python https://github.com/mcneel/rhinoscriptsyntax/blob/rhino-6.x/Scripts/rhinoscript/selection.py
we also differs surface, polysurface and no brep.

There are two things going on here:

  1. The distinction between “geometry” and “rhino object”. A Rhino object lives in the Rhino document, and is basically a piece of geometry, and some associated information about its place in the document (layer index, display information, etc. etc.). So, there are SurfaceObject, BrepObject and CustomBrepObject (which all inherit from the base class RhinoObject).

  2. The distinction between a surface and a polysurface. Polysurfaces (including possible trimming information) are called BRep (which stands for Boundary Representation). Both inherit from GeometryBase, like all other types of geometry (Mesh, Curve, etc.)

I hope it is clear?

It is clear, thanks.

So when I want to coerce an object in Python to RhinoCommon; I need to use rs.coercerhinoobject().

But when do I need to use coercesurface, coercegeometry and coercebrep?

Use as “high up” in the inheritance chain as possible (possible = the methods and properties you need being present at that class level).

Part of lass hierarchy (see bottom of image for Brep and Surface):

// Rolf

1 Like

Thanks! It takes time to study. This is what I want to do - a little chartflow. Can I download this document from the internet or is it internal?

Hm, extrusion is an other type of surface.

This is interesting, Sphere is a surface, cube is an extrusion, cone is a polysurface. I am getting there to understand.

The UML class model is what I’m drawing myself as I’m studying parts of the documentation. This was just a screenshot I posted as an image.

// Rolf