Skip to content
Shapemetry

Model - Brep face

API reference for src/nodeMethods/brepFace on @huukhanhnguyen/model, reachable from ., ./compute.

See the Guide for the ModelJSON / evaluate pipeline.

API reference

Signatures are generated from the live package .d.ts - not hand-written.

classifyShellsToBodies

function

Same as classifyShellsToBodyDocuments, then split each body back to scene one-shell tables (outer + each void as its own Shell).

classifyShellsToBodies(shells: Shell[]): Shell[]

classifyShellsToBodyDocuments

function

Classify one-shell documents into bodies by containment and orientation. Returns kernel solid-root document STRINGS (multi-shell when a body has voids). brep_classify_shells — N one-shell docs in, solid-root docs out.

classifyShellsToBodyDocuments(shells: Shell[]): string[]

eachFaceLoops

function

Per-face loop lists for the outer shell (length = faceCountOf).

eachFaceLoops(geometry: Shell, tolerance?: number): Point$1[][][]

emptyFaceGeometry

function

The EMPTY face — a shell with no faces. The 2D ops use it as their "no result" value (it was {loops: []} before the brep cutover): it carries no loops, so every consumer that iterates the boundary sees nothing.

emptyFaceGeometry(_uvMatrix?: Transformation): Shell

entityLoops

function

faceLoops for a face ENTITY — one-face only (throws on multi-face).

entityLoops(face: ShellEntity, tolerance?: number): Point$1[][]

explodeBodyToFaceEntities

function

THE LOSSLESS EXPLODE: every face of this shell as its own one-face entity. Cavities are separate entities after the one-shell-per-entity split — pass each shell entity separately (or classify first for a multi-entity body).

explodeBodyToFaceEntities(geometry: Shell): ShellEntity[]

explodeToFaceEntities

function

THE EXPLODE: every face of a wrap's OUTER shell as its own one-face-shell entity, read straight out of the kernel. brep_shell_face_document hands one face back as its own version-2 document — the face, its outer loop and holes, and only the edges and vertices those loops reference — which is exactly what one face's own wrap entity. The shell is opened once for the whole walk and the handle is freed in a finally, so no TypeScript object graph is built and nothing survives the call.

Empty when the wrap carries no faces. VOIDS ARE NOT INCLUDED — the outer shell is what faceCountOf counts, so the two agree; a body's cavities ride on explodeBodyToFaceEntities.

explodeToFaceEntities(geometry: Shell): ShellEntity[]

faceBoundaryPoints

function

All boundary points of every outer-shell face (bounds / inspect).

faceBoundaryPoints(geometry: Shell, tolerance?: number): Point$1[]

faceCountOf

function

Face count of this shell (one entity = one shell, so faces.length).

faceCountOf(geometry: Shell): number

faceEntityFromLoops

function

faceFromLoops wrapped as a full face ENTITY.

faceEntityFromLoops(loops: Point$1[][], uvMatrix?: Transformation): ShellEntity | null

faceFromLoops

function

Flat polygon loops (outer first, then holes) → a one-face-shell Shell. The supporting plane is fitted from the outer loop by Newell's method inside Face.fromLoop, so the carrier comes back tagged form: plane and every downstream brep op takes its analytic path.

Returns null when the outer loop has fewer than 3 distinct points — callers skip such degenerate input rather than emitting a broken face.

faceFromLoops(loops: Point$1[][], uvMatrix?: Transformation): Shell | null

faceGeometryFromLoops

function

faceFromLoops that always yields a geometry, degenerate input becoming the EMPTY face. For producers whose old { loops } literal could not fail: a loop with fewer than 3 distinct points used to make an unrenderable face, and now makes an unrenderable empty one.

faceGeometryFromLoops(loops: Point$1[][], uvMatrix?: Transformation): Shell

faceLoops

function

ONE-FACE boundary loops — outer first, then holes. The inverse of faceFromLoops for a planar face built from polygons.

Throws MultiFaceAccessorError when the wrap has more than one face (silent flatten would mis-read holes / per-face topology). Use faceLoopsAt or eachFaceLoops for multi-face wraps.

faceLoops(geometry: Shell, tolerance?: number): Point$1[][]

faceLoopsAt

function

Boundary loops of one face inside a wrap (outer-shell index). Empty when the index is out of range.

faceLoopsAt(geometry: Shell, faceIndex: number, tolerance?: number): Point$1[][]

facesToSolid

function

Scene faces → ONE solid DOCUMENT (TOLERANCE SEW). Survives ONLY for migration and explicit import doors — not hot eval/boolean paths. Prefer solidDocumentOf on an already-wrapped entity, and measureFaceSet when the sew was only ever wanted for a measurement.

When faces is a single wrap that already closes, it is handed straight back through the loader (no sew, cavities kept). Multi-entity bags sew every wrap's outer shell into one kernel shell and load that.

Returns null when the faces do not close a volume — brep_load refuses an open sheet, which is the same answer.

facesToSolid(faces: ShellEntity[]): Shell | null

isClosedFaceSet

function

True when a face set closes a VOLUME — asked of the kernel: one wrap is its own answer (brep_load refuses an open sheet), a multi-entity bag is tolerance-sewn first and the sewn shell reports its own watertightness. EMPTY set is not a solid.

isClosedFaceSet(faces: ShellEntity[]): boolean

isClosedSolid

function

True when one wrap entity is a closed solid (solid root or closed shell).

isClosedSolid(entity: ShellEntity): boolean

isShellBrep

function

True when a value is one-shell tables (scene Shell or one-shell kernel doc).

isShellBrep(doc: unknown): boolean

isSolidBrep

function

Does this kernel document carry MORE than one shell? The load path sees one before fromKernelDocument splits it; a scene entity is always one shell.

isSolidBrep(doc: unknown): boolean

MultiFaceAccessorError

class

Named error when a one-face accessor is used on a multi-face wrap.

class MultiFaceAccessorError

planeFrameOf

function

The frame DERIVED from the face's own plane form tag, or null when the carrier is not a tagged plane (a curved face has no single frame).

uvMatrix is AUTHORED meta and is never synthesized — this is the fallback consumers use when it is absent, computed on read and never stored, so a face that was never given a uvMatrix keeps behaving exactly as its geometry implies.

planeFrameOf(geometry: Shell): Frame | null

voidShellDocumentsOf

function

Void shells of a multi-shell KERNEL document, as scene shells. Empty for a one-shell entity (voids are separate entities after the split).

voidShellDocumentsOf(geometry: Shell): Shell[]

wrapEntityOf

function

Kernel or scene shell document → one entity. Multi-shell kernel docs: use wrapEntitiesOf (this keeps the first shell only for single-return call sites).

wrapEntityOf(doc: unknown, uvMatrix?: Transformation): ShellEntity
Last updated: 📖 5 min readEdit on GitHub