Model - STEP
API reference for src/export/step on @huukhanhnguyen/model, reachable from ..
See the Guide for the ModelJSON / evaluate pipeline.
API reference
Signatures are generated from the live package .d.ts - not hand-written.
entitiesFromStep
function
A STEP document → scene face entities — the static-geometry intake, same shape the OBJ/STL importers produce. Every body decomposes into independent one-face shells, which is exactly what a solid is in the scene stream. Accepts MANIFOLD_SOLID_BREP (closed solids) and SHELL_BASED_SURFACE_MODEL (open shells), including mixed one-document files written by entitiesToStep.
Throws (from the parser) on content that is not readable STEP geometry.
entitiesFromStep(content: string): ShellEntity[]entitiesToStep
function
World-space leaf entities → a multi-body STEP document.
Testable without a Model: hand it a flat Entity[] whose faces are already in world space (that is what sceneToStep prepares). A BlockEntity in that stream REQUIRES options.definitions (the model's scope.definitions); an unresolvable placement throws rather than writing a file that is missing it — see expandBlocks.
entitiesToStep(entities: Entity[], options?: StepOptions): StepResultformatStepExportChatMessage
function
Chat / download confirmation string — same written-vs-skipped law as formatStepExportReport.
formatStepExportChatMessage(result: Pick<StepResult, "solids" | "openShells" | "meshes"> & { unwritable?: number; }): stringformatStepExportReport
function
Build the shared STEP export status from StepResult counts.
formatStepExportReport(result: Pick<StepResult, "solids" | "openShells" | "meshes"> & { unwritable?: number; }): StepExportReportsceneToStep
function
A render frame (Model.sceneFrame()) → a STEP document.
A slice's own leaves are already world-space; a group PLACEMENT's leaves are LOCAL to the shared definition, so each placement's matrix is baked in (transformEntity moves the brep carrier itself, not a discretization).
A leaf may itself BE a blockEntity (the render frame keeps placements), which options.definitions — model.scope.definitions — resolves. Pass it whenever the frame can carry a placement: without it that placement is an error, not an empty body (see expandBlocks).
sceneToStep(frame: RenderFrameSlice[], options?: Parameters<typeof entitiesToStep>[1]): StepResult