Skip to content
Shapemetry

Geometry values

API reference for root values that are not PascalCase namespace objects (Point, Brep, Shell, …).

B-Rep display mesh: Brep.tessellate (solid-root) / Shell.tessellate (one-shell) → TriangleMesh - see Brep and Shell.

API reference

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

assertBrepVersion2

function

Throw UnsupportedBrepVersion1Error when document still has wires.

assertBrepVersion2(document: unknown): void

fromKernelDocument

function

Solid-root Brep JSON (string or parsed) → one scene shell per kernel shell. Multi-shell cavity solids become multiple Shell values.

fromKernelDocument(document: unknown): Shell[]

InvalidShellJsonError

class

A value that does not have Shell's four tables.

class InvalidShellJsonError

InvalidWireError

class

A value that does not have Wire's shape.

class InvalidWireError

isWire

function

Is this value a Wire? The PREDICATE half of parseWire — same conditions, no throw, because a type guard that throws is not a guard. One body serves both: the parser calls this.

The absent faces / loops is the whole discriminator (their declaration spells them ?: never for exactly that reason), so this is also what a call site hand-sniffing "loops" in value was reaching for.

isWire(value: unknown): value is Wire

parseShellJson

function

unknownShell, or throw InvalidShellJsonError. The door every JSON.parse(<kernel document>) should cross.

parseShellJson(value: unknown): Shell

parseWire

function

unknownWire, or throw InvalidWireError.

parseWire(value: unknown): Wire

toKernelDocument

function

Scene shell → solid-root Brep JSON string (one shell spanning all faces).

toKernelDocument(shell: Shell): string

UnsupportedBrepVersion1Error

class

Version-1 BRep documents (boundary table spelled wires) are unsupported. Call at every document entry so a v1 payload fails loud instead of reading as a document with no loops.

class UnsupportedBrepVersion1Error
Last updated: 📖 1 min readEdit on GitHub