surface_to_compas_mesh

compas_rhino.conversions.surface_to_compas_mesh(surface, facefilter=None, cleanup=False, cls=None)[source]

Convert the surface b-rep loops to a COMPAS mesh.

Parameters:
surfaceRhino.Geometry.Surface

A Rhino surface.

facefiltercallable, optional

A filter for selection which Brep faces to include. If provided, the filter should return True or False per face. A very simple filter that includes all faces is def facefilter(face): return True. Default parameter value is None in which case all faces are included.

cleanupbool, optional

Flag indicating to clean up the result. Cleaning up means to remove isolated faces and unused vertices. Default is False.

clscompas.datastructures.Mesh, optional

The type of COMPAS mesh.

Returns:
compas.datastructures.Mesh

The resulting mesh.

Examples

>>> import compas_rhino
>>> from compas_rhino8.geometry import RhinoSurface
>>> from compas.scene import Scene
>>> def facefilter(face):
...     success, w, h = face.GetSurfaceSize()
...     if success:
...         if w > 10 and h > 10:
...             return True
...     return False
>>> guid = compas_rhino.select_surface()
>>> surf = Rhino.Geometry.Surface.from_guid(guid)
>>> mesh = surf.to_compas(facefilter=facefilter)
>>> scene = Scene()
>>> scene.add(mesh, layer="Blocks")
>>> scene.draw()