Skip to content

Project

Project-level settings and info. Currently exposes settings — project tolerance, snap controls (dimension / angle / parallel / normal / magnetic), and grid controls. Accessed via snaptrude.core.project.

  • snaptrude.core.project.settings — tolerance, snaps, and grid.
  • snaptrude.core.project.settings.snaps — snap controls. Dimension and angle snaps each have a numeric threshold plus an on/off toggle; parallel, normal, and magnetic snaps are on/off only. (normal is the perpendicular snap.)
  • snaptrude.core.project.settings.grid — grid controls (the visual snap-to grid).

Types

PluginToleranceArgs

Arguments for settings.setTolerance.

PropertyTypeDescription
valuenumberTarget tolerance magnitude; snaps to the nearest allowed option

PluginSnapValueArgs

Arguments for the snap-threshold setters (snaps.setDimension / snaps.setAngle).

PropertyTypeDescription
valuenumberThe snap threshold (distance, or degrees for angle)

PluginGridValueArgs

Arguments for grid.setValue.

PropertyTypeDescription
valuenumberThe grid cell value

Functions

settings.getTolerance()

Get the project tolerance as a numeric magnitude. The engine stores tolerance as a discrete per-unit precision option; this returns its magnitude (decimal precision "0.00"0.01; fraction "1/4"0.25).

  • Returns: number — The tolerance magnitude.
ts
const tolerance = await snaptrude.core.project.settings.getTolerance();

settings.setTolerance(value)

Set the project tolerance. The value snaps to the nearest allowed per-unit precision option (tolerance is a discrete dropdown, not arbitrary).

  • Parameters:
    • value: number — Target tolerance magnitude; snaps to the nearest allowed option.
  • Returns: booleantrue once applied; false if no tolerance options are available.
ts
await snaptrude.core.project.settings.setTolerance(0.01);

settings.snaps.setDimension(value)

Set the dimension-snap threshold.

  • Parameters:
    • value: number — The snap threshold (distance).
  • Returns: boolean
ts
await snaptrude.core.project.settings.snaps.setDimension(5);

settings.snaps.getDimension()

Get the dimension-snap threshold.

  • Returns: number — The dimension-snap threshold.

settings.snaps.enableDimension()

Turn dimension snapping on.

  • Returns: boolean

settings.snaps.disableDimension()

Turn dimension snapping off.

  • Returns: boolean

settings.snaps.setAngle(value)

Set the angle-snap threshold (degrees).

  • Parameters:
    • value: number — The snap threshold in degrees.
  • Returns: boolean
ts
await snaptrude.core.project.settings.snaps.setAngle(15);

settings.snaps.getAngle()

Get the angle-snap threshold (degrees).

  • Returns: number — The angle-snap threshold in degrees.

settings.snaps.enableAngle()

Turn angle snapping on.

  • Returns: boolean

settings.snaps.disableAngle()

Turn angle snapping off.

  • Returns: boolean

settings.snaps.enableParallel()

Turn parallel snapping on.

  • Returns: boolean

settings.snaps.disableParallel()

Turn parallel snapping off.

  • Returns: boolean

settings.snaps.enableNormal()

Turn normal (perpendicular) snapping on.

  • Returns: boolean

settings.snaps.disableNormal()

Turn normal (perpendicular) snapping off.

  • Returns: boolean

settings.snaps.enableMagnetic()

Turn magnetic snapping on.

  • Returns: boolean

settings.snaps.disableMagnetic()

Turn magnetic snapping off.

  • Returns: boolean

settings.grid.enable()

Turn the grid on.

  • Returns: boolean

settings.grid.disable()

Turn the grid off.

  • Returns: boolean

settings.grid.setValue(value)

Set the grid cell value.

  • Parameters:
    • value: number — The grid cell value.
  • Returns: boolean
ts
await snaptrude.core.project.settings.grid.setValue(1);
await snaptrude.core.project.settings.grid.enable();

settings.grid.getValue()

Get the grid cell value.

  • Returns: number — The grid cell value.

Errors

Failed calls reject with a typed PluginError — see Error Handling. This namespace has no specific error conditions: every getter and setter is total. settings.setTolerance returns false (rather than throwing) when no tolerance options are available.