Skip to content

compas_wood.brep ¤

Brep plates to wood_nano outline pairs.

The backend is compas_occt (OCCBrep); faces/loops/edges are duck-typed OCC wrappers, so nothing OCC-specific is imported at module level. Facts this module relies on (verified against compas_occt): - face.to_plane() reports the RAW surface normal; opposite faces of an OCC solid share the same normal direction and differ by orientation (0 = FORWARD, 1 = REVERSED). Outward normal = raw normal flipped if REVERSED. - loop.edges / loop.vertices come in wire order; an edge with orientation == 1 is traversed last_vertex -> first_vertex in the loop. - OCC conic parameterization: P(t) = C + rcos(t)X + rsin(t)Y over edge.domain (full circle hole = one closed edge, domain (0, 2*pi)). - face.centroid returns the whole-shape centroid, not the face's - unused.

Functions:¤

brep_outlines ¤

brep_outlines(brep, tol: float = 1e-06, deflection: float | None = None, angle_tol_deg: float = 0.5, area_ratio: float = 0.99, min_pair_fraction: float = 0.0, faces=None)

Bottom/top outlines, hole outlines, and thickness of a plate-like Brep.

The top outer ring and each top hole ring are rotated/reversed to match the winding and start point of their bottom counterpart, so the pair can feed the joinery solver directly.

Returns:

Type Description
tuple[Polyline, Polyline, list[Polyline], list[Polyline], float]

(bottom, top, holes_bottom, holes_top, thickness)

outline_from_face ¤

outline_from_face(face, deflection: float | None = None) -> tuple[Polyline, list[Polyline]]

Extract the outer loop and inner (hole) loops of a face as closed polylines.

plate_faces ¤

plate_faces(brep, tol: float = 1e-06, angle_tol_deg: float = 0.5, area_ratio: float = 0.99, min_pair_fraction: float = 0.0)

Find the two opposing plate faces of a plate-like Brep solid.

Among planar faces, picks the largest pair whose outward normals are anti-parallel within angle_tol_deg and whose areas satisfy min/max >= area_ratio. The defaults accept prismatic plates only; tapered plates (wedges, t-sections) need e.g. angle_tol_deg=16, area_ratio=0.25. Returns (bottom_face, top_face) where bottom is the face whose surface plane normal points away from the other face.

Raises:

Type Description
ValueError

If no pair of near-parallel planar faces passes the tolerances.

plate_from_brep ¤

plate_from_brep(brep, plate_id: int, tol: float = 1e-06, deflection: float | None = None, angle_tol_deg: float = 0.5, area_ratio: float = 0.99, min_pair_fraction: float = 0.0, faces=None, name: str | None = None)

Build a :class:compas_wood.model.Plate from a plate-like Brep solid.

plate_pairs ¤

plate_pairs(brep, tol: float = 1e-06, angle_tol_deg: float = 0.5, area_ratio: float = 0.99, min_pair_fraction: float = 0.0, max_pairs: int = 3, min_face_area: float = 0.0)

ALL disjoint opposing planar face pairs of a prismatic solid, largest first.

min_face_area (model units squared) drops pairs of small faces outright - the cap faces of fastener rods (screws, dowels; ~2000 mm2 in the compas_tf model) fall under it while real plate faces are tens of thousands.

A plate yields one pair; a box column yields up to three (one per axis) so contacts on every side can be searched. min_pair_fraction rejects pairs whose combined area is below that fraction of the total surface area - a curved-dominated solid (screw, dowel, cylinder) then yields no pairs at all. Returns a list of (bottom_face, top_face).