Skip to content

compas_wood.model ¤

In-memory plate topology: the compas replacement for the Rhino-only wood_nano PlateTopology.

Plates, per-plate joinery metadata (joint_types, insertion_vectors) and global chevron joinery data (three_valence, adjacency) live on plain compas Data objects instead of Rhino UserStrings / document strings, so the whole model json round-trips.

Classes¤

Plate ¤

Plate(plate_id: int, bottom: Polyline, top: Polyline, mesh: Mesh | None = None, holes_bottom: list[Polyline] | None = None, holes_top: list[Polyline] | None = None, joint_types: list[int] | None = None, insertion_vectors: list[float] | None = None, plate_type: str = 'plate', name: str | None = None)

One plate element: bottom/top outlines, optional loft mesh, holes, and joinery metadata.

Parameters:

Name Type Description Default
plate_id int
required
bottom Polyline
required
top Polyline
required
mesh Mesh
None
holes_bottom list[Polyline]

Parallel per-hole outlines; lengths must match.

None
holes_top list[Polyline]

Parallel per-hole outlines; lengths must match.

None
joint_types list[int]

Joint-type code per face slot (n_faces entries; slots 0/1 = bottom/top faces).

None
insertion_vectors list[float]

18 floats = 6 Vec3 insertion directions.

None
plate_type str

Logical tag, e.g. "plate" / "face" / "edge".

'plate'

PlateModel ¤

PlateModel(name: str | None = None)

Plate collection plus joinery metadata; feeds :func:joinery_solver_elements via solver_kwargs.

Methods:¤

contacts_by_source ¤
contacts_by_source(joints) -> dict

Deduplicate JointResults per source-solid pair.

Multi-pair / dual-orientation representations report the same physical contact several times and can report self-contacts between two representations of one solid; this groups joints by sorted source pair, drops self-pairs, and keeps the largest-area joint per pair.

from_breps classmethod ¤
from_breps(breps, tol: float = 1e-06, skip_invalid: bool = False, angle_tol_deg: float = 0.5, area_ratio: float = 0.99, min_pair_fraction: float = 0.0, pairs: str = 'best', orientations: str = 'single', max_pairs: int = 3, min_face_area: float = 0.0, slab_faces_min_area: float | None = None, slab_offset: float = 2.0) -> PlateModel

One search plate per solid (pairs="best"), or one per opposing face pair (pairs="all", up to 3 - box columns get all sides searched). Plate.name records the source solid as "solid_<i>" so multi-pair contacts can be deduplicated per solid pair.

slab_faces_min_area additionally represents EVERY planar face of at least that area as a thin virtual slab (the face ring plus a copy shifted slab_offset into the solid), so contacts on faces without an opposing partner - carved pockets, wedge flanks - are searchable too (measured on the compas_tf floor: ring pairs alone find 464/488 ground-truth contacts, ring pairs + slabs find every physically touching one).

from_connectors classmethod ¤
from_connectors(f_polylines, e_polylines, loft=True, unweld=True) -> PlateModel

From connectors_elements output rows of alternating bot/top polylines (stride 2).

from_elements classmethod ¤
from_elements(elements, loft_meshes=None, joint_data=None, unweld=False) -> PlateModel

From compas_wood WoodElement objects, optionally with generator loft meshes and chevron joint_data.

solve ¤
solve(search_type: int = 0, joint_params: list | None = None, joint_volume_ext: list | None = None, plate_ids=None) -> tuple[list, list]

Run the joinery solver on this model; returns (elements, joints).

solver_kwargs ¤
solver_kwargs(search_type: int = 0, joint_params: list | None = None, joint_volume_ext: list | None = None, plate_ids=None) -> dict

Keyword arguments for :func:joinery_solver_elements, with the plugin's exact gating.

Skips plates missing bottom or top, remaps stored plate ids to accepted indices, enforces the C++ row contracts (std::array / std::array), and passes joinery metadata only when explicit data exists.

source_of ¤
source_of(plate_id: int) -> str

Source tag of a plate ("solid_<i>" for from_breps plates; falls back to the id).

subset ¤
subset(plate_ids: list[int]) -> PlateModel

New model with only the given plates; keeps original ids and full global metadata.