PolygonArtist

class compas_rhino.artists.PolygonArtist(primitive, color=None, layer=None)[source]

Bases: compas_rhino.artists._primitiveartist.PrimitiveArtist

Artist for drawing polygons.

Parameters

primitive (compas.geometry.Polygon) – A COMPAS polygon.

Notes

See compas_rhino.artists.PrimitiveArtist for all other parameters.

Examples

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

import compas_rhino
from compas_rhino.artists import PolygonArtist

pcl = Pointcloud.from_bounds(10, 10, 10, 100)
tpl = Polygon.from_sides_and_radius_xy(7, 0.8)

compas_rhino.clear_layer("Test::PolygonArtist")

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

Methods

__init__(primitive[, color, layer])

Initialize self.

build(item, **kwargs)

Build an artist corresponding to the item type.

clear()

clear_layer()

Clear the layer containing the artist.

draw([show_points, show_edges, show_face])

Draw the polygon.

redraw()

register(item_type, artist_type)