Appearance
Core
Core primitives and infrastructure used across the plugin API. Accessed via snaptrude.core.
Sub-namespaces
Math
Vector and quaternion math utilities. Accessed via snaptrude.core.math.
- Vec3 — 3D vector operations for positions, directions, and displacements (
snaptrude.core.math.vec3) - Quat — Quaternion operations for 3D rotations (
snaptrude.core.math.quat)
Geom
Geometry kernel — domain-free construction, query, editing, and disposal of curves (lines / arcs) and profiles (snaptrude.core.geom). No BIM/AEC knowledge lives here; geometry is built bottom-up from point handles (see Construction Pattern below).
snaptrude.core.geom.create— construct lines, arcs, and profilessnaptrude.core.geom.query— read curve / arc / profile geometry and relationshipssnaptrude.core.geom.update— derive new curves / profiles (immutable edits)snaptrude.core.geom.delete— free a transient profile resource handle
History
Undo / redo of committed history entries (snaptrude.core.history).
Units
Unit-type queries and conversion (snaptrude.core.units).
Zoom
Camera zoom controls — zoom to extents or to the current selection (snaptrude.core.zoom).
Project
Project-level settings and info — tolerance, snap controls, and grid controls (snaptrude.core.project).
Comment
Comments — create, edit, resolve, tag, and list scene/project comments (snaptrude.core.comment).
Project organization
The organizational structure of the active project.
- Buildings — the project's buildings and their storeys (
snaptrude.core.buildings) - Groups — the group hierarchy (
snaptrude.core.groups) - Layers — drawing/reference layers per storey (
snaptrude.core.layers) - Tags — the tag catalog and assignments (
snaptrude.core.tags)
Construction Pattern
Geometry is built bottom-up from opaque handles. Every step is an async host call — always await:
- Create point handles with
snaptrude.core.math.vec3.new(x, y, z)→Vec3Handle - Connect points into curves with
snaptrude.core.geom.create.line(startPoint, endPoint)/geom.create.arc(startPoint, endPoint, centrePoint, axis)→LineHandle/ArcHandle - Combine curves into a closed profile with
geom.create.profileFromCurves(curves)— or skip step 2 for straight-sided shapes withgeom.create.profileFromLinePoints(points)→ProfileHandle - Wrap the profile in a contour with
geom.create.contourFromProfile(profile)and pass it to thesnaptrude.design.create.*creators
ts
const { vec3 } = snaptrude.core.math;
const { create } = snaptrude.core.geom;
// 1. Points (Vec3Handles)
const points = [
await vec3.new(0, 0, 0),
await vec3.new(10, 0, 0),
await vec3.new(10, 0, 8),
await vec3.new(0, 0, 8)
];
// 2–3. Closed rectangular profile (line segments; last point auto-connects to first)
const profile = await create.profileFromLinePoints(points);
// 4. Extrude into an entity
const contour = await create.contourFromProfile(profile);
const spaceId = await snaptrude.design.create.space(contour, 3);