Skip to content

Geometry Create

Curve creation — construct new geometric curves from point handles (all-handle model). Each method takes point handles (Vec3Handle) and returns an opaque curve handle (LineHandle or ArcHandle) that you pass to query, update, or entity-creation methods. Read geometry back as plain values via the snaptrude.core.geom.query.* methods. Accessed via snaptrude.core.geom.create.

Functions

line(startPoint, endPoint)

Create a straight line segment between two point handles. Host API call — returns a handle.

  • Parameters:
    • startPoint: Vec3Handle — Start point of the line segment
    • endPoint: Vec3Handle — End point of the line segment
  • Returns: LineHandle — The new line
ts
const line = await snaptrude.core.geom.create.line(startPoint, endPoint);

arc(startPoint, endPoint, centrePoint, axis)

Create a circular arc from its start, end, centre, and axis point handles. Host API call — returns a handle.

  • Parameters:
    • startPoint: Vec3Handle — Start point of the arc
    • endPoint: Vec3Handle — End point of the arc
    • centrePoint: Vec3Handle — Centre point of the arc
    • axis: Vec3Handle — Axis direction of the arc
  • Returns: ArcHandle — The new arc
ts
const arc = await snaptrude.core.geom.create.arc(startPoint, endPoint, centrePoint, axis);

circle(centrePoint, axis, radius)

Create a circle from a centre point, an axis (plane normal), and a radius. Host API call — returns a handle. A circle is a closed curve; read it back via snaptrude.core.geom.query.circle.*.

  • Parameters:
    • centrePoint: Vec3Handle — Centre point of the circle
    • axis: Vec3Handle — Axis direction (plane normal) of the circle
    • radius: number — Radius of the circle
  • Returns: CircleHandle — The new circle
ts
const circle = await snaptrude.core.geom.create.circle(centrePoint, axis, 2);

profileFromLinePoints(points)

Create a closed profile from an ordered list of point handles connected by line segments (last auto-connected to first). Host API call — returns a handle.

  • Parameters:
    • points: Vec3Handle[] — Ordered vertex handles of the profile
  • Returns: ProfileHandle — The new profile
ts
const profile = await snaptrude.core.geom.create.profileFromLinePoints(points);

profileFromCurves(curves)

Create a profile from an ordered list of curve handles forming a closed loop. Host API call — returns a handle.

  • Parameters:
    • curves: CurveHandle[] — Ordered curve handles forming a closed loop
  • Returns: ProfileHandle — The new profile
ts
const profile = await snaptrude.core.geom.create.profileFromCurves([line, arc]);

profileRect(width, depth, center?)

Create an axis-aligned rectangle profile (XZ plane) of width × depth, centred at center (default origin). Pair with design.create.space / design.create.spaces to author a rectangular (box) space.

  • Parameters:
    • width: number — Extent along X
    • depth: number — Extent along Z
    • center: Vec3Handle (optional, default origin) — Rectangle centre
  • Returns: ProfileHandle — The new rectangle profile
ts
const rect = await snaptrude.core.geom.create.profileRect(4, 3);
const contour = await snaptrude.core.geom.create.contourFromProfile(rect);
const space = await snaptrude.design.create.space(contour, 3);

contourFromProfile(outer)

Create a contour (an outer profile loop, no holes). Host API call — returns a handle.

ts
const contour = await snaptrude.core.geom.create.contourFromProfile(outer);

contourFromProfiles(outer, holes?)

Create a contour from an outer profile plus zero or more inner profiles (holes). Host API call — returns a handle.

  • Parameters:
    • outer: ProfileHandle — The outer boundary loop
    • holes: ProfileHandle[] (optional) — Optional inner hole loops
  • Returns: ContourHandle — The new contour
ts
const contour = await snaptrude.core.geom.create.contourFromProfiles(outer, [hole]);

Errors

Failed calls reject with a typed PluginError — see Error Handling. Conditions specific to this namespace:

CodeThrown byWhendetails
VALIDATIONprofileRectwidth or depth is not positivewidth, depth
HANDLE_INVALIDall methodsA point, curve, or profile handle cannot be resolved