Skip to content

Query: Arc

Arc-specific geometry queries — read circular-arc properties as plain values. Accessed via snaptrude.core.geom.query.arc.

Every method takes an opaque ArcHandle and returns plain values (numbers or Vec3Components), never a handle. Use these to inspect the radius, centre, axis, sweep angle, and validity of an arc handle obtained from snaptrude.core.geom.arc or another query.

Types

Vec3Components

Plain-value record returned by point/vector reads (see Handles).

PropertyTypeDescription
xnumberX component
ynumberY component
znumberZ component

Functions

getRadius(arc)

Read the radius of an arc.

  • Parameters:
    • arc: ArcHandle — The arc to query
  • Returns: number — The arc radius, in Snaptrude units (convert with snaptrude.core.units.convert(value, from, to))
  • Throws: HandleInvalidError (code HANDLE_INVALID) if arc is not a valid ArcHandle
ts
const { arc: arcQuery } = snaptrude.core.geom.query;

// `arc` is an ArcHandle obtained from snaptrude.core.geom.arc
const radius = await arcQuery.getRadius(arc);
const centre = await arcQuery.getCentre(arc); // { x, y, z }

getCentre(arc)

Read the centre point of an arc.

  • Parameters:
    • arc: ArcHandle — The arc to query
  • Returns: Vec3Components — The arc centre as { x, y, z }, in Snaptrude units
  • Throws: HandleInvalidError (code HANDLE_INVALID) if arc is not a valid ArcHandle

getAxis(arc)

Read the rotation axis of an arc.

  • Parameters:
    • arc: ArcHandle — The arc to query
  • Returns: Vec3Components — The arc axis as { x, y, z }
  • Throws: HandleInvalidError (code HANDLE_INVALID) if arc is not a valid ArcHandle

getSweepAngle(arc)

Read the sweep angle of an arc (the angle subtended at its centre).

  • Parameters:
    • arc: ArcHandle — The arc to query
  • Returns: number — The sweep angle in radians
  • Throws: HandleInvalidError (code HANDLE_INVALID) if arc is not a valid ArcHandle

isValid(arc)

Check whether an arc is geometrically valid.

  • Parameters:
    • arc: ArcHandle — The arc to query
  • Returns: booleantrue if the arc is valid
  • Throws: HandleInvalidError (code HANDLE_INVALID) if arc is not a valid ArcHandle
ts
const valid = await snaptrude.core.geom.query.arc.isValid(arc);

Errors

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

CodeThrown byWhendetails
HANDLE_INVALIDall methodsThe arc handle is invalid, stale, or foreign

Beyond handle resolution these reads are total — they never throw for a resolvable arc; use isValid to test degenerate geometry.