Skip to content

Update: Profile

Profile editing — produce NEW profiles from an existing one. Every method here is an immutable derive-new operation: it takes an opaque ProfileHandle (plus any extra inputs) and returns a fresh ProfileHandle for the resulting profile. The input profile is never mutated — the original handle keeps referring to the unchanged profile. Read the resulting geometry back as plain values with the query namespace. Accessed via snaptrude.core.geom.update.profile.

Functions

offset(profile, distance)

Offset a closed profile inward/outward by a signed distance. Immutable — returns a NEW profile and leaves the input unchanged.

  • Parameters:
    • profile: ProfileHandle — The closed profile to offset
    • distance: number — Signed offset distance (outward when positive, inward when negative)
  • Returns: ProfileHandle — The offset profile as a NEW handle
ts
// Shrink a closed profile inward by 0.5 Snaptrude units
const inset = await snaptrude.core.geom.update.profile.offset(profile, -0.5);

move(profile, translation)

Translate a profile by a vector. Immutable — returns a NEW profile and leaves the input unchanged.

  • Parameters:
    • profile: ProfileHandle — The profile to move
    • translation: Vec3Handle — Translation vector to move the profile by
  • Returns: ProfileHandle — The moved profile as a NEW handle
ts
const translation = await snaptrude.core.math.vec3.new(2, 0, 0);
const moved = await snaptrude.core.geom.update.profile.move(profile, translation);

rotate(profile, axis, angle, pivot?)

Rotate a profile about an axis through an optional pivot. Immutable — returns a NEW profile and leaves the input unchanged.

  • Parameters:
    • profile: ProfileHandle — The profile to rotate
    • axis: Vec3Handle — Rotation axis direction
    • angle: number — Rotation angle in radians
    • pivot: Vec3Handle (optional) — Pivot point to rotate about (defaults to the origin)
  • Returns: ProfileHandle — The rotated profile as a NEW handle

scale(profile, factor, pivot?)

Scale a profile uniformly or per-axis about an optional pivot. Immutable — returns a NEW profile and leaves the input unchanged.

  • Parameters:
    • profile: ProfileHandle — The profile to scale
    • factor: number | Vec3Components — Uniform scale factor, or per-axis factors { x, y, z }
    • pivot: Vec3Handle (optional) — Pivot point to scale about (defaults to the origin)
  • Returns: ProfileHandle — The scaled profile as a NEW handle

mirror(profile, plane)

Mirror a profile across a plane. Immutable — returns a NEW profile and leaves the input unchanged.

  • Parameters:
    • profile: ProfileHandle — The profile to mirror
    • plane: { point: Vec3Handle, normal: Vec3Handle } — Mirror plane defined by a point on it and its normal
  • Returns: ProfileHandle — The mirrored profile as a NEW handle

add(profile, curve, position?)

Append a curve to the start or end of a profile. The curve must connect to the chosen end. Immutable — returns a NEW profile and leaves the input unchanged.

  • Parameters:
    • profile: ProfileHandle — The profile to append to
    • curve: CurveHandle — The curve to append; it must connect to the chosen end
    • position: "start" | "end" (optional) — End to append at (defaults to "end")
  • Returns: ProfileHandle — The extended profile as a NEW handle
ts
// `line` is a CurveHandle, e.g. from snaptrude.core.geom.create.line(...)
const extended = await snaptrude.core.geom.update.profile.add(profile, line, "end");

remove(profile, position?)

Remove the curve at the start or end of a profile. Immutable — returns a NEW profile and leaves the input unchanged.

  • Parameters:
    • profile: ProfileHandle — The profile to remove a curve from
    • position: "start" | "end" (optional) — End to remove from (defaults to "end")
  • Returns: ProfileHandle — The trimmed profile as a NEW handle

reverse(profile)

Reverse the orientation of a profile. Immutable — returns a NEW profile and leaves the input unchanged.

  • Parameters:
    • profile: ProfileHandle — The profile to reverse
  • Returns: ProfileHandle — The reversed profile as a NEW handle

simplify(profile)

Simplify a profile by merging collinear/redundant segments. Immutable — returns a NEW profile and leaves the input unchanged.

  • Parameters:
    • profile: ProfileHandle — The profile to simplify
  • Returns: ProfileHandle — The simplified profile as a NEW handle

Errors

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

CodeThrown byWhendetails
OPERATION_FAILEDoffsetThe engine could not offset — the profile is open, or the result collapses/self-intersectshandles; the message carries the engine reason
PRECONDITION_FAILEDaddThe curve does not share an endpoint with the profile at the chosen positionhandles (curve first), position
HANDLE_INVALIDall methodsThe profile, curve, or point handle cannot be resolved