Skip to content

compas_tf.plate ¤

Classes¤

PlateElement ¤

PlateElement(polygon: Polygon = None, thickness: float = 0.1, top: Polygon | Polyline | None = None, bottom: Polygon | Polyline | None = None, top_polyline: Polyline | None = None, bottom_polyline: Polyline | None = None, mesh: Mesh | None = None, transformation: Transformation | None = None, features: list[PlateFeature] | None = None, name: str | None = None, debug: list | None = None)

Class representing a plate element constructed from top/bottom polylines or polygons.

Can be constructed in two ways: 1. From polygon + thickness: The polygon is extruded in the opposite direction of the normal. 2. From top/bottom polylines + mesh: The mesh is pre-computed (e.g., lofted from polylines).

Parameters:

Name Type Description Default
polygon :class:`compas.geometry.Polygon`

The base polygon of the plate (used when not providing polylines).

None
thickness float

The total offset thickness above and below the polygon.

0.1
top :class:`compas.geometry.Polygon` or :class:`compas.geometry.Polyline`

The top boundary of the plate.

None
bottom :class:`compas.geometry.Polygon` or :class:`compas.geometry.Polyline`

The bottom boundary of the plate.

None
top_polyline :class:`compas.geometry.Polyline`

The top polyline of the plate (for lofted plates).

None
bottom_polyline :class:`compas.geometry.Polyline`

The bottom polyline of the plate (for lofted plates).

None
mesh :class:`compas.datastructures.Mesh`

Pre-computed mesh (overrides compute_elementgeometry if provided).

None
transformation :class:`compas.geometry.Transformation`

The transformation of the plate.

None
features list[:class:`PlateFeature`]

The features of the plate.

None
name str

The name of the plate.

None
debug list

