Appearance
Project
Project-level settings and info. Accessed via snaptrude.core.project.
snaptrude.core.project.getInfo()— identity and headline facts about the open 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. (normalis the perpendicular snap.)snaptrude.core.project.settings.grid— grid controls (the visual snap-to grid).
Types
PluginProjectInfo
Identity and headline facts about the currently open project, returned by getInfo.
location is a read-only projection of program.site.getLocation() — program.site.* remains the full site surface (context, weather, polygons). It is mirrored here because "what and where is this project" is one question.
| Property | Type | Description |
|---|---|---|
projectId | string | The open project's id (floorkey) |
name | string | null | Display name; null only when the project genuinely has no title |
units | PUnitType | The project's unit type — the same union core.units.getType() returns ("meters", "feet-inches", …) |
activeStorey | number | The active storey value, in the active building |
storeyCount | number | How many storeys the active building has |
location | { latitude, longitude } | null | Site location; null only when the project is not geo-located |
PluginToleranceArgs
Arguments for settings.setTolerance.
| Property | Type | Description |
|---|---|---|
value | number | Target tolerance magnitude; snaps to the nearest allowed option |
PluginSnapValueArgs
Arguments for the snap-threshold setters (snaps.setDimension / snaps.setAngle).
| Property | Type | Description |
|---|---|---|
value | number | The snap threshold (distance, or degrees for angle) |
PluginGridValueArgs
Arguments for grid.setValue.
| Property | Type | Description |
|---|---|---|
value | number | The grid cell value |
Functions
getInfo()
Read identity and headline facts about the currently open project — id, display name, unit type, storey count, active storey, and site location when the project is geo-located.
- Returns:
PluginProjectInfo— see the type above. - Throws:
PRECONDITION_FAILEDwhen no project is open;OPERATION_FAILEDwhen the project-metadata lookup or the site-location read fails.
null means a fact, never a failure
name is null only for an untitled project, and location is null only for a project that is not geo-located. A failed read throws OPERATION_FAILED rather than returning null — so a null you receive can be reported to the user as fact, and a failure can be retried instead of being mistaken for one.
storeyCount is scoped to the active building
activeStorey and storeyCount both describe the active building, so the pair is always internally consistent. In a multi-building project storeyCount is therefore not the project-wide total — use core.storeys.list(), which spans every building, for that.
ts
const info = await snaptrude.core.project.getInfo();
console.log(info.name, info.units, info.storeyCount);
if (info.location) {
console.log(`Sited at ${info.location.latitude}, ${info.location.longitude}`);
} else {
console.log("This project is not geo-located.");
}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:
boolean—trueonce applied;falseif 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. Every settings getter and setter is total: settings.setTolerance returns false (rather than throwing) when no tolerance options are available, and nothing else under settings throws.
| Code | Thrown by | When |
|---|---|---|
PRECONDITION_FAILED | getInfo | No project is open |
OPERATION_FAILED | getInfo | The project-metadata lookup or the site-location read failed |