compas_wood.assign_vectors
¤
Match tag points / direction lines to plate edges and write joint types and insertion vectors.
Slot convention: a plate with n_edges boundary edges has n_faces = n_edges + 2 faces.
Slots 0/1 are the bottom/top faces; edge i maps to face slot i + 2.
Functions:¤
assign_insertion_vectors
¤
assign_insertion_vectors(model: PlateModel, lines, snap_radius: float = 0.1, plate_ids=None) -> dict[int, list[float]]
Match lines to plate edges and tag the insertion vector on each matched face slot.
The stored vector is normalize(cross(plate_normal, line_direction)) — see
:func:insertion_vectors_from_lines for the matching rules.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
:class:`compas_wood.model.PlateModel`
|
Mutated in place via |
required |
lines
|
sequence of :class:`compas.geometry.Line` or (start, end) pairs
|
A line matches an edge when either endpoint is within |
required |
snap_radius
|
float
|
Maximum distance from a line endpoint to an edge for a match. |
0.1
|
plate_ids
|
sequence[int]
|
Restrict matching to these plates; default is all plates in sorted-id order. |
None
|
Returns:
| Type | Description |
|---|---|
dict[int, list[float]]
|
The changed flat vector rows (length |
assign_joint_types
¤
assign_joint_types(model: PlateModel, dots, snap_radius: float = 0.1, plate_ids=None) -> dict[int, list[int]]
Match dot positions to plate edges and tag the joint type on each matched face slot.
Joint type codes: 3=ss_ip, 15=ss_op, 20=top-to-side, 30=cr_ip, 40=tt, 58=ss_r, 60=boundary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
:class:`compas_wood.model.PlateModel`
|
Mutated in place via |
required |
dots
|
sequence of (point, joint_type_code)
|
Point is a :class: |
required |
snap_radius
|
float
|
Maximum distance from a dot to a plate edge for a match. |
0.1
|
plate_ids
|
sequence[int]
|
Restrict matching to these plates; default is all plates in sorted-id order. |
None
|
Returns:
| Type | Description |
|---|---|
dict[int, list[int]]
|
The changed joint-type rows (length |
insertion_vectors_from_lines
¤
insertion_vectors_from_lines(bot_polylines, lines, snap_radius: float = 0.1) -> list[tuple[int, int, float, float, float]]
Match lines to plate edges and compute insertion vectors from the line directions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bot_polylines
|
sequence of :class:`compas.geometry.Polyline` or list of [x, y, z]
|
Bottom outline of each plate. |
required |
lines
|
sequence of :class:`compas.geometry.Line` or (start, end) pairs
|
A line matches an edge when either endpoint is within |
required |
snap_radius
|
float
|
Maximum distance from a line endpoint to an edge for a match. |
0.1
|
Returns:
| Type | Description |
|---|---|
list[tuple[int, int, float, float, float]]
|
|
match_points_to_plate_edges
¤
match_points_to_plate_edges(bot_polylines, points, snap_radius: float = 0.1) -> list[tuple[int, int, int]]
Find all (point, plate edge) pairs within snap_radius.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bot_polylines
|
sequence of :class:`compas.geometry.Polyline` or list of [x, y, z]
|
Bottom outline of each plate. |
required |
points
|
sequence of :class:`compas.geometry.Point` or [x, y, z]
|
Query positions. |
required |
snap_radius
|
float
|
Maximum distance from a point to an edge for a match. |
0.1
|
Returns:
| Type | Description |
|---|---|
list[tuple[int, int, int]]
|
|