LabelsConduit

class compas_rhino.conduits.LabelsConduit(*args: Any, **kwargs: Any)[source]

Bases: compas_rhino.conduits.base.BaseConduit

A Rhino display conduit for labels.

Parameters
  • labels (list of 2-tuple) – A list of label tuples. Each tuple contains a position and text for the label.

  • color (list of 2-tuple, optional) – The colors of the labels. Each color is a tuple with a background color and a text color. Default is ((0, 0, 0), (255, 255, 255)) for all labels.

Attributes
  • color (list of RGB colors) – A color specification per label.

  • labels (list) – A list of label tuples. Each tuple contains a position and text for the label.

Examples

from random import randint
from compas_rhino.conduits import LabelsConduit

labels = [([1.0 * randint(0, 100), 1.0 * randint(0, 100), 0.0], str(i)) for i in range(100)]

conduit = LabelsConduit(labels)

with conduit.enabled():
    for i in range(100):
        conduit.labels = [([1.0 * randint(0, 100), 1.0 * randint(0, 100), 0.0], str(i)) for i in range(100)]
        conduit.redraw(pause=0.1)

Methods

CalculateBoundingBox(e)

DrawForeground(e)

disable()

Disable the conduit.

enable()

Enable the conduit.

enabled()

redraw([k, pause])

Redraw the conduit.