MeshArtist

class compas_ghpython.artists.MeshArtist(mesh)[source]

Bases: compas_ghpython.artists._artist.BaseArtist

A mesh artist defines functionality for visualising COMPAS meshes in GhPython.

Parameters

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

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

  • 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_ghpython.artists import MeshArtist

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

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

Methods

__init__(mesh)

Initialize self.

draw([color])

Draw the mesh as a RhinoMesh.

draw_edges([edges, color])

Draw a selection of edges.

draw_faces([faces, color, join_faces])

Draw a selection of faces.

draw_vertices([vertices, color])

Draw a selection of vertices.