MeshArtist

class compas.artists.MeshArtist(item, **kwargs)[source]

Bases: Artist

Base class for all mesh artists.

Parameters
  • mesh (Mesh) – A COMPAS mesh.

  • vertices (list[int], optional) – Selection of vertices to draw.

  • edges (list[tuple[int, int]], optional) – Selection of edges to draw.

  • faces (list[int], optional) – Selection of faces to draw.

  • vertexcolor (tuple[float, float, float] | dict[int, tuple[float, float, float]], optional) – Color of the vertices. Default color is MeshArtists.default_vertexcolor.

  • edgecolor (tuple[float, float, float] | dict[tuple[int, int], tuple[float, float, float]], optional) – Color of the edges. Default color is MeshArtists.default_edgecolor.

  • facecolor (tuple[float, float, float] | dict[int, tuple[float, float, float]], optional) – Color of the faces. Default color is MeshArtists.default_facecolor.

Attributes
  • mesh (Mesh) – The mesh data structure.

  • vertices (list[int]) – The selection of vertices that should be included in the drawing. Defaults to all vertices.

  • edges (list[tuple[int, int]]) – The selection of edges that should be included in the drawing. Defaults to all edges.

  • faces (list[int]) – The selection of faces that should be included in the drawing. Defaults to all faces.

  • color (Color) – The base RGB color of the mesh.

  • vertex_xyz (dict[int, list[float]]) – View coordinates of the vertices. Defaults to the real coordinates.

  • vertex_color (dict[int, Color]) – Vertex colors. Missing vertices get the default vertex color default_vertexcolor.

  • edge_color (dict[tuple[int, int], Color]) – Edge colors. Missing edges get the default edge color default_edgecolor.

  • face_color (dict[int, Color]) – Face colors. Missing faces get the default face color default_facecolor.

  • vertex_text (dict[int, str]) – Vertex labels. Defaults to the vertex identifiers.

  • edge_text (dict[tuple[int, int], str]) – Edge labels. Defaults to the edge identifiers.

  • face_text (dict[int, str]) – Face labels. Defaults to the face identifiers.

  • vertex_size (dict[int, float]) – Vertex sizes. Defaults to 1. Visualization of vertices with variable size is not available for all visualization contexts.

  • edge_width (dict[tuple[int, int], float]) – Edge widths. Defaults to 1. Visualization of edges with variable width is not available for all visualization contexts.

Class Attributes
  • default_vertexcolor (Color) – The default color of the vertices of the mesh.

  • default_edgecolor (Color) – The default color of the edges of the mesh.

  • default_facecolor (Color) – The default color of the faces of the mesh.

  • default_vertexsize (float) – The default size of the vertices of the mesh.

  • default_edgewidth (float) – The default width of the edges of the mesh.

Methods

clear

Clear all components of the mesh.

clear_edges

Clear the edges of the mesh.

clear_faces

Clear the faces of the mesh.

clear_vertices

Clear the vertices of the mesh.

draw_edges

Draw the edges of the mesh.

draw_faces

Draw the faces of the mesh.

draw_mesh

Draw the mesh of the mesh.

draw_vertices

Draw the vertices of the mesh.

Inherited Methods

build

Build an artist corresponding to the item type.

build_as

Build an artist with the given type.

draw

The main drawing method.

draw_collection

Drawing method for drawing an entire collection of objects.

redraw

Redraw the view.

register

Register an artist type to a data type.