Appearance
Update: Contour
Contour editing — produce NEW contours from an existing one. A contour is an outer ProfileHandle plus zero or more inner profiles that punch holes in it. Every method here is an immutable derive-new operation: it takes an opaque ContourHandle (plus any extra inputs) and returns a fresh ContourHandle for the resulting contour. The input contour is never mutated — the original handle keeps referring to the unchanged contour. Read the resulting geometry back as plain values with the query namespace. Accessed via snaptrude.core.geom.update.contour.
Functions
offset(contour, distance)
Offset a contour inward/outward by a signed distance. Immutable — returns a NEW contour and leaves the input unchanged.
- Parameters:
contour:ContourHandle— The contour to offsetdistance:number— Signed offset distance (outward when positive, inward when negative)
- Returns:
ContourHandle— The offset contour as a NEW handle
ts
// Shrink a contour inward by 0.5 Snaptrude units
const inset = await snaptrude.core.geom.update.contour.offset(contour, -0.5);move(contour, translation)
Translate a contour by a vector. Immutable — returns a NEW contour and leaves the input unchanged.
- Parameters:
contour:ContourHandle— The contour to movetranslation:Vec3Handle— Translation vector to move the contour by
- Returns:
ContourHandle— The moved contour as a NEW handle
ts
const translation = await snaptrude.core.math.vec3.new(2, 0, 0);
const moved = await snaptrude.core.geom.update.contour.move(contour, translation);rotate(contour, axis, angle, pivot?)
Rotate a contour about an axis through an optional pivot. Immutable — returns a NEW contour and leaves the input unchanged.
- Parameters:
contour:ContourHandle— The contour to rotateaxis:Vec3Handle— Rotation axis directionangle:number— Rotation angle in radianspivot:Vec3Handle(optional) — Pivot point to rotate about (defaults to the origin)
- Returns:
ContourHandle— The rotated contour as a NEW handle
scale(contour, factor, pivot?)
Scale a contour uniformly or per-axis about an optional pivot. Immutable — returns a NEW contour and leaves the input unchanged.
- Parameters:
contour:ContourHandle— The contour to scalefactor: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:
ContourHandle— The scaled contour as a NEW handle
mirror(contour, plane)
Mirror a contour across a plane. Immutable — returns a NEW contour and leaves the input unchanged.
- Parameters:
contour:ContourHandle— The contour to mirrorplane:{ point: Vec3Handle, normal: Vec3Handle }— Mirror plane defined by a point on it and its normal
- Returns:
ContourHandle— The mirrored contour as a NEW handle
addHole(contour, hole)
Add a hole to a contour by appending an inner profile. Immutable — returns a NEW contour and leaves the input unchanged.
- Parameters:
contour:ContourHandle— The contour to add a hole tohole:ProfileHandle— The inner profile to add as a hole
- Returns:
ContourHandle— The contour with the added hole as a NEW handle
ts
const withHole = await snaptrude.core.geom.update.contour.addHole(contour, innerProfile);removeHole(contour, index)
Remove a hole from a contour by inner-profile index. Immutable — returns a NEW contour and leaves the input unchanged.
- Parameters:
contour:ContourHandle— The contour to remove a hole fromindex:number— Zero-based index of the inner profile (hole) to remove
- Returns:
ContourHandle— The contour with the hole removed as a NEW handle
Errors
Failed calls reject with a typed PluginError — see Error Handling. Conditions specific to this namespace:
| Code | Thrown by | When | details |
|---|---|---|---|
OPERATION_FAILED | offset | The engine could not offset — a profile is open, or the outer profile or a hole collapses/self-intersects at that distance | handles; the message carries the engine reason |
PRECONDITION_FAILED | removeHole | index is out of range for the contour's holes | handles, index, holeCount |
HANDLE_INVALID | all methods | The contour, profile, or point handle cannot be resolved | — |