RhinoSurface.to_compas_mesh

RhinoSurface.to_compas_mesh(cls=None, facefilter=None, cleanup=False)[source]

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

Parameters
  • cls (Mesh, optional) – The type of COMPAS mesh.

  • facefilter (callable, 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.

  • cleanup (bool, optional) – Flag indicating to clean up the result. Cleaning up means to remove isolated faces and unused vertices. Default is False.

Returns

Mesh – The resulting mesh.

Examples

>>> import compas_rhino
>>> from compas_rhino.geometry import RhinoSurface
>>> from compas_rhino.artists import MeshArtist
>>> 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 = RhinoSurface.from_guid(guid)
>>> mesh = surf.to_compas(facefilter=facefilter)
>>> artist = MeshArtist(mesh, layer="Blocks")
>>> artist.clear_layer()
>>> artist.draw()