LabelsConduit
- class compas_rhino.conduits.LabelsConduit(*args, **kwargs)[source]
Bases:
BaseConduit
A Rhino display conduit for labels.
- Parameters
labels (list[tuple[[float, float, float] |
Point
, str]]) – A list of label tuples. Each tuple contains a position and text for the label.color (list[tuple[tuple[int, int, int], tuple[int, int, int]]], optional) – The colors of the labels. Each color is a tuple with a background color and a text color. The default background color is
LabelsConduit.default_color
, and the default text color isLabelsConduit.default_textcolor
.
- Attributes
color (list[tuple[System.Drawing.Color, System.Drawing.Color]]) – A color specification per label.
labels (list[tuple[[float, float, float] |
Point
, str]]) – A list of label tuples. Each tuple contains a position and text for the label.
- Class Attributes
default_color (System.Drawing.Color) – The default background color is
FromArgb(0, 0, 0)
.default_textcolor (System.Drawing.Color) – The default text color is
FromArgb(255, 255, 255)
.
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
Draw the labels as text dots.
Inherited Methods
Calculate the model extents that should be included in the visualization.
Disable the conduit.
Enable the conduit.
Create a context for the conduit with automatic enabling and disabling.
Redraw the conduit.