MeshArtist

class compas_rhino.artists.MeshArtist(mesh, layer=None)[source]

Bases: compas_rhino.artists._artist.BaseArtist

Artists for drawing mesh data structures.

Parameters
  • mesh (compas.datastructures.Mesh) – A COMPAS mesh.

  • layer (str, optional) – The name of the layer that will contain the mesh.

Attributes
  • mesh (compas.datastructures.Mesh) – The COMPAS mesh associated with the artist.

  • layer (str) – The layer in which the mesh should be contained.

  • color_vertices (3-tuple) – Default color of the vertices.

  • color_edges (3-tuple) – Default color of the edges.

  • color_faces (3-tuple) – Default color of the faces.

Examples

import compas
from compas.datastructures import Mesh
from compas_rhino.artists import MeshArtist

mesh = Mesh.from_obj(compas.get('faces.obj'))

artist = MeshArtist(mesh, layer='COMPAS::MeshArtist')
artist.clear_layer()
artist.draw_faces(join_faces=True)
artist.draw_vertices(color={key: '#ff0000' for key in mesh.vertices_on_boundary()})
artist.draw_edges()
artist.redraw()

Methods

build(item, **kwargs)

Build an artist corresponding to the item type.

clear()

clear_by_name()

Clear all objects in the “namespace” of the associated mesh.

clear_layer()

Clear the main layer of the artist.

draw()

Draw the mesh using the chosen visualisation settings.

draw_edgelabels([text, color])

Draw labels for a selection of edges.

draw_edges([edges, color])

Draw a selection of edges.

draw_facelabels([text, color])

Draw labels for a selection of faces.

draw_facenormals([faces, color, scale])

Draw the normals of the faces.

draw_faces([faces, color, join_faces])

Draw a selection of faces.

draw_mesh([color, disjoint])

Draw the mesh as a consolidated RhinoMesh.

draw_vertexlabels([text, color])

Draw labels for a selection vertices.

draw_vertexnormals([vertices, color, scale])

Draw the normals at the vertices of the mesh.

draw_vertices([vertices, color])

Draw a selection of vertices.

redraw()

register(item_type, artist_type)