PolyhedronArtist

class compas_rhino.artists.PolyhedronArtist(shape, color=None, layer=None)[source]

Bases: compas_rhino.artists._shapeartist.ShapeArtist

Artist for drawing polyhedron shapes.

Parameters

shape (compas.geometry.Polyhedron) – A COMPAS polyhedron.

Notes

See compas_rhino.artists.ShapeArtist for all other parameters.

Examples

import random
from compas.geometry import Pointcloud
from compas.geometry import Polyhedron
from compas.geometry import Translation
from compas.utilities import i_to_rgb

import compas_rhino
from compas_rhino.artists import PolyhedronArtist

pcl = Pointcloud.from_bounds(10, 10, 10, 100)
tpl = Polyhedron.from_platonicsolid(12)

compas_rhino.clear_layer("Test::PolyhedronArtist")

for point in pcl.points:
    polyhedron = tpl.transformed(Translation.from_vector(point))
    artist = PolyhedronArtist(polyhedron, color=i_to_rgb(random.random()), layer="Test::PolyhedronArtist")
    artist.draw()

Methods

__init__(shape[, color, layer])

Initialize self.

build(item, **kwargs)

Build an artist corresponding to the item type.

clear()

clear_layer()

Clear the main layer of the artist.

draw([show_vertices, show_edges, …])

Draw the polyhedron associated with the artist.

redraw()

register(item_type, artist_type)