treble_tsdk.geometry.model_layers

Layer and surface geometry queries built on a MeshCollection.

Functions

build_layers(mc)

Build the layer/surface geometry views of a MeshCollection.

Classes

ModelLayer

A model layer with its surfaces and aggregate geometry properties.

ModelSurface

A single surface (Rhino object) of a model layer.

class treble_tsdk.geometry.model_layers.ModelLayer

A model layer with its surfaces and aggregate geometry properties.

__init__(geometry: _TriangleGeometry, cell_indices: numpy.ndarray, name: str, surfaces: list[ModelSurface])
point_on(u: float, v: float) → Point3d

Point in the surface plane, parametrized by u/v in [0, 1] over the bounding rectangle of the surface projected onto its in-plane axes.

The point lies in the surface plane and may fall outside non-rectangular shapes.

The returned point is rounded to 3 decimals (as are the other returned values: coordinates and area to 3 decimals, normals to 6).

Parameters:
  • u (float) – Horizontal coordinate in [0, 1].

  • v (float) – Vertical coordinate in [0, 1].

Raises:

ValueError – If the surface is not planar, its vertices do not lie in a single plane, or u/v are outside [0, 1].

property area: float

One-sided geometric area in m².

property bounding_box: BoundingBox
property centroid: Point3d
property normal: Vector3d | None

Unit normal for planar regions, None for closed or non-planar regions.

class treble_tsdk.geometry.model_layers.ModelSurface

A single surface (Rhino object) of a model layer.

__init__(geometry: _TriangleGeometry, cell_indices: numpy.ndarray, object_id: str | None, layer_name: str)
point_on(u: float, v: float) → Point3d

Point in the surface plane, parametrized by u/v in [0, 1] over the bounding rectangle of the surface projected onto its in-plane axes.

The point lies in the surface plane and may fall outside non-rectangular shapes.

The returned point is rounded to 3 decimals (as are the other returned values: coordinates and area to 3 decimals, normals to 6).

Parameters:
  • u (float) – Horizontal coordinate in [0, 1].

  • v (float) – Vertical coordinate in [0, 1].

Raises:

ValueError – If the surface is not planar, its vertices do not lie in a single plane, or u/v are outside [0, 1].

property area: float

One-sided geometric area in m².

property bounding_box: BoundingBox
property centroid: Point3d
property normal: Vector3d | None

Unit normal for planar regions, None for closed or non-planar regions.

treble_tsdk.geometry.model_layers.build_layers(mc: MeshCollection) → dict[str, ModelLayer]

Build the layer/surface geometry views of a MeshCollection.

Keys are the layer names ("/"-separated); only layers that have cells are included. Surfaces within each layer are sorted by ascending object_index (Rhino object order).