示例#1
0
def volmesh_draw_faces(volmesh,
                       keys=None,
                       color=None,
                       layer=None,
                       clear_layer=False,
                       redraw=True):
    """Draw the faces of a volmesh.

    Parameters
    ----------
    volmesh : compas.datastructures.VolMesh
        A volmesh object.
    keys : list (None)
        A list of edge keys identifying which faces to draw.
        Default is to draw all faces.
    color : str, tuple, dict (None)
        The color specififcation for the faces.
        Colors should be specified in the form of a string (hex colors) or as a tuple of RGB components.
        To apply the same color to all faces, provide a single color specification.
        Individual colors can be assigned using a dictionary of key-color pairs.
        Missing keys will be assigned the default vertex color (``self.defaults['vertex.color']``).
        Default is use the color of the parent layer.
    layer : str (None)
        The layer in which the faces are drawn.
        Default is to draw in the current layer.
    clear_layer : bool (False)
        Clear the drawing layer.
    redraw : bool (True)
        Redraw the view after adding the faces.

    Examples
    --------
    >>> volmesh_draw_faces(volmesh)
    >>> volmesh_draw_faces(volmesh, keys=volmesh.faces_on_boundary())
    >>> volmesh_draw_faces(volmesh, color='#00ff00')
    >>> color = {key: (('#ff0000') if volmesh.vertex_is_on_boundary(key) else ('#00ff00')) for key in volmesh.faces()}
    >>> volmesh_draw_faces(volmesh, color=color)

    See Also
    --------
    * compas_rhino.VolMeshArtist

    """
    artist = VolMeshArtist(volmesh)
    artist.layer = layer
    if clear_layer:
        artist.clear_layer()
    artist.clear_faces()
    artist.draw_faces(color=color)
    if redraw:
        artist.redraw()
示例#2
0
 def clear_faces(self, **kwattr):
     artist = VolMeshArtist(self)
     artist.clear_faces(**kwattr)