SphereArtist

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

Bases: compas_rhino.artists._shapeartist.ShapeArtist

Artist for drawing sphere shapes.

Parameters

shape (compas.geometry.Sphere) – A COMPAS sphere.

Notes

See compas_rhino.artists.ShapeArtist for all other parameters.

Examples

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

import compas_rhino
from compas_rhino.artists import SphereArtist

pcl = Pointcloud.from_bounds(10, 10, 10, 100)
tpl = Sphere([0, 0, 0], 0.15)

compas_rhino.clear_layer("Test::SphereArtist")

for point in pcl.points:
    sphere = tpl.transformed(Translation.from_vector(point))
    artist = SphereArtist(sphere, color=i_to_rgb(random.random()), layer="Test::SphereArtist")
    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, v, show_vertices, show_edges, …])

Draw the sphere associated with the artist.

redraw()

register(item_type, artist_type)