Appearance
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.
| Property | Type | Description |
|---|---|---|
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 |
PluginGeomUpdateCurveSplitArgs
Arguments for split.
| Property | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to split |
point | Vec3Handle | Point on the curve to split at |
PluginGeomUpdateCurveTrimArgs
Arguments for trim.
| Property | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to trim |
startParam | number | Start parameter of the portion to keep |
endParam | number | End parameter of the portion to keep |
PluginGeomUpdateCurveOffsetArgs
Arguments for offset.
| Property | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to offset |
vector | Vec3Handle | Translation vector to offset the curve by |
PluginGeomUpdateCurveReverseArgs
Arguments for reverse.
| Property | Type | Description |
|---|---|---|
curve | CurveHandle | The 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 extenddistance:number— Distance to extend the curve byfromStart:boolean— Extend from the start end whentrue, 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 splitpoint: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 trimstartParam:number— Start parameter of the portion to keependParam: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 offsetvector: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:
| Code | Thrown by | When | details |
|---|---|---|---|
HANDLE_INVALID | all methods | The curve or point handle cannot be resolved | — |
These derive-new operations define no operation-specific failure codes of their own.