Construction geometry (in the plate's local frame) for the viewer to draw, transformed to model space. Empty by default.

None

Attributes:

Name Type Description
polygon :class:`compas.geometry.Polygon`

The base polygon of the plate.

bottom :class:`compas.geometry.Polygon`

The bottom polygon of the plate.

top :class:`compas.geometry.Polygon`

The top polygon of the plate.

top_polyline :class:`compas.geometry.Polyline`

The top polyline of the plate.

bottom_polyline :class:`compas.geometry.Polyline`

The bottom polyline of the plate.

thickness float

The total offset thickness above and below the polygon.

Attributes¤

base_frame property ¤
base_frame: Frame

Get the base frame from the bottom polyline, with transformation applied.

The z-axis (normal) points from bottom to top polyline. The x-axis is aligned to the longest edge of the bottom polyline.

Returns:

Type Description
class:`compas.geometry.Frame`

Frame at centroid of bottom polyline with oriented axes.

bottom_polyline property ¤
bottom_polyline: Polyline | None

Get the bottom polyline, placed in the plate's model frame.

computed_thickness property ¤
computed_thickness: float

Actual plate thickness, measured as the gap between the top and bottom surfaces.

Plates built from top/bottom polylines keep the default thickness attribute (0.1), so the real value is recovered from the geometry here. Falls back to self.thickness when no surfaces are available.

face_polylines property ¤
face_polylines: dict[str, Polyline | list[Polyline]]

Face outlines as closed polylines.

Returns:

Type Description
dict with keys:

"bottom" — closed polyline of the bottom face "top" — closed polyline of the top face "walls" — list of closed polylines, one per side wall

top_frame property ¤
top_frame: Frame

Get the top frame from the top polyline, with transformation applied.

The z-axis (normal) points same direction as base_frame (from bottom to top). The x-axis is aligned to the longest edge of the top polyline.

Returns:

Type Description
class:`compas.geometry.Frame`

Frame at centroid of top polyline with oriented axes.

top_polyline property ¤
top_polyline: Polyline | None

Get the top polyline, placed in the plate's model frame.

Methods:¤

add_cutters ¤
add_cutters(meshes: list, name: str = 'plate_cutters')

Store cutter solids as a difference feature carved into the plate.

The cutters must be given in the plate's local frame. They are kept as a :class:compas_tf.solid_difference_modifier.MeshCutFeature - serialized in __data__ and copied with the plate - so the pocket stays available for fabrication. Contact detection (:meth:_polygon_faces) is unaffected, as it works from the top/bottom polygons, not this mesh.

Parameters:

Name Type Description Default
meshes list[:class:`compas.datastructures.Mesh`]

Closed cutter solids in the plate's local frame.

required
name str
'plate_cutters'
add_feature ¤
add_feature(feature)

Append a feature and invalidate cached geometry so the cut recomputes.

Mirrors :meth:add_cutters (which is sugar for a :class:MeshCutFeature), but takes any pre-built feature - e.g. a :class:CylinderCutFeature or :class:PrismCutFeature.

Parameters:

Name Type Description Default
feature :class:`compas_model.elements.element.Feature`
required

Returns:

Type Description
class:`compas_model.elements.element.Feature`

The feature that was appended.

compute_contacts ¤
compute_contacts(other, tolerance=1e-06, minimum_area=0.1, contacttype=None, face_kinds=None)

Contact detection on true polygon faces — no triangulation.

Parameters:

Name Type Description Default
face_kinds set[str]

Restrict to these face kinds, a subset of {"top", "bottom", "side"}. Applies to BOTH sides of every pair. Default None = all kinds. For other being a non-PlateElement (Mesh source), all its mesh faces are tagged "side" for filtering purposes.

None
compute_elementgeometry ¤
compute_elementgeometry(include_features=True) -> Mesh

Compute the shape of the plate from the given polygons or pre-computed mesh.

Any cut features (see :meth:add_cutters) are then applied as boolean differences and their coplanar faces merged, so the plate carries its connector pockets in its geometry.

Returns:

Type Description
class:`compas.datastructures.Mesh`
fabrication_polylines ¤
fabrication_polylines() -> tuple[Polyline | None, Polyline | None]

Return (bottom, top) polylines wound the SAME direction.

For fabrication and lofting the two boundary polylines must be co-oriented - vertex i of the bottom corresponds to vertex i of the top - which is how they are stored. This is deliberately different from :meth:_polygon_faces, whose face normals point outward (the bottom face normal is flipped) for contact detection. Use this accessor when generating toolpaths or re-lofting; use the face normals for contacts.

Returns:

Type Description
tuple[Polyline | None, Polyline | None]

The bottom and top polylines in model space, co-wound.

get_features ¤
get_features(types: list | None = None, minimal: bool = False) -> list

Return the plate's features, placed in the plate's model frame.

Filter by type to pull out a specific kind of feature for fabrication or inspection, e.g. get_features(["MeshCutFeature"]) to recover just the cutter solids.

The features are stored in the plate's local frame (so they travel with the plate and survive serialization). This returns independent copies whose geometry has been moved into model coordinates by the plate's :attr:modeltransformation - the same transform used to build :attr:modelgeometry - so the returned cutters line up with the plate wherever it sits, with no transform needed at the call site. The stored features are left untouched.

Parameters:

Name Type Description Default
types list[str | type]

Feature types to keep, given as class names (e.g. "MeshCutFeature") or the classes themselves. None (default) returns every feature, in application order.

None
minimal bool

If False (default), return the placed feature objects (whose meshes are the boolean cutter solids). If True, return the features' minimal parametric geometry instead - the axis Line of every :class:CylinderCutFeature and the (bottom, top) polylines of every :class:PrismCutFeature, as a flat list. Features with no minimal form (a plain mesh cut) are skipped.

False

Returns:

Type Description
list[:class:`Feature`] or list[:class:`compas.geometry.Geometry`]
lay_flat_transform ¤
lay_flat_transform(point: Point | None = None) -> Transformation

Transformation that lays the plate flat on worldXY, resting on its TOP face, body up.

Frame beams are fabricated lying on their top face, so the reference is :attr:top_frame (not :attr:base_frame): its z-axis runs bottom->top, so the target frame's z-axis points DOWN and the body extrudes UP. The x-axis is the plate's long edge projected to the ground.

Parameters:

Name Type Description Default
point :class:`compas.geometry.Point`

Where the top frame's origin lands on the ground. Defaults to the world origin.

None

Returns:

Type Description
class:`compas.geometry.Transformation`

A world-space move; compose onto the plate's transformation or apply it to already-placed geometry.

loft staticmethod ¤
loft(polyline0, polyline1, cap=True, close=True)

Loft two polylines into a mesh with earclip-triangulated caps.

Parameters:

Name Type Description Default
polyline0 :class:`compas.geometry.Polyline`

Bottom polyline.

required
polyline1 :class:`compas.geometry.Polyline`

Top polyline.

required
cap bool

If True, add triangulated caps at top and bottom.

True
close bool

If True, close the side loop by connecting last point to first.

True

Returns:

Type Description
class:`compas.datastructures.Mesh`