Skip to content

Update: Curve

Curve editing — produce new curves from an existing one. Every method takes an opaque CurveHandle and returns a fresh handle (or handles) for the resulting geometry; the input curve is never mutated. Read the resulting geometry back as plain values with the query namespace. Accessed via snaptrude.core.geom.update.curve.

Types

PluginGeomUpdateCurveExtendArgs

Arguments for extend.

PropertyTypeDescription
curveCurveHandleThe curve to extend
distancenumberDistance to extend the curve by
fromStartbooleanExtend from the start end when true, otherwise from the end

PluginGeomUpdateCurveSplitArgs

Arguments for split.

PropertyTypeDescription
curveCurveHandleThe curve to split
pointVec3HandlePoint on the curve to split at

PluginGeomUpdateCurveTrimArgs

Arguments for trim.

PropertyTypeDescription
curveCurveHandleThe curve to trim
startParamnumberStart parameter of the portion to keep
endParamnumberEnd parameter of the portion to keep

PluginGeomUpdateCurveOffsetArgs

Arguments for offset.

PropertyTypeDescription
curveCurveHandleThe curve to offset
vectorVec3HandleTranslation vector to offset the curve by

PluginGeomUpdateCurveReverseArgs

Arguments for reverse.

PropertyTypeDescription
curveCurveHandleThe curve to reverse

Functions

extend(curve, distance, fromStart)

Extend a curve by a distance from one of its ends. Host API call — returns a handle.

  • Parameters:
    • curve: CurveHandle — The curve to extend
    • distance: number — Distance to extend the curve by
    • fromStart: boolean — Extend from the start end when true, otherwise from the end
  • Returns: CurveHandle — The extended curve
ts
const { vec3 } = snaptrude.core.math;

const startPoint = await vec3.new(0, 0, 0);
const endPoint = await vec3.new(10, 0, 0);
const line = await snaptrude.core.geom.create.line(startPoint, endPoint);

// Extend the line by 2 units past its end point
const longer = await snaptrude.core.geom.update.curve.extend(line, 2, false);

split(curve, point)

Split a curve at a point into separate segments. Host API call — returns handles.

  • Parameters:
    • curve: CurveHandle — The curve to split
    • point: Vec3Handle — Point on the curve to split at
  • Returns: CurveHandle[] — The resulting segments
ts
const mid = await snaptrude.core.math.vec3.new(5, 0, 0);
const segments = await snaptrude.core.geom.update.curve.split(line, mid);

trim(curve, startParam, endParam)

Trim a curve to the portion between two parameter values. Host API call — returns a handle.

  • Parameters:
    • curve: CurveHandle — The curve to trim
    • startParam: number — Start parameter of the portion to keep
    • endParam: number — End parameter of the portion to keep
  • Returns: CurveHandle — The trimmed curve

offset(curve, vector)

Offset a curve by a translation vector. Host API call — returns a handle.

  • Parameters:
    • curve: CurveHandle — The curve to offset
    • vector: Vec3Handle — Translation vector to offset the curve by
  • Returns: CurveHandle — The offset curve

reverse(curve)

Reverse the direction of a curve. Host API call — returns a handle.

  • Parameters:
    • curve: CurveHandle — The curve to reverse
  • Returns: CurveHandle — The reversed curve

Errors

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

CodeThrown byWhendetails
HANDLE_INVALIDall methodsThe curve or point handle cannot be resolved

These derive-new operations define no operation-specific failure codes of their own.