LinesConduit

class compas_rhino.conduits.LinesConduit(*args, **kwargs)[source]

Bases: BaseConduit

A Rhino display conduit for lines.

Parameters
  • lines (list[[point, point] | Line]) – A list of start-end point pairs that define the lines.

  • thickness (list[int], optional) – The thickness of the individual lines. Default is LinesConduit.default_thickness for all lines.

  • color (list[tuple[int, int, int]], optional) – The colors of the faces. Default is LinesConduit.default_color for all lines.

Attributes
  • color (list[System.Drawing.Color]) – A color per line.

  • thickness (list[float]) – A thickness per line.

Class Attributes
  • default_thickness (float) – The default thickness is 1.0.

  • default_color (System.Drawing.Color) – the default color is FromArgb(255, 255, 255).

Examples

from random import randint

points = [(1.0 * randint(0, 30), 1.0 * randint(0, 30), 0.0) for _ in range(100)]
lines  = [(points[i], points[i + 1]) for i in range(99)]
conduit = LinesConduit(lines)

with conduit.enabled():
    for i in range(100):
        points = [(1.0 * randint(0, 30), 1.0 * randint(0, 30), 0.0) for _ in range(100)]
        conduit.lines = [(points[i], points[i + 1]) for i in range(99)]
        conduit.redraw(pause=0.1)

Methods

DrawForeground

Draw the lines.

Inherited Methods

CalculateBoundingBox

Calculate the model extents that should be included in the visualization.

disable

Disable the conduit.

enable

Enable the conduit.

enabled

Create a context for the conduit with automatic enabling and disabling.

redraw

Redraw the conduit.