Skip to content

Geometry

Geometry kernel — domain-free construction, query, editing, and disposal of curves (lines / arcs) and profiles. No BIM/AEC knowledge lives here; build geometry bottom-up: points (Vec3Handle) → curves → profiles → entities. Accessed via snaptrude.core.geom.

Sub-namespaces

Create

Construct lines, arcs, and profiles (snaptrude.core.geom.create). Each method takes point handles (Vec3Handle) and returns an opaque curve, profile, or contour handle.

Query

Read curve / arc / profile geometry and relationships (snaptrude.core.geom.query). Returns plain values / child handles; no query mutates its inputs.

  • Curve — shared line/arc queries + two-curve relationships (snaptrude.core.geom.query.curve)
  • Arc — arc-specific reads (snaptrude.core.geom.query.arc)
  • Circle — circle-specific reads (snaptrude.core.geom.query.circle)
  • Profile — profile reads (snaptrude.core.geom.query.profile)
  • Contour — contour reads (outer profile + holes) (snaptrude.core.geom.query.contour)
  • Brep — BREP mesh topology + geometry (snaptrude.core.geom.query.brep)
  • Face — BREP face reads (snaptrude.core.geom.query.face)
  • Edge — BREP edge reads (snaptrude.core.geom.query.edge)
  • HalfEdge — BREP half-edge walks (snaptrude.core.geom.query.halfedge)
  • Vertex — BREP vertex reads (snaptrude.core.geom.query.vertex)

Update

Derive new curves / profiles — immutable edits (snaptrude.core.geom.update). Inputs are never mutated; every method returns a fresh handle.

  • Curve — extend, split, trim, offset, reverse (snaptrude.core.geom.update.curve)
  • Profile — offset, affine, add/remove/reverse/simplify (snaptrude.core.geom.update.profile)
  • Contour — offset, affine, addHole/removeHole (snaptrude.core.geom.update.contour)

Delete

Free a transient profile or contour resource handle (snaptrude.core.geom.delete). Handle-lifecycle only — reclaims the handle's share of the plugin's resource quota; it does not tear down any engine-side geometry.

Construction Pattern

Geometry is built bottom-up:

  1. Create points with await snaptrude.core.math.vec3.new(x, y, z)
  2. Connect points into lines or arcs with snaptrude.core.geom.create.*
  3. Combine curves into a closed profile
  4. Wrap the profile in a contour (contourFromProfile) and pass it to the creators on snaptrude.design.create, e.g. design.create.space
ts
const a = await snaptrude.core.math.vec3.new(0, 0, 0);
const b = await snaptrude.core.math.vec3.new(10, 0, 0);
const c = await snaptrude.core.math.vec3.new(10, 10, 0);

const profile = await snaptrude.core.geom.create.profileFromLinePoints([a, b, c]);
const perimeter = await snaptrude.core.geom.query.profile.getPerimeter(profile);
await snaptrude.core.geom.delete.profile(profile);