CylinderArtist

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

Bases: compas_rhino.artists._shapeartist.ShapeArtist

Artist for drawing cylinder shapes.

Parameters

shape (compas.geometry.Cylinder) – A COMPAS cylinder.

Notes

See compas_rhino.artists.ShapeArtist for all other parameters.

Examples

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

import compas_rhino
from compas_rhino.artists import CylinderArtist

pcl = Pointcloud.from_bounds(10, 10, 10, 200)
tpl = Cylinder([[[0, 0, 0], [0, 0, 1]], 0.1], 1.0)

compas_rhino.clear_layer("Test::CylinderArtist")

for point in pcl.points[:len(pcl) // 2]:
    cylinder = tpl.transformed(Translation.from_vector(point))
    artist = CylinderArtist(cylinder, color=i_to_rgb(random.random()), layer="Test::CylinderArtist")
    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([u, show_vertices, show_edges, …])

Draw the cylinder associated with the artist.

redraw()

register(item_type, artist_type)