Engine API
Generated from packages/sketchforge-engine/dist/index.d.ts by node scripts/docs/generate-package-references.mjs. Do not edit this file directly.
This reference lists the package's exported declaration surface. Start with the package guide, or read the npm package README.
@constructorfleet/sketchforge-engine is the TypeScript package for SketchForge's project model and geometry operations. It is intended for Node.js applications that need to read or change SketchForge projects, construct parameterized shapes, or import and export geometry without running the web editor.
Node compatibility
The package manifest declares Node.js 20 or newer, but that range is broader than the runtime supported by its full geometry stack: the locked brepjs dependency requires Node.js 24 or newer. Use Node.js 24+ for the complete engine, including exact CAD and kernel-backed operations. On Node.js 20–23, npm may warn about the dependency engine requirement, and full engine behavior is unsupported. The package's engine range should be aligned with this dependency in a future package release.
Installation
npm install @constructorfleet/sketchforge-engineThe package is ECMAScript modules (ESM). TypeScript declarations ship with the package; no separate @types package is needed.
Quick start
Build a shape from parameters without starting the editor or opening a project:
import { shapeFromRequest } from "@constructorfleet/sketchforge-engine";
const shape = shapeFromRequest({ kind: "box", width: 20, depth: 10, height: 5 });
if (!shape) throw new Error("The requested shape could not be built");
console.log(shape.kind, shape.width, shape.depth, shape.height);The shape request is plain data and can be stored or passed to createEngine. shapeFromRequest returns null for kinds that cannot be created from parameters alone (for example, a mesh with no geometry).
To run project operations, bind an engine to the directory store used by SketchForge:
import { createEngine, directoryProjectStore } from "@constructorfleet/sketchforge-engine";
const projectsDirectory = process.env.SKETCHFORGE_PROJECTS_DIR;
if (!projectsDirectory) throw new Error("Set SKETCHFORGE_PROJECTS_DIR to the project directory");
const engine = createEngine(directoryProjectStore(projectsDirectory));
const result = await engine.project("project-id");
if (!result.ok) throw new Error(`Could not read project: ${result.failure.reason}`);
console.log(`Revision ${result.value.revision}; ${result.value.shapes.length} shapes`);Set SKETCHFORGE_PROJECTS_DIR to the directory already used by SketchForge, and replace project-id with an existing project ID. The directory must contain projects in the supported on-disk format. Keep access to that directory restricted to trusted local code: this package is a geometry/project library, not an HTTP service or an access-control boundary.
Public API
The package root is the supported import surface. Its main engine facade is Engine, created with createEngine(store). Every operation returns an EngineResult<T>; check ok before reading value or failure.
| Area | Engine methods | What they do |
|---|---|---|
| Read and edit a project | project, addShapes, changeShape, removeShape | Read placed shapes and project metadata; add parameterized shapes or change/remove an existing shape. |
| Arrange and repeat | align, distribute, pattern, mirrorBaked | Place selected shapes on a shared axis, spread them, create linear/circular copies, or mirror supported solids. |
| Import and combine | importMesh, cut, group, ungroup, separate, explode | Import model files, subtract/group solids, split groups/bodies, or explode a retained STEP assembly. |
| Inspect and measure | edges, faces, measurements, properties, measureBetween, interference | Query exact geometry topology, shape properties, distances/angles, and gaps/overlaps. |
| Modify exact geometry | treat, draftPrism, shell, changeShape | Apply edge treatments, draft an extruded prism, retain bounded sketch face drafts, or hollow a shape. |
These operations address an existing project ID in a ProjectStore; this package does not create projects, project records, or initialize a project directory. addShapes is the first write operation for a project that already exists. All writes persist to the configured store.
The main entry point also exports these API areas:
- Projects and operations:
directoryProjectStore,createEngine,Engine,EngineResult,EngineFailure, project and operation request/result types. - Shape requests:
shapeFromRequest,shapeWithRequestedChanges,REQUESTABLE_SHAPE_KINDS, plus types describing parameterized shapes. - Project files and exchange:
.skfimport/export and inspection; mesh import; STEP and scene export; SVG/DXF section output; STEP assembly explosion. - Geometry and CAD: primitive builders, exact solids, sectioning, topology analysis, shape bounds, CAD measurements, shelling, edge treatments, wall thickness, and projection layouts.
- Placement and repetition: align/distribute helpers, pattern placement helpers, shape bounds, mirror, canonicalization, and workplane hole-mode helpers.
See the generated TypeScript API reference for every symbol and declaration. The reference links back to this usage guide. Related documentation: REST API, project format, and TypeScript client.
Editing a sketch-backed feature
Sketch extrusions, revolves, and sweeps expose a stable sketchSourceId on the generated shape. Pass that ID to engine.changeShape(projectId, sketchSourceId, { sketchProfile }) to rebuild the feature. For a persisted sketch revolve, the same source ID also accepts operation-setting updates such as { sides: 64 }. A draft prism retains its draftPrismAngle; source edits accept { draftPrismAngle: 12 } and reapply the draft when the extrusion profile changes. Retained sketch extrusions, sweeps, and eligible revolves can store one face draft with { faceDraft: { sourceFaceId, angle, pullDirection } }; use the ID from engine.faces, and use null to clear it. Profile edits resolve the selected planar face by its stored normal and require exactly one match; they never carry the old face index forward. .skf round trips preserve the face draft and source frame. A single-loop sketch extrusion can combine one face draft followed by one all-edge fillet. A single-section, no-hole sketch sweep can combine one face draft followed by one all-edge fillet or one symmetric 45° all-edge chamfer. Sweep treatments replay the source, draft, then treatment on profile edits, including after archive import; tests cover the round trip, replay, unsupported angles, and atomic refusal. Sweep face drafts do not support multiple sections, section holes, selected-edge treatments, or additional treatments. A plain single-region full-turn sketch revolve can combine one face draft followed by either one symmetric 45° all-edge chamfer or one all-edge fillet; profile and setting edits replay the source, draft, then treatment, including after archive import. Other face-draft treatment combinations, prism drafts, and shelling remain unsupported. When the output is nested inside a baked boolean group, the engine updates the sketch output and recomputes its boolean ancestors from their retained operands before writing the project. Each rebuilt ancestor is placed through its group's frame the way ungrouping places the group's children, so a group that was moved, turned, mirrored or resized after creation keeps that placement, mirror and scale across the edit. The edit is atomic: invalid profiles, missing or ambiguous face matches, or a failed dependent rebuild leave the stored project unchanged.
This recomputation currently covers sketch-backed extrusions, revolves, and sweeps nested under boolean groups, plus a retained prism-draft angle applied to a sketch extrusion. Other downstream operations remain baked or unsupported for source-driven recompute, and a general-purpose feature graph is not yet available. .skf export preserves the updated sketch profile, draft angle, and recomputed boolean result.
Limitations
- The package does not provide the SketchForge web UI, HTTP routes, authentication, or a remote project client. Use the TypeScript client for the REST API.
- There is no package-level
meshForShapedispatcher yet; use the primitive builders or exact-solid helpers for the specific shape kinds they support. - The engine reads and writes SketchForge projects through a
ProjectStore;directoryProjectStoreis a local filesystem implementation. It expects valid project files and a directory managed with SketchForge's project conventions. - Parameter-only shape creation does not create drawn sketches or arbitrary mesh geometry. Import mesh data through
engine.importMeshor use the editor for drawing workflows. - CAD, STEP, and exact-solid operations rely on native/WASM geometry dependencies and can be more resource-intensive than pure parameter and placement helpers. Kernel-specific modules are loaded when those operations run.
- Use the package root as the supported public API. The export map also permits subpath imports for compiled modules, but undocumented internal modules are not a compatibility promise.
License
This package is licensed under AGPL-3.0-only.
Exported API
Browse declarations by area, or use the alphabetical links below.
Projects and engine operations
AlignOutcome · AlignRequest · createEngine · CutRequest · directoryProjectStore · DistributeOutcome · DistributeRequest · Engine · EngineFailure · EngineResult · InterferencePair · InterferenceRefusal · InterferenceReport · InterferenceRequest · MeasurementEndRef · MeasurementEntityKind · MeasurementUnavailableCode · MeshImportRequest · PatternRequest · ProjectDocument · ProjectExportArtifact · ProjectExportFormat · ProjectExportOptions · ProjectionLayout · ProjectionView · ProjectMetadata · ProjectRead · ProjectStore · ServerCadEdge · ServerCadError · ServerCadFace · ServerCadMeasurement · ServerCadMeasurementPair · ServerCadResult · ServerCadShapeProperties · ServerCadShellRequest · ServerCadTreatment · ShapeRemoved · ShapesArranged · ShapesWritten · ShapeWritten
Shape construction and placement
AlignAxis · AlignEntry · AlignShift · AlignTarget · bakedRevolveAxisOffset · boundsForShapes · canonicalizeShape · circularPatternPlacements · CircularPatternRequest · DistributeEntry · DistributeShift · DistributeSpacing · effectiveAlignAnchorId · exactSolidForShape · exportShapesToStep · linearPatternPlacements · LinearPatternRequest · meshProjectShapes · mirrorShapes · ParsedRevolveRequest · parseRevolveRequest · PatternKind · PatternPlacement · placeRevolveOnAxis · rebuiltRevolveShape · recoveredRevolveAxis · reportedRevolveAxis · RequestableShapeKind · resolveThreadRequest · RevolveAxis · revolvedShapeFromRequest · sectionShapesToDxf · sectionShapesToSvg · shapeBounds · ShapeBounds · ShapeChangeResult · shapeFromRequest · ShapeGeometryProvenance · ShapeRequest · shapeWithRequestedChanges · UnbuildableShapeError · widestDistributeAxis · withHoleMode
Project files and geometry exchange
analyzeMeshTopology · explodeStepAssembly · exportProjectScene · exportSkfProject · importableMeshFormat · ImportableMeshFormat · ImportedMesh · importedMeshFromFile · importSkfProject · inspectSkfProjectPackage · parseProjectionLayout · renderSectionDxf · renderSectionSvg · SectionDrawing · SectionOptions · SectionPlane · SkfProjectExportInput · SkfRestoredProject · StepExportResult · suggestedLinearStep
Geometry and CAD
ALIGN_EPSILON · alignCoordinate · alignShifts · AngleUnavailableCode · applyDraftPrism · createHalfSphereGeometry · createHollowCylinderGeometry · createPyramidGeometry · createRoofGeometry · createRoundRoofGeometry · createTorusGeometry · createWedgeGeometry · distributeShifts · EXACT_SOLID_KINDS · FACE_DIRECTION_NAMES · footprintCenter · IMPORTABLE_MESH_FORMATS · MAX_EXPLODE_SOLIDS · MAX_EXPLODE_SOURCE_BYTES · MAX_INTERFERENCE_CANDIDATES · MAX_INTERFERENCE_SHAPES · MAX_PATTERN_COUNT · MIN_PATTERN_COUNT · PrimitiveGeometryOptions · PROJECT_EXPORT_FORMATS · PROJECTION_LAYOUTS · PROJECTION_VIEWS · projectionLayoutForCaptureFace · putGeometryOnBase · RadiusUnavailableCode · REQUESTABLE_SHAPE_KINDS · revolveAxisPosition · SECTION_PLANES · SKF_FORMAT_VERSION · SKF_MEDIA_TYPE · TriangleFace · wallThickness · WallThicknessResult
All exports
ALIGN_EPSILON · AlignAxis · alignCoordinate · AlignEntry · AlignOutcome · AlignRequest · AlignShift · alignShifts · AlignTarget · analyzeMeshTopology · AngleUnavailableCode · applyDraftPrism · bakedRevolveAxisOffset · boundsForShapes · canonicalizeShape · circularPatternPlacements · CircularPatternRequest · createEngine · createHalfSphereGeometry · createHollowCylinderGeometry · createPyramidGeometry · createRoofGeometry · createRoundRoofGeometry · createTorusGeometry · createWedgeGeometry · CutRequest · directoryProjectStore · DistributeEntry · DistributeOutcome · DistributeRequest · DistributeShift · distributeShifts · DistributeSpacing · effectiveAlignAnchorId · Engine · EngineFailure · EngineResult · EXACT_SOLID_KINDS · exactSolidForShape · explodeStepAssembly · exportProjectScene · exportShapesToStep · exportSkfProject · FACE_DIRECTION_NAMES · footprintCenter · IMPORTABLE_MESH_FORMATS · importableMeshFormat · ImportableMeshFormat · ImportedMesh · importedMeshFromFile · importSkfProject · inspectSkfProjectPackage · InterferencePair · InterferenceRefusal · InterferenceReport · InterferenceRequest · linearPatternPlacements · LinearPatternRequest · MAX_EXPLODE_SOLIDS · MAX_EXPLODE_SOURCE_BYTES · MAX_INTERFERENCE_CANDIDATES · MAX_INTERFERENCE_SHAPES · MAX_PATTERN_COUNT · MeasurementEndRef · MeasurementEntityKind · MeasurementUnavailableCode · MeshImportRequest · meshProjectShapes · MIN_PATTERN_COUNT · mirrorShapes · ParsedRevolveRequest · parseProjectionLayout · parseRevolveRequest · PatternKind · PatternPlacement · PatternRequest · placeRevolveOnAxis · PrimitiveGeometryOptions · PROJECT_EXPORT_FORMATS · ProjectDocument · ProjectExportArtifact · ProjectExportFormat · ProjectExportOptions · PROJECTION_LAYOUTS · PROJECTION_VIEWS · ProjectionLayout · projectionLayoutForCaptureFace · ProjectionView · ProjectMetadata · ProjectRead · ProjectStore · putGeometryOnBase · RadiusUnavailableCode · rebuiltRevolveShape · recoveredRevolveAxis · renderSectionDxf · renderSectionSvg · reportedRevolveAxis · REQUESTABLE_SHAPE_KINDS · RequestableShapeKind · resolveThreadRequest · RevolveAxis · revolveAxisPosition · revolvedShapeFromRequest · SECTION_PLANES · SectionDrawing · SectionOptions · SectionPlane · sectionShapesToDxf · sectionShapesToSvg · ServerCadEdge · ServerCadError · ServerCadFace · ServerCadMeasurement · ServerCadMeasurementPair · ServerCadResult · ServerCadShapeProperties · ServerCadShellRequest · ServerCadTreatment · shapeBounds · ShapeBounds · ShapeChangeResult · shapeFromRequest · ShapeGeometryProvenance · ShapeRemoved · ShapeRequest · ShapesArranged · ShapesWritten · shapeWithRequestedChanges · ShapeWritten · SKF_FORMAT_VERSION · SKF_MEDIA_TYPE · SkfProjectExportInput · SkfRestoredProject · StepExportResult · suggestedLinearStep · TriangleFace · UnbuildableShapeError · wallThickness · WallThicknessResult · widestDistributeAxis · withHoleMode
ALIGN_EPSILON
value
ALIGN_EPSILON = 0.0005AlignAxis
type
export type AlignAxis = "x" | "y" | "z";alignCoordinate
function
export declare function alignCoordinate(entry: Pick<AlignEntry, "min" | "max">, target: AlignTarget): number;AlignEntry
type
export type AlignEntry = {
id: string;
/** Lowest coordinate of the object along the axis being aligned. */
min: number;
/** Highest coordinate along that axis. */
max: number;
/** An object that cannot move: it anchors the alignment instead. */
locked?: boolean;
};AlignOutcome
type
export type AlignOutcome = ShapesArranged & {
anchorId: string | null;
};AlignRequest
type
export type AlignRequest = {
ids: string[];
axis: AlignAxis;
target: AlignTarget;
/** The shape to keep fixed; a locked shape in the selection wins over it. */
anchorId?: string | null;
};AlignShift
type
export type AlignShift = {
id: string;
/** How far this object moves along the axis. */
delta: number;
};alignShifts
function
export declare function alignShifts(entries: readonly AlignEntry[], target: AlignTarget, anchorId?: string | null): AlignShift[];AlignTarget
type
export type AlignTarget = "min" | "center" | "max";analyzeMeshTopology
function
export declare function analyzeMeshTopology(vertices: readonly MeshPoint[], faces: readonly TriangleFace[], tolerance?: number): {
triangles: number;
boundaryEdges: number;
nonManifoldEdges: number;
degenerateTriangles: number;
watertight: boolean;
};AngleUnavailableCode
type
export type AngleUnavailableCode = "notPlanar" | "degenerateNormal";applyDraftPrism
function
export declare function applyDraftPrism(shape: WorkplaneShape, request: {
angle: number;
}): Promise<ServerCadResult>;bakedRevolveAxisOffset
function
export declare function bakedRevolveAxisOffset(original: WorkplaneShape, baked: WorkplaneShape): RevolveAxis | undefined;boundsForShapes
function
export declare function boundsForShapes(shapes: readonly WorkplaneShape[]): ShapeBounds | null;canonicalizeShape
function
export declare function canonicalizeShape(shape: WorkplaneShape): WorkplaneShape;circularPatternPlacements
function
export declare function circularPatternPlacements(request: CircularPatternRequest, origin: {
x: number;
z: number;
}): PatternPlacement[];CircularPatternRequest
type
export type CircularPatternRequest = {
/** Total copies including the original. */
count: number;
/** Centre of the ring, in workplane coordinates. */
centerX: number;
centerZ: number;
/** How far round to spread them; 360 closes the ring. */
sweepAngle?: number;
/**
* Whether each copy turns to face the centre as it goes round.
*
* A bolt hole does not care, but a spoke, a tooth or a vane does -- without
* it they all point the way the original did, which reads as a mistake.
*/
rotateCopies?: boolean;
};createEngine
function
export declare function createEngine(store: ProjectStore): Engine;createHalfSphereGeometry
function
export declare function createHalfSphereGeometry(width: number, height: number, depth: number, steps?: number, options?: PrimitiveGeometryOptions): THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;createHollowCylinderGeometry
function
export declare function createHollowCylinderGeometry(width: number, height: number, depth: number, thickness: number, segments?: number): THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;createPyramidGeometry
function
export declare function createPyramidGeometry(width: number, height: number, depth: number, sides?: number, options?: PrimitiveGeometryOptions): THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;createRoofGeometry
function
export declare function createRoofGeometry(width: number, height: number, depth: number, options?: PrimitiveGeometryOptions): THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;createRoundRoofGeometry
function
export declare function createRoundRoofGeometry(width: number, height: number, depth: number, sides?: number, options?: PrimitiveGeometryOptions): THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;createTorusGeometry
function
export declare function createTorusGeometry(width: number, height: number, depth: number, options?: PrimitiveGeometryOptions): THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;createWedgeGeometry
function
export declare function createWedgeGeometry(width: number, height: number, depth: number, options?: PrimitiveGeometryOptions): THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;CutRequest
type
export type CutRequest = {
solidIds: string[];
holeIds: string[];
} & ResultAttributes;directoryProjectStore
function
export declare function directoryProjectStore(root: string, expectedRevision?: string): ProjectStore;DistributeEntry
type
export type DistributeEntry = {
id: string;
/** Lowest coordinate of the object along the axis being distributed. */
min: number;
/** Highest coordinate along that axis. */
max: number;
/** Objects that cannot move: they keep their place and still take up room. */
locked?: boolean;
};DistributeOutcome
type
export type DistributeOutcome = ShapesArranged & {
axis: "x" | "z";
spacing: DistributeSpacing;
};DistributeRequest
type
export type DistributeRequest = {
ids: string[];
/** Omit to spread along whichever axis the shapes are already most spread along. */
axis?: "x" | "z" | null;
spacing?: DistributeSpacing;
};DistributeShift
type
export type DistributeShift = {
id: string;
/** How far this object moves along the axis. */
delta: number;
};distributeShifts
function
export declare function distributeShifts(entries: DistributeEntry[], spacing: DistributeSpacing): DistributeShift[];DistributeSpacing
type
export type DistributeSpacing = "gaps" | "centers";effectiveAlignAnchorId
function
export declare function effectiveAlignAnchorId(entries: readonly AlignEntry[], requestedAnchorId?: string | null): string | null;Engine
type
export type Engine = {
/**
* The project's shapes and the little metadata that goes with them.
*
* Cheap, and on the facade rather than left to each caller because every
* caller wanting the scene wants the same handful of fields, and three of
* them -- the revision, the grid, the units -- are the ones most easily left
* out by someone who only meant to list the objects.
*/
project(projectId: string): Promise<EngineResult<ProjectRead>>;
/**
* Add shapes described as parameters, in one write.
*
* A batch rather than a shape at a time because the point of describing
* shapes as data is parameterised work: a script computing a row of holes
* should not need a write of the project package per hole.
*/
addShapes(projectId: string, requests: readonly ShapeRequest[]): Promise<EngineResult<ShapesWritten>>;
/** Change one shape, refusing the fields its kind cannot take. */
changeShape(projectId: string, shapeId: string, changes: ShapeRequest): Promise<EngineResult<ShapeWritten>>;
/** Remove one shape. */
removeShape(projectId: string, shapeId: string): Promise<EngineResult<ShapeRemoved>>;
/** Bring shapes onto one line: an edge or a centre of each on one coordinate. */
align(projectId: string, request: AlignRequest): Promise<EngineResult<AlignOutcome>>;
/** Spread three or more shapes evenly; the outermost two define the span and stay put. */
distribute(projectId: string, request: DistributeRequest): Promise<EngineResult<DistributeOutcome>>;
/** Repeat shapes in a row or around a ring, adding the copies. */
pattern(projectId: string, request: PatternRequest): Promise<EngineResult<ShapesWritten>>;
/** Add the shape a model file describes, keeping the file as a project asset. */
importMesh(projectId: string, request: MeshImportRequest): Promise<EngineResult<ShapeWritten>>;
/** Subtract `holeIds` from `solidIds`, leaving one group where the operands were. */
cut(projectId: string, request: CutRequest): Promise<EngineResult<ShapeWritten>>;
/** Bundle shapes into one group; a selection holding a hole comes back cut. */
group(projectId: string, ids: string[], result?: ResultAttributes): Promise<EngineResult<ShapeWritten>>;
/** Take a group apart, leaving its children where they appeared. */
ungroup(projectId: string, shapeId: string): Promise<EngineResult<ShapesWritten>>;
/** Split a shape into the separate bodies it is made of. */
separate(projectId: string, shapeId: string): Promise<EngineResult<ShapesWritten>>;
/** Split a retained STEP assembly source into exact positioned solid shapes. */
explode(projectId: string, shapeId: string): Promise<EngineResult<ShapesWritten>>;
/** A shape's edges, numbered as a treatment request refers to them. */
edges(projectId: string, shapeId: string): Promise<EngineResult<ServerCadEdge[]>>;
/** A shape's faces, numbered as a shell request refers to them. */
faces(projectId: string, shapeId: string, topology?: "exact"): Promise<EngineResult<ServerCadFace[]>>;
/** Round or cut a shape's edges. */
treat(projectId: string, shapeId: string, treatment: ServerCadTreatment): Promise<EngineResult<ShapeWritten>>;
/** Draft a solid along its vertical extrusion axis and store exact geometry. */
draftPrism(projectId: string, shapeId: string, angle: number): Promise<EngineResult<ShapeWritten>>;
/** Reflect selected parameter-built solids across their selection bounds and bake the exact result. */
mirrorBaked(projectId: string, ids: string[], axis: "x" | "y" | "z"): Promise<EngineResult<ShapesArranged>>;
/** Hollow a shape out, optionally leaving faces open. */
shell(projectId: string, shapeId: string, request: ServerCadShellRequest): Promise<EngineResult<ShapeWritten>>;
/** Every edge and face of a shape, measured from its exact geometry. */
measurements(projectId: string, shapeId: string): Promise<EngineResult<ServerCadMeasurement[]>>;
/** Volume, area, center of mass, bounds and provenance for one placed shape. */
properties(projectId: string, shapeId: string): Promise<EngineResult<ServerCadShapeProperties>>;
/**
* The distance between two entities, and the angle between them if both are flat faces.
*
* The two ends may be different shapes, which is why this takes refs rather
* than a `shapeId` -- "how far apart are these two parts" is the measurement
* the operation exists for.
*/
measureBetween(projectId: string, from: MeasurementEndRef, to: MeasurementEndRef): Promise<EngineResult<ServerCadMeasurementPair>>;
/** Exact, bounded gaps and overlap volumes between visible non-cutter shapes. */
interference(projectId: string, request?: InterferenceRequest): Promise<EngineResult<InterferenceReport>>;
};EngineFailure
type
export type EngineFailure = {
reason: "project_busy";
} | {
reason: "project_not_found";
} | {
reason: "shapes_not_found";
ids: string[];
} | {
reason: "shape_locked";
ids: string[];
} | {
reason: "not_a_group";
} | {
reason: "single_body";
} | {
reason: "hole_has_no_parts";
} | {
reason: "cut_removed_nothing";
} | {
reason: "geometry_failed";
message: string;
status: number;
} | {
reason: "cad_refused";
message: string;
status: number;
} | {
reason: "cad_failed";
} | {
reason: "interference_refused";
refusal: InterferenceRefusal;
}
/** The `kind` asked for is not one that can be built from parameters. */
| {
reason: "unsupported_kind";
index: number;
kinds: string[];
}
/** The request is malformed in a way only the request itself can explain. */
| {
reason: "invalid_shape_request";
message: string;
index?: number;
}
/** A revolve or a thread was described but could not be swept. */
| {
reason: "sweep_failed";
message: string;
index?: number;
}
/**
* The change named fields this shape has no use for.
*
* `because` is the three different things that can mean, which the callers
* word differently: a parameter no shape of that kind is built from, a sweep
* field on something that has no sweep, and a sweep that cannot be rebuilt
* because its outline was drawn rather than described.
*/
| {
reason: "unapplicable_fields";
kind: string;
fields: string[];
because: "not_this_kind" | "no_sweep" | "outline_not_described";
}
/** Align needs two shapes, distribute three; one shape is already arranged. */
| {
reason: "selection_too_small";
needed: number;
given: number;
}
/** Every shape sits at the same place, so there is no axis to spread along. */
| {
reason: "no_distribute_axis";
}
/** A row with no step, or a ring with no sweep: every copy would land on the original. */
| {
reason: "pattern_has_no_step";
kind: PatternKind;
}
/** Nothing here can read that file. */
| {
reason: "import_unsupported";
fileName: string;
formats: string[];
}
/** The file was read and could not be understood. */
| {
reason: "import_failed";
fileName: string;
message: string;
};EngineResult
type
export type EngineResult<T> = {
ok: true;
value: T;
} | {
ok: false;
failure: EngineFailure;
};EXACT_SOLID_KINDS
value
EXACT_SOLID_KINDS: readonly ["box", "cylinder", "cone", "sphere", "halfSphere", "loft", "polygon", "tube", "ring", "roof", "roundRoof", "wedge", "pyramid", "torus"]exactSolidForShape
function
export declare function exactSolidForShape(cad: OcctKernel, shape: WorkplaneShape): ShapeHandle;explodeStepAssembly
function
export declare function explodeStepAssembly(shape: WorkplaneShape, source: ProjectAsset): Promise<WorkplaneShape[]>;exportProjectScene
function
export declare function exportProjectScene(document: ProjectDocument, options: ProjectExportOptions): Promise<ProjectExportArtifact>;exportShapesToStep
function
export declare function exportShapesToStep(shapes: WorkplaneShape[], options?: StepExportOptions): Promise<StepExportResult>;exportSkfProject
function
export declare function exportSkfProject(input: SkfProjectExportInput): Promise<Uint8Array<ArrayBufferLike>>;FACE_DIRECTION_NAMES
value
FACE_DIRECTION_NAMES: FaceDirection[]footprintCenter
function
export declare function footprintCenter(bounds: ShapeBounds): {
x: number;
z: number;
};IMPORTABLE_MESH_FORMATS
value
IMPORTABLE_MESH_FORMATS: readonly ["stl", "obj", "svg"]importableMeshFormat
function
export declare function importableMeshFormat(fileName: string): ImportableMeshFormat | null;ImportableMeshFormat
type
export type ImportableMeshFormat = (typeof IMPORTABLE_MESH_FORMATS)[number];ImportedMesh
type
export type ImportedMesh = {
shape: WorkplaneShape;
asset: ProjectAsset;
};importedMeshFromFile
function
export declare function importedMeshFromFile(fileName: string, bytes: Uint8Array, mediaType?: string): Promise<ImportedMesh>;importSkfProject
function
export declare function importSkfProject(input: ArrayBuffer | Uint8Array, options?: ImportSkfOptions): Promise<SkfRestoredProject>;inspectSkfProjectPackage
function
export declare function inspectSkfProjectPackage(input: ArrayBuffer | Uint8Array): Promise<SkfProjectPackageSummary>;InterferencePair
type
export type InterferencePair = {
a: {
id: string;
name: string;
};
b: {
id: string;
name: string;
};
/** Exact OCCT minimum surface distance in mm. */
gap: number;
/** Exact common volume in mm^3; zero when separated or touching. */
overlapVolume: number;
/** Imported triangle meshes remain tessellated inputs to the exact kernel solver. */
precision: "exact" | "tessellated";
};InterferenceRefusal
type
export type InterferenceRefusal = {
reason: "invalid_clearance";
} | {
reason: "too_many_shapes";
limit: number;
given: number;
} | {
reason: "too_many_candidates";
limit: number;
given: number;
};InterferenceReport
type
export type InterferenceReport = {
shapesChecked: number;
candidatePairsChecked: number;
clearance: number;
method: typeof INTERFERENCE_METHOD;
pairs: InterferencePair[];
};InterferenceRequest
type
export type InterferenceRequest = {
ids?: readonly string[];
clearance?: number;
};linearPatternPlacements
function
export declare function linearPatternPlacements(request: LinearPatternRequest): PatternPlacement[];LinearPatternRequest
type
export type LinearPatternRequest = {
/** Total copies including the original, so 1 would be a no-op. */
count: number;
/** Centre-to-centre step along each axis, in mm. */
stepX?: number;
stepZ?: number;
};MAX_EXPLODE_SOLIDS
value
MAX_EXPLODE_SOLIDS = 200MAX_EXPLODE_SOURCE_BYTES
value
MAX_EXPLODE_SOURCE_BYTES: numberMAX_INTERFERENCE_CANDIDATES
value
MAX_INTERFERENCE_CANDIDATES = 512MAX_INTERFERENCE_SHAPES
value
MAX_INTERFERENCE_SHAPES = 128MAX_PATTERN_COUNT
value
MAX_PATTERN_COUNT = 200MeasurementEndRef
type
export type MeasurementEndRef = {
shapeId: string;
entity: MeasurementEntityKind | "shape";
index?: number;
};MeasurementEntityKind
type
export type MeasurementEntityKind = "edge" | "face";MeasurementUnavailableCode
type
export type MeasurementUnavailableCode = RadiusUnavailableCode | AngleUnavailableCode;MeshImportRequest
type
export type MeshImportRequest = {
/** Chooses the importer, names the asset, and for an STL decides which way is up. */
fileName: string;
bytes: Uint8Array;
/** The media type to record on the asset; the format's own default otherwise. */
mediaType?: string;
};meshProjectShapes
function
export declare function meshProjectShapes(shapes: readonly WorkplaneShape[]): Promise<MeshData[]>;MIN_PATTERN_COUNT
value
MIN_PATTERN_COUNT = 2mirrorShapes
function
export declare function mirrorShapes(shapes: WorkplaneShape[], selectedIds: string[], axis: "x" | "y" | "z"): {
nextShapes: WorkplaneShape[];
moved: number;
};ParsedRevolveRequest
type
export type ParsedRevolveRequest = {
ok: true;
profile: SketchProfile;
settings: SketchRevolveSettings;
} | {
ok: false;
error: string;
};parseProjectionLayout
function
export declare function parseProjectionLayout(value: unknown): ProjectionLayout | null;parseRevolveRequest
function
export declare function parseRevolveRequest(request: Record<string, unknown>): ParsedRevolveRequest;PatternKind
type
export type PatternKind = "linear" | "circular";PatternPlacement
type
export type PatternPlacement = {
/** Which copy this is, counting the original as 0. */
index: number;
/** Offset from the original, in workplane coordinates. */
dx: number;
dz: number;
/** Extra turn about the vertical axis, in degrees. */
rotation: number;
};PatternRequest
type
export type PatternRequest = {
ids: string[];
kind: PatternKind;
/** Total copies including the original, so 4 adds 3. Clamped to 2-200. */
count: number;
/** `linear`: centre-to-centre step along each axis, in mm. A pitch, not a gap. */
stepX?: number;
stepZ?: number;
/** `circular`: the point to turn about. */
centerX?: number;
centerZ?: number;
/** `circular`: how far round to spread the copies, in degrees. 360 closes the ring. */
sweepAngle?: number;
/** `circular`: whether each copy turns to follow the ring. On unless set false. */
rotateCopies?: boolean;
};placeRevolveOnAxis
function
export declare function placeRevolveOnAxis<T extends WorkplaneShape>(shape: T, axis: RevolveAxis): T;PrimitiveGeometryOptions
type
export type PrimitiveGeometryOptions = {
/**
* Keep the index buffer.
*
* The viewport flattens every indexed primitive with `.toNonIndexed()`; the
* boolean path kept the index, because its mesh conversion flattens later and
* on its own terms. `false` is the default so the viewport's call sites read
* as they did.
*
* No effect on `createHollowCylinderGeometry` or `createHalfSphereGeometry`,
* which build raw triangle soup and have no index either way.
*/
indexed?: boolean;
/**
* How a half-sphere gets its normals.
*
* `"analytic"` is the viewport's: an ellipsoid normal per dome vertex and a
* flat `(0, -1, 0)` across the bottom cap. `"computed"` is the boolean path's
* `computeVertexNormals()`, which averages the face normals and so rounds the
* hard rim between the dome and its cap.
*
* Defaults to `"analytic"`, the viewport's behaviour.
*/
halfSphereNormals?: "analytic" | "computed";
};PROJECT_EXPORT_FORMATS
value
PROJECT_EXPORT_FORMATS: readonly ["stl", "obj", "3mf", "step", "skf", "zip", "svg", "dxf"]ProjectDocument
type
export type ProjectDocument = {
metadata: ProjectMetadata;
projectName: string;
createdAt: number;
shapes: WorkplaneShape[];
history: EditorHistoryEntry[];
historyIndex: number;
assets: ProjectAsset[];
workspace: WorkplaneWorkspaceSettings;
snapGrid: GridSize;
placementElevation: number;
placementWorkplane: PlacementWorkplane;
sketchPlacementWorkplane: PlacementWorkplane;
};ProjectExportArtifact
type
export type ProjectExportArtifact = {
format: ProjectExportFormat;
filename: string;
mimeType: string;
data: Uint8Array;
shapeCount: number;
exportedCount?: number;
skipped?: Array<{
name: string;
kind: string;
reason: string;
}>;
};ProjectExportFormat
type
export type ProjectExportFormat = (typeof PROJECT_EXPORT_FORMATS)[number];ProjectExportOptions
type
export type ProjectExportOptions = {
format: ProjectExportFormat;
shapeIds?: string[];
name?: string;
/**
* What an SVG shows: one of the kernel's named views, or the four-view grid
* (the default). Meaningless for every other format, and the route refuses
* it there rather than ignoring it.
*/
view?: ProjectionLayout;
/** Section contours for a named drawing-coordinate plane; SVG or DXF. */
section?: SectionOptions;
/**
* Crease angle in degrees for mesh shapes in an SVG drawing: only edges
* whose triangles meet at more than this are drawn, besides boundaries and
* silhouettes. SVG projection only.
*/
featureAngle?: number;
};PROJECTION_LAYOUTS
value
PROJECTION_LAYOUTS: readonly ["multiview", "front", "back", "top", "bottom", "left", "right", "iso"]PROJECTION_VIEWS
value
PROJECTION_VIEWS: readonly ["front", "back", "top", "bottom", "left", "right", "iso"]ProjectionLayout
type
export type ProjectionLayout = (typeof PROJECTION_LAYOUTS)[number];projectionLayoutForCaptureFace
function
export declare function projectionLayoutForCaptureFace(face: unknown): ProjectionLayout;ProjectionView
type
export type ProjectionView = (typeof PROJECTION_VIEWS)[number];ProjectMetadata
type
export type ProjectMetadata = Record<string, unknown>;ProjectRead
type
export type ProjectRead = {
projectId: string;
name: string;
createdAt: number;
revision: number;
shapes: WorkplaneShape[];
snapGrid: ProjectDocument["snapGrid"];
workspace: ProjectDocument["workspace"];
};ProjectStore
type
export type ProjectStore = {
/** The project's metadata and shapes, or null when it is not there. */
read(projectId: string): Promise<ProjectDocument | null>;
/** Store a new shape list, advancing the revision the way the editor does. */
write(projectId: string, document: ProjectDocument, shapes: WorkplaneShape[]): Promise<{
revision: number;
}>;
/**
* Run `work` holding the project's lock, or report the project busy.
*
* `result` is present exactly when `busy` is false. It is optional in the
* type because there is nothing to return when the lock was not taken.
*/
withLock<T>(projectId: string, work: () => Promise<T>): Promise<{
busy: boolean;
result?: T;
}>;
/** Every project the store holds, newest first. */
list(): Promise<ServerProjectRecord[]>;
};putGeometryOnBase
function
export declare function putGeometryOnBase(geometry: THREE.BufferGeometry): THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;RadiusUnavailableCode
type
export type RadiusUnavailableCode = "notCircular" | "ellipseHasNoSingleRadius" | "degenerateCurve" | "notCurved" | "radiusVariesOverSurface" | "radiusNotReportedByKernel" | "degenerateSurface";rebuiltRevolveShape
function
export declare function rebuiltRevolveShape(runtime: ManifoldToplevel, shape: WorkplaneShape, parsed: {
profile: SketchProfile;
settings: SketchRevolveSettings;
}): WorkplaneShape;recoveredRevolveAxis
function
export declare function recoveredRevolveAxis(runtime: ManifoldToplevel, shape: WorkplaneShape): RevolveAxis;renderSectionDxf
function
export declare function renderSectionDxf(drawing: SectionDrawing): string;renderSectionSvg
function
export declare function renderSectionSvg(drawing: SectionDrawing, bounds: {
minU: number;
maxU: number;
minV: number;
maxV: number;
}): string;reportedRevolveAxis
function
export declare function reportedRevolveAxis(shape: WorkplaneShape): RevolveAxis | null;REQUESTABLE_SHAPE_KINDS
value
REQUESTABLE_SHAPE_KINDS: readonly ["box", "cube", "cylinder", "cone", "sphere", "halfSphere", "torus", "tube", "ring", "polygon", "pyramid", "roof", "roundRoof", "wedge", "icosahedron", "text", "loft", "gear"]RequestableShapeKind
type
export type RequestableShapeKind = (typeof REQUESTABLE_SHAPE_KINDS)[number];resolveThreadRequest
function
export declare function resolveThreadRequest(request: ThreadRequest): ResolvedThreadRequest | {
error: string;
};RevolveAxis
type
export type RevolveAxis = {
x: number;
z: number;
};revolveAxisPosition
function
export declare function revolveAxisPosition(shape: WorkplaneShape): RevolveAxis | null;revolvedShapeFromRequest
function
export declare function revolvedShapeFromRequest(runtime: ManifoldToplevel, parsed: {
profile: SketchProfile;
settings: SketchRevolveSettings;
}, base: {
name?: string;
color?: string;
x?: number;
z?: number;
elevation?: number;
hole?: boolean;
rotation?: number;
}): {
id: string;
name: string;
kind: import("./domain/sketchforge.js").ShapeKind;
color: string;
material?: string;
appearance?: import("./domain/sketchforge.js").ShapeAppearance;
faceIds?: string[];
faceColors?: Record<string, string>;
stepAssembly?: import("./domain/sketchforge.js").StepAssemblyNode[];
stepComponent?: import("./domain/sketchforge.js").StepComponent;
hole?: boolean;
x: number;
z: number;
elevation?: number;
size: number;
width: number;
depth: number;
height: number;
rotation: number;
rotationX?: number;
rotationZ?: number;
mirrorX?: boolean;
mirrorY?: boolean;
mirrorZ?: boolean;
radius?: number;
steps?: number;
sides?: number;
bevel?: number;
segments?: number;
topRadius?: number;
baseRadius?: number;
taperTopWidth?: number;
taperTopDepth?: number;
taperBottomWidth?: number;
taperBottomDepth?: number;
taperTopScale?: number;
taperBottomScale?: number;
teeth?: number;
toothSize?: number;
toothWidth?: number;
centerHoleSize?: number;
gearType?: import("./domain/sketchforge.js").GearType;
helixAngle?: number;
helixQuality?: number;
loftBottomShape?: import("./domain/sketchforge.js").LoftProfileShape;
loftTopShape?: import("./domain/sketchforge.js").LoftProfileShape;
loftTopWidth?: number;
loftTopDepth?: number;
loftBottomRotation?: number;
loftTopRotation?: number;
loftSegments?: number;
loftLayers?: number;
text?: string;
font?: string;
importedMesh?: {
positions: number[];
normals?: number[];
baseWidth: number;
baseDepth: number;
baseHeight: number;
triangleCount: number;
sourceFormat: "stl" | "obj" | "svg" | "json" | "step";
faceGroups?: number[];
storageResourceId?: string;
assetId?: string;
brepStep?: string;
};
imagePlate?: {
dataUrl: string;
mimeType: string;
pixelWidth: number;
pixelHeight: number;
};
sketchProfile?: SketchProfile;
sketchOperation?: import("./domain/sketchforge.js").SketchOperation;
sketchRevolve?: SketchRevolveSettings;
revolveAxisOffset?: {
x: number;
z: number;
};
draftPrismAngle?: number;
draftPrismSourceHeight?: number;
draftPrismSourceFrame?: import("./domain/sketchforge.js").CadBrepFrame;
faceDraft?: import("./domain/sketchforge.js").SketchFaceDraft;
faceDraftSourceFaceIds?: string[];
faceDraftSourceSegmentId?: string;
faceDraftSourceFrame?: import("./domain/sketchforge.js").CadBrepFrame;
faceDraftSourceScale?: {
width: number;
depth: number;
height: number;
};
edgeTreatments?: import("./domain/sketchforge.js").EdgeTreatmentFeature[];
edgeTreatmentHistory?: import("./domain/sketchforge.js").EdgeTreatmentHistoryEntry[];
shell?: {
thickness: number;
openFaces?: Array<number | string>;
};
cadDisplayEdges?: import("./domain/sketchforge.js").CadDisplayEdge[];
cadDisplayEdgesVersion?: 2;
edgeResizeMode?: "scale" | "preserve";
cadBrep?: string;
cadBrepFrame?: import("./domain/sketchforge.js").CadBrepFrame;
cadPrimitiveFrame?: import("./domain/sketchforge.js").CadPrimitiveFrame;
groupedShapes?: WorkplaneShape[];
groupedBaseWidth?: number;
groupedBaseDepth?: number;
groupedBaseHeight?: number;
groupOperation?: "group" | "intersection";
locked?: boolean;
hidden?: boolean;
sketchSourceId: string;
};SECTION_PLANES
value
SECTION_PLANES: readonly ["xy", "xz", "yz"]SectionDrawing
type
export type SectionDrawing = {
plane: SectionPlane;
offset: number;
/** Section contours in model units as [u0, v0, u1, v1, ...]. */
contours: number[][];
};SectionOptions
type
export type SectionOptions = {
plane: SectionPlane;
offset: number;
};SectionPlane
type
export type SectionPlane = (typeof SECTION_PLANES)[number];sectionShapesToDxf
function
export declare function sectionShapesToDxf(shapes: readonly WorkplaneShape[], options: SectionOptions): Promise<string>;sectionShapesToSvg
function
export declare function sectionShapesToSvg(shapes: readonly WorkplaneShape[], options: SectionOptions): Promise<string>;ServerCadEdge
type
export type ServerCadEdge = {
index: number;
length: number;
curveType: string;
midpoint: {
x: number;
y: number;
z: number;
};
/**
* Whether this edge is one a fillet or chamfer can act on.
*
* An edge between two faces can be rounded. A seam -- where one curved
* surface meets itself, as on a cylinder's side or around a torus -- has no
* two faces to blend, and OCCT refuses it.
*/
filletable: boolean;
};ServerCadError
class
export declare class ServerCadError extends Error {
readonly status: number;
constructor(message: string, status?: number);
}ServerCadFace
type
export type ServerCadFace = CadShellFace & {
/** App-owned identity, stable across listings and persisted when referenced. */
id: string;
};ServerCadMeasurement
type
export type ServerCadMeasurement = {
entity: MeasurementEntityKind;
/** The same index `GET /edges` and `GET /faces` give this entity. */
index: number;
/** As OCCT names it: `line`, `circle`, `bspline` for an edge; `plane`, `cylinder` for a face. */
geometryType: string;
/** Edge length in mm, arcs measured along the curve. Null for a face. */
length: number | null;
/** Face area in mm^2. Null for an edge. */
area: number | null;
radius: number | null;
diameter: number | null;
/** Degrees a circular edge runs through; a full circle is 360. Null otherwise. */
sweepDegrees: number | null;
/** Why there is no radius. Null when one is reported. */
radiusUnavailable: RadiusUnavailableCode | null;
};ServerCadMeasurementPair
type
export type ServerCadMeasurementPair = {
/** Exact minimum distance between the two entities, in mm. Zero when they touch. */
distance: number;
/** Angle between two planar faces' outward normals, in degrees. Null otherwise. */
angleDegrees: number | null;
/** Why there is no angle. Null when one is reported. */
angleUnavailable: AngleUnavailableCode | null;
};ServerCadResult
type
export type ServerCadResult = {
brep: string;
positions: number[];
normals: number[] | null;
triangleCount: number;
faceIds?: string[];
faceGroups?: number[];
};ServerCadShapeProperties
type
export type ServerCadShapeProperties = {
/** Volume in mm^3. */
volume: number;
/** Surface area in mm^2. */
area: number;
/** Center of mass in project coordinates, in mm. */
centerOfMass: {
x: number;
y: number;
z: number;
};
/** Axis-aligned bounds in project coordinates, in mm. */
bbox: {
xmin: number;
ymin: number;
zmin: number;
xmax: number;
ymax: number;
zmax: number;
};
/**
* The kernel's validity check. A mesh measured from its triangles is always
* valid: one that is not closed is sent to the kernel instead.
*/
isValid: boolean;
provenance: ShapeGeometryProvenance;
};ServerCadShellRequest
type
export type ServerCadShellRequest = {
/** Wall thickness in mm, measured inwards from the surface. */
thickness: number;
/** Faces to leave open, as direction names or indexes from the face listing. */
openFaces?: ReadonlyArray<number | string>;
};ServerCadTreatment
type
export type ServerCadTreatment = {
kind: "fillet" | "chamfer";
amount: number;
/** Chamfers only; 45 degrees is a symmetric chamfer. */
angle?: number;
/** Edge indexes from `shapeEdges`, or every edge when omitted. */
edges?: number[];
};shapeBounds
function
export declare function shapeBounds(shape: WorkplaneShape): ShapeBounds;ShapeBounds
type
export type ShapeBounds = {
minX: number;
maxX: number;
minY: number;
maxY: number;
minZ: number;
maxZ: number;
};ShapeChangeResult
type
export type ShapeChangeResult = {
ok: true;
shape: WorkplaneShape;
} | {
ok: false;
unapplicable: string[];
};shapeFromRequest
function
export declare function shapeFromRequest(request: ShapeRequest, defaults?: {
elevation?: number;
}): WorkplaneShape | null;ShapeGeometryProvenance
type
export type ShapeGeometryProvenance = {
/** Which stored representation supplied the geometry that was measured. */
source: "parametric" | "brep" | "mesh";
/** Imported triangle meshes remain tessellated even after sewing into a solid. */
precision: "exact" | "tessellated";
};ShapeRemoved
type
export type ShapeRemoved = {
id: string;
revision: number;
};ShapeRequest
type
export type ShapeRequest = Record<string, unknown>;ShapesArranged
type
export type ShapesArranged = {
shapes: WorkplaneShape[];
moved: number;
revision: number;
};ShapesWritten
type
export type ShapesWritten = {
shapes: WorkplaneShape[];
revision: number;
};shapeWithRequestedChanges
function
export declare function shapeWithRequestedChanges(shape: WorkplaneShape, request: ShapeRequest): ShapeChangeResult;ShapeWritten
type
export type ShapeWritten = {
shape: WorkplaneShape;
revision: number;
};SKF_FORMAT_VERSION
value
SKF_FORMAT_VERSION = 2SKF_MEDIA_TYPE
value
SKF_MEDIA_TYPE = "application/vnd.sketchforge.project+zip"SkfProjectExportInput
type
export type SkfProjectExportInput = {
projectId?: string | null;
projectName: string;
createdAt: number;
modifiedAt: number;
shapes: WorkplaneShape[];
history: EditorHistoryEntry[];
historyIndex: number;
assets: ProjectAsset[];
workspace: WorkplaneWorkspaceSettings;
snapGrid: GridSize;
placementElevation: number;
placementWorkplane?: PlacementWorkplane;
sketchPlacementWorkplane?: PlacementWorkplane;
compressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
};SkfRestoredProject
type
export type SkfRestoredProject = {
sourceProjectId?: string;
projectName: string;
createdAt: number;
modifiedAt: number;
shapes: WorkplaneShape[];
history: EditorHistoryEntry[];
historyIndex: number;
assets: ProjectAsset[];
workspace: WorkplaneWorkspaceSettings;
snapGrid: GridSize;
placementElevation: number;
placementWorkplane: PlacementWorkplane;
sketchPlacementWorkplane: PlacementWorkplane;
migratedFromVersion?: number;
};StepExportResult
type
export type StepExportResult = {
blob: Blob;
exportedCount: number;
skipped: SkippedShape[];
};suggestedLinearStep
function
export declare function suggestedLinearStep(extent: number): number;TriangleFace
type
export type TriangleFace = readonly [number, number, number];UnbuildableShapeError
class
export declare class UnbuildableShapeError extends Error {
constructor(message: string);
}wallThickness
function
export declare function wallThickness(shape: WorkplaneShape): Promise<WallThicknessResult>;WallThicknessResult
type
export type WallThicknessResult = {
minimum: number | null;
unit: "mm";
method: "sampled-opposing-surface-distance";
samplesPerFace: number;
facesChecked: number;
};widestDistributeAxis
function
export declare function widestDistributeAxis(entries: Array<{
x: DistributeEntry;
z: DistributeEntry;
}>): "x" | "z" | null;withHoleMode
function
export declare function withHoleMode(shape: WorkplaneShape, hole: boolean, parentColor?: string): WorkplaneShape;Documentation version: 1.30.0 · Repository revision: 1cb9fee8dff4d394684c229dd67a21da539d167f · View source