@snaptrude/plugin-core 0.0.0-dev-20260708130115 → 0.0.0-dev-20260827135706
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +152 -1
- package/api-manifest.json +3620 -276
- package/dist/api/analysis/daylight.d.ts +603 -0
- package/dist/api/analysis/daylight.d.ts.map +1 -0
- package/dist/api/analysis/heatmaps.d.ts +658 -0
- package/dist/api/analysis/heatmaps.d.ts.map +1 -0
- package/dist/api/analysis/illuminance.d.ts +145 -0
- package/dist/api/analysis/illuminance.d.ts.map +1 -0
- package/dist/api/analysis/index.d.ts +59 -0
- package/dist/api/analysis/index.d.ts.map +1 -0
- package/dist/api/analysis/shadows.d.ts +165 -0
- package/dist/api/analysis/shadows.d.ts.map +1 -0
- package/dist/api/analysis/solar.d.ts +249 -0
- package/dist/api/analysis/solar.d.ts.map +1 -0
- package/dist/api/analysis/sunlightHours.d.ts +208 -0
- package/dist/api/analysis/sunlightHours.d.ts.map +1 -0
- package/dist/api/analysis/sunpath.d.ts +80 -0
- package/dist/api/analysis/sunpath.d.ts.map +1 -0
- package/dist/api/analysis/weather.d.ts +193 -0
- package/dist/api/analysis/weather.d.ts.map +1 -0
- package/dist/api/core/camera/index.d.ts +261 -0
- package/dist/api/core/camera/index.d.ts.map +1 -0
- package/dist/api/core/comment/index.d.ts +105 -2
- package/dist/api/core/comment/index.d.ts.map +1 -1
- package/dist/api/core/geom/create/index.d.ts +840 -14
- package/dist/api/core/geom/create/index.d.ts.map +1 -1
- package/dist/api/core/geom/delete/index.d.ts +8 -2
- package/dist/api/core/geom/delete/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/arc.d.ts +5 -5
- package/dist/api/core/geom/query/brep.d.ts +130 -18
- package/dist/api/core/geom/query/brep.d.ts.map +1 -1
- package/dist/api/core/geom/query/circle.d.ts +18 -18
- package/dist/api/core/geom/query/contour.d.ts +20 -20
- package/dist/api/core/geom/query/curve.d.ts +49 -49
- package/dist/api/core/geom/query/edge.d.ts +5 -5
- package/dist/api/core/geom/query/face.d.ts +16 -16
- package/dist/api/core/geom/query/halfedge.d.ts +8 -8
- package/dist/api/core/geom/query/profile.d.ts +19 -19
- package/dist/api/core/geom/query/vertex.d.ts +8 -8
- package/dist/api/core/geom/update/contour.d.ts +14 -14
- package/dist/api/core/geom/update/curve.d.ts +7 -7
- package/dist/api/core/geom/update/profile.d.ts +16 -16
- package/dist/api/core/handles/index.d.ts +210 -0
- package/dist/api/core/handles/index.d.ts.map +1 -0
- package/dist/api/core/index.d.ts +34 -0
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/io/export/index.d.ts +134 -0
- package/dist/api/core/io/export/index.d.ts.map +1 -0
- package/dist/api/core/io/import/index.d.ts +453 -0
- package/dist/api/core/io/import/index.d.ts.map +1 -0
- package/dist/api/core/io/index.d.ts +40 -0
- package/dist/api/core/io/index.d.ts.map +1 -0
- package/dist/api/core/io/job/index.d.ts +139 -0
- package/dist/api/core/io/job/index.d.ts.map +1 -0
- package/dist/api/core/io/query/index.d.ts +74 -0
- package/dist/api/core/io/query/index.d.ts.map +1 -0
- package/dist/api/core/io/terrain/index.d.ts +341 -0
- package/dist/api/core/io/terrain/index.d.ts.map +1 -0
- package/dist/api/core/io/underlay/index.d.ts +805 -0
- package/dist/api/core/io/underlay/index.d.ts.map +1 -0
- package/dist/api/core/layers.d.ts +7 -7
- package/dist/api/core/mode/index.d.ts +99 -0
- package/dist/api/core/mode/index.d.ts.map +1 -0
- package/dist/api/core/project/index.d.ts +68 -1
- package/dist/api/core/project/index.d.ts.map +1 -1
- package/dist/api/core/proposals/index.d.ts +531 -0
- package/dist/api/core/proposals/index.d.ts.map +1 -0
- package/dist/api/core/storeys/index.d.ts +265 -0
- package/dist/api/core/storeys/index.d.ts.map +1 -0
- package/dist/api/core/tags.d.ts +24 -0
- package/dist/api/core/tags.d.ts.map +1 -1
- package/dist/api/core/user.d.ts +44 -0
- package/dist/api/core/user.d.ts.map +1 -0
- package/dist/api/core/zoom/index.d.ts +4 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -1
- package/dist/api/design/boolean/index.d.ts +4 -4
- package/dist/api/design/create/index.d.ts +568 -45
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/delete/index.d.ts +3 -0
- package/dist/api/design/delete/index.d.ts.map +1 -1
- package/dist/api/design/doors/index.d.ts +195 -0
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/edit/index.d.ts +1 -1
- package/dist/api/design/erase/index.d.ts +2 -2
- package/dist/api/design/family.d.ts +349 -0
- package/dist/api/design/family.d.ts.map +1 -0
- package/dist/api/design/furniture/index.d.ts +181 -8
- package/dist/api/design/furniture/index.d.ts.map +1 -1
- package/dist/api/design/index.d.ts +98 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/lock.d.ts +26 -0
- package/dist/api/design/lock.d.ts.map +1 -1
- package/dist/api/design/materials/index.d.ts +270 -16
- package/dist/api/design/materials/index.d.ts.map +1 -1
- package/dist/api/design/query/geometry/index.d.ts +112 -0
- package/dist/api/design/query/geometry/index.d.ts.map +1 -1
- package/dist/api/design/query/index.d.ts +282 -11
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/query/referenceLines.d.ts +45 -0
- package/dist/api/design/query/referenceLines.d.ts.map +1 -0
- package/dist/api/design/query/spaces.d.ts +181 -8
- package/dist/api/design/query/spaces.d.ts.map +1 -1
- package/dist/api/design/selection/index.d.ts +144 -0
- package/dist/api/design/selection/index.d.ts.map +1 -1
- package/dist/api/design/transform/index.d.ts +172 -10
- package/dist/api/design/transform/index.d.ts.map +1 -1
- package/dist/api/design/types/index.d.ts +181 -0
- package/dist/api/design/types/index.d.ts.map +1 -0
- package/dist/api/design/update/index.d.ts +553 -2
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/design/visibility.d.ts +126 -0
- package/dist/api/design/visibility.d.ts.map +1 -0
- package/dist/api/design/windows/index.d.ts +113 -2
- package/dist/api/design/windows/index.d.ts.map +1 -1
- package/dist/api/entity/buildableEnvelope.d.ts +4 -0
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +10 -2
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +21 -21
- package/dist/api/entity/story.d.ts +242 -15
- package/dist/api/entity/story.d.ts.map +1 -1
- package/dist/api/index.d.ts +10 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +25 -25
- package/dist/api/presentation/annotate.d.ts +467 -0
- package/dist/api/presentation/annotate.d.ts.map +1 -0
- package/dist/api/presentation/diagrams.d.ts +111 -8
- package/dist/api/presentation/diagrams.d.ts.map +1 -1
- package/dist/api/presentation/export.d.ts +108 -0
- package/dist/api/presentation/export.d.ts.map +1 -0
- package/dist/api/presentation/import.d.ts +55 -4
- package/dist/api/presentation/import.d.ts.map +1 -1
- package/dist/api/presentation/index.d.ts +58 -1
- package/dist/api/presentation/index.d.ts.map +1 -1
- package/dist/api/presentation/placedViews.d.ts +1139 -0
- package/dist/api/presentation/placedViews.d.ts.map +1 -0
- package/dist/api/presentation/shapes.d.ts +481 -0
- package/dist/api/presentation/shapes.d.ts.map +1 -0
- package/dist/api/presentation/sheets.d.ts +452 -13
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/presentation/slideshow.d.ts +125 -0
- package/dist/api/presentation/slideshow.d.ts.map +1 -0
- package/dist/api/presentation/tables.d.ts +81 -0
- package/dist/api/presentation/tables.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +367 -7
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/program/areas.d.ts +102 -12
- package/dist/api/program/areas.d.ts.map +1 -1
- package/dist/api/program/cores.d.ts +3 -99
- package/dist/api/program/cores.d.ts.map +1 -1
- package/dist/api/program/index.d.ts +7 -15
- package/dist/api/program/index.d.ts.map +1 -1
- package/dist/api/program/layout.d.ts +346 -11
- package/dist/api/program/layout.d.ts.map +1 -1
- package/dist/api/program/site.d.ts +469 -13
- package/dist/api/program/site.d.ts.map +1 -1
- package/dist/api/program/spreadsheet.d.ts +365 -41
- package/dist/api/program/spreadsheet.d.ts.map +1 -1
- package/dist/api/workspace/index.d.ts +505 -0
- package/dist/api/workspace/index.d.ts.map +1 -0
- package/dist/errors/codes.d.ts +34 -0
- package/dist/errors/codes.d.ts.map +1 -0
- package/dist/errors/envelope.d.ts +56 -0
- package/dist/errors/envelope.d.ts.map +1 -0
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/plugin-error.d.ts +69 -0
- package/dist/errors/plugin-error.d.ts.map +1 -0
- package/dist/handles.d.ts +97 -25
- package/dist/handles.d.ts.map +1 -1
- package/dist/host-utils.d.ts +4 -0
- package/dist/host-utils.d.ts.map +1 -1
- package/dist/index.cjs +4582 -1422
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4171 -1411
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/scripts/generate-manifest.mjs +45 -0
- package/scripts/generate-manifest.test.mjs +103 -4
- package/src/api/analysis/daylight.ts +470 -0
- package/src/api/analysis/heatmaps.ts +683 -0
- package/src/api/analysis/illuminance.ts +155 -0
- package/src/api/analysis/index.ts +61 -0
- package/src/api/analysis/shadows.ts +183 -0
- package/src/api/analysis/solar.ts +237 -0
- package/src/api/analysis/sunlightHours.ts +211 -0
- package/src/api/analysis/sunpath.ts +83 -0
- package/src/api/analysis/weather.ts +179 -0
- package/src/api/core/camera/index.ts +268 -0
- package/src/api/core/comment/index.ts +120 -2
- package/src/api/core/geom/create/index.ts +912 -1
- package/src/api/core/geom/delete/index.ts +6 -0
- package/src/api/core/geom/query/brep.ts +119 -0
- package/src/api/core/handles/index.ts +233 -0
- package/src/api/core/index.ts +34 -0
- package/src/api/core/io/export/index.ts +126 -0
- package/src/api/core/io/import/index.ts +496 -0
- package/src/api/core/io/index.ts +42 -0
- package/src/api/core/io/job/index.ts +140 -0
- package/src/api/core/io/query/index.ts +71 -0
- package/src/api/core/io/terrain/index.ts +360 -0
- package/src/api/core/io/underlay/index.ts +705 -0
- package/src/api/core/mode/index.ts +96 -0
- package/src/api/core/project/index.ts +62 -1
- package/src/api/core/proposals/index.ts +569 -0
- package/src/api/core/storeys/index.ts +294 -0
- package/src/api/core/tags.ts +27 -0
- package/src/api/core/user.ts +46 -0
- package/src/api/core/zoom/index.ts +4 -0
- package/src/api/design/create/index.ts +670 -30
- package/src/api/design/delete/index.ts +3 -0
- package/src/api/design/doors/index.ts +208 -0
- package/src/api/design/erase/index.ts +1 -1
- package/src/api/design/family.ts +388 -0
- package/src/api/design/furniture/index.ts +197 -8
- package/src/api/design/index.ts +102 -0
- package/src/api/design/lock.ts +27 -0
- package/src/api/design/materials/index.ts +334 -27
- package/src/api/design/query/geometry/index.ts +125 -3
- package/src/api/design/query/index.ts +217 -7
- package/src/api/design/query/referenceLines.ts +52 -0
- package/src/api/design/query/spaces.ts +143 -0
- package/src/api/design/selection/index.ts +129 -0
- package/src/api/design/transform/index.ts +170 -9
- package/src/api/design/types/index.ts +156 -0
- package/src/api/design/update/index.ts +631 -3
- package/src/api/design/visibility.ts +143 -0
- package/src/api/design/windows/index.ts +128 -2
- package/src/api/entity/buildableEnvelope.ts +4 -0
- package/src/api/entity/referenceLine.ts +8 -0
- package/src/api/entity/story.ts +259 -15
- package/src/api/index.ts +10 -0
- package/src/api/presentation/annotate.ts +385 -0
- package/src/api/presentation/diagrams.ts +118 -8
- package/src/api/presentation/export.ts +108 -0
- package/src/api/presentation/import.ts +51 -4
- package/src/api/presentation/index.ts +66 -1
- package/src/api/presentation/placedViews.ts +1120 -0
- package/src/api/presentation/shapes.ts +274 -0
- package/src/api/presentation/sheets.ts +400 -13
- package/src/api/presentation/slideshow.ts +134 -0
- package/src/api/presentation/tables.ts +84 -0
- package/src/api/presentation/views.ts +376 -8
- package/src/api/program/areas.ts +88 -15
- package/src/api/program/cores.ts +3 -91
- package/src/api/program/index.ts +7 -15
- package/src/api/program/layout.ts +365 -11
- package/src/api/program/site.ts +435 -13
- package/src/api/program/spreadsheet.ts +376 -35
- package/src/api/workspace/index.ts +563 -0
- package/src/errors/codes.ts +136 -0
- package/src/errors/envelope.ts +75 -0
- package/src/errors/index.ts +21 -0
- package/src/errors/plugin-error.ts +134 -0
- package/src/handles.ts +123 -13
- package/src/host-utils.ts +4 -0
- package/src/index.ts +1 -0
- package/test/errors.test.mjs +184 -0
- package/tsconfig.json +7 -2
package/src/api/program/site.ts
CHANGED
|
@@ -6,15 +6,21 @@ import { PluginAreaUnit } from "./metrics"
|
|
|
6
6
|
* Program site — read the planning context of the project's site/plot.
|
|
7
7
|
*
|
|
8
8
|
* The **site** is the set of plot/parcel footprints the program is planned
|
|
9
|
-
* against: their total area, per-parcel footprints (
|
|
10
|
-
*
|
|
9
|
+
* against: their total area, per-parcel footprints (world XZ plan coordinates
|
|
10
|
+
* in Snaptrude units — the same plan space as a space's `planPoints`), and —
|
|
11
|
+
* when the project is geo-located on terrain — their geographic
|
|
11
12
|
* (latitude/longitude) rings. This is the program-planning view of the site;
|
|
12
|
-
* zoning numbers (
|
|
13
|
-
*
|
|
13
|
+
* zoning numbers (FAR/FSI, height limits) live in the Site Analysis sheet and
|
|
14
|
+
* are available through `getSiteAnalysis`, not the site-context reads. One
|
|
15
|
+
* context exception is `listEdges`: it reads each parcel's per-edge
|
|
16
|
+
* front/side/rear classification and effective base setbacks, the same
|
|
17
|
+
* resolution the buildable-envelope setback pills show on canvas.
|
|
14
18
|
*
|
|
15
|
-
*
|
|
16
|
-
* returns an empty snapshot (zero totals) when there is no site,
|
|
17
|
-
* methods return `[]`.
|
|
19
|
+
* Site context methods are total reads: they return plain records and never
|
|
20
|
+
* throw — `get` returns an empty snapshot (zero totals) when there is no site,
|
|
21
|
+
* and the `list` methods return `[]`. Site Analysis is the exception:
|
|
22
|
+
* `getSiteAnalysis` reads the active proposal's persisted analysis sheet and
|
|
23
|
+
* `updateSiteAnalysis` performs a safe merge/append write to that sheet.
|
|
18
24
|
*
|
|
19
25
|
* Accessed via `snaptrude.program.site`.
|
|
20
26
|
*/
|
|
@@ -64,7 +70,8 @@ export abstract class PluginProgramSiteApi {
|
|
|
64
70
|
public abstract getArea(): PluginApiReturn<PluginProgramSiteAreaResult>
|
|
65
71
|
|
|
66
72
|
/**
|
|
67
|
-
* List the site parcels with their footprints (
|
|
73
|
+
* List the site parcels with their footprints (world XZ plan coordinates,
|
|
74
|
+
* Snaptrude units).
|
|
68
75
|
*
|
|
69
76
|
* @returns A {@linkcode PluginProgramSiteListPolygonsResult} with each parcel's
|
|
70
77
|
* id, area, label, and 2D footprint (XZ ground-plane points). Empty when the
|
|
@@ -83,12 +90,53 @@ export abstract class PluginProgramSiteApi {
|
|
|
83
90
|
*/
|
|
84
91
|
public abstract listPolygons(): PluginApiReturn<PluginProgramSiteListPolygonsResult>
|
|
85
92
|
|
|
93
|
+
/**
|
|
94
|
+
* List each site parcel's boundary edges with their front / side / rear
|
|
95
|
+
* classification — the same per-edge roles the buildable-envelope setback
|
|
96
|
+
* pills show on canvas, so a plugin can pick up the user's edge tagging
|
|
97
|
+
* without asking them to set it up again.
|
|
98
|
+
*
|
|
99
|
+
* Role resolution mirrors the canvas exactly: the user's per-edge overrides
|
|
100
|
+
* (set via the setback pills) win over the tangent heuristic
|
|
101
|
+
* (`roleSource: "override"` vs `"heuristic"`). `"street"` never appears — it
|
|
102
|
+
* resolves to `front`. When a parcel has a linked zoning buildable envelope,
|
|
103
|
+
* `setbackMeters` is the effective base setback of the edge (a per-edge
|
|
104
|
+
* exception when one exists, else the role's value); parcels without a
|
|
105
|
+
* zoning envelope classify by heuristic alone and report
|
|
106
|
+
* `setbackMeters: null`.
|
|
107
|
+
*
|
|
108
|
+
* Coordinates are **world meters** (`lengthUnit: "m"`) — unlike
|
|
109
|
+
* {@linkcode PluginProgramSiteApi.listPolygons} footprints, which are
|
|
110
|
+
* Snaptrude units. `edgeIndex` is keyed to the canonicalized (sanitized,
|
|
111
|
+
* CCW) boundary, the same index space the envelope's `edgeOverrides` use.
|
|
112
|
+
* `staleOverridesDropped: true` means the site was edited after the
|
|
113
|
+
* envelope was configured and the persisted overrides no longer align with
|
|
114
|
+
* the live boundary — the heuristic classification is reported instead.
|
|
115
|
+
*
|
|
116
|
+
* @returns A {@linkcode PluginProgramSiteListEdgesResult} with one entry per
|
|
117
|
+
* parcel. Empty when the project has no site.
|
|
118
|
+
*
|
|
119
|
+
* @examplePrompt Which edge of my site is the front?
|
|
120
|
+
* @examplePrompt Read the front / side / rear edges of the plot
|
|
121
|
+
* @examplePrompt What setback applies to each site edge?
|
|
122
|
+
* @examplePrompt Get the site edges the way the setback pills show them
|
|
123
|
+
*
|
|
124
|
+
* # Example
|
|
125
|
+
* ```ts
|
|
126
|
+
* const { sites } = await snaptrude.program.site.listEdges()
|
|
127
|
+
* for (const site of sites)
|
|
128
|
+
* for (const e of site.edges)
|
|
129
|
+
* console.log(e.edgeIndex, e.role, e.roleSource, e.setbackMeters)
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
public abstract listEdges(): PluginApiReturn<PluginProgramSiteListEdgesResult>
|
|
133
|
+
|
|
86
134
|
/**
|
|
87
135
|
* List the site parcels as geographic latitude/longitude rings.
|
|
88
136
|
*
|
|
89
137
|
* Only available when the project is geo-located on terrain; returns `[]` (no
|
|
90
138
|
* rings) otherwise. Use {@linkcode PluginProgramSiteApi.listPolygons} for the
|
|
91
|
-
*
|
|
139
|
+
* world-coordinate footprints that are always available.
|
|
92
140
|
*
|
|
93
141
|
* @returns A {@linkcode PluginProgramSiteListGeoPolygonsResult} with one ring
|
|
94
142
|
* of `{ lat, lng, alt }` points per parcel.
|
|
@@ -127,16 +175,242 @@ export abstract class PluginProgramSiteApi {
|
|
|
127
175
|
* ```
|
|
128
176
|
*/
|
|
129
177
|
public abstract getContext(): PluginApiReturn<PluginProgramSiteContextResult>
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Get the project's geographic location.
|
|
181
|
+
*
|
|
182
|
+
* The latitude/longitude the site is geo-located at — the location the
|
|
183
|
+
* `analysis.*` sun and daylight studies compute against. Returns `null`
|
|
184
|
+
* when the project is not geo-located on terrain (there is no fallback
|
|
185
|
+
* location).
|
|
186
|
+
*
|
|
187
|
+
* Note the spelling: this result uses the full `{ latitude, longitude }`
|
|
188
|
+
* keys, while the older site reads
|
|
189
|
+
* ({@linkcode PluginProgramSiteApi.getContext},
|
|
190
|
+
* {@linkcode PluginProgramSiteApi.listGeoPolygons}) use the abbreviated
|
|
191
|
+
* `{ lat, lng }`.
|
|
192
|
+
*
|
|
193
|
+
* @returns A {@linkcode PluginProgramSiteLocationResult} —
|
|
194
|
+
* `{ latitude, longitude }`, or `null` when the project has no
|
|
195
|
+
* geo-located site.
|
|
196
|
+
*
|
|
197
|
+
* @examplePrompt What's the project's latitude and longitude?
|
|
198
|
+
* @examplePrompt Where is this site located?
|
|
199
|
+
* @examplePrompt Get the geographic coordinates of the project
|
|
200
|
+
*
|
|
201
|
+
* # Example
|
|
202
|
+
* ```ts
|
|
203
|
+
* const location = await snaptrude.program.site.getLocation()
|
|
204
|
+
* if (location) console.log(location.latitude, location.longitude)
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
public abstract getLocation(): PluginApiReturn<PluginProgramSiteLocationResult>
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Get the site's true-north angle.
|
|
211
|
+
*
|
|
212
|
+
* The angle in degrees the model's north (the scene's +Z axis) is rotated
|
|
213
|
+
* from true north, derived from the terrain's rotation. `0` means the
|
|
214
|
+
* model is aligned to true north. Reported in `[0, 360)`,
|
|
215
|
+
* **clockwise-positive** viewed from above (Babylon's +Y rotation sign) —
|
|
216
|
+
* note this is the opposite sign convention to `design.transform.rotate`,
|
|
217
|
+
* where positive = CCW. Returns `null` when the project is not
|
|
218
|
+
* geo-located on terrain.
|
|
219
|
+
*
|
|
220
|
+
* @returns A {@linkcode PluginProgramSiteNorthAngleResult} — the angle in
|
|
221
|
+
* degrees (`[0, 360)`, clockwise-positive), or `null` when the project
|
|
222
|
+
* has no geo-located site.
|
|
223
|
+
*
|
|
224
|
+
* @examplePrompt What's the north angle of the site?
|
|
225
|
+
* @examplePrompt How far is the model rotated from true north?
|
|
226
|
+
* @examplePrompt Get the project's true north direction
|
|
227
|
+
*
|
|
228
|
+
* # Example
|
|
229
|
+
* ```ts
|
|
230
|
+
* const northAngle = await snaptrude.program.site.getNorthAngle()
|
|
231
|
+
* if (northAngle !== null) console.log(`${northAngle}° from true north`)
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
public abstract getNorthAngle(): PluginApiReturn<PluginProgramSiteNorthAngleResult>
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Get the IANA timezone of the project's geographic location.
|
|
238
|
+
*
|
|
239
|
+
* The timezone identifier (e.g. `"America/New_York"`, `"Asia/Kolkata"`)
|
|
240
|
+
* looked up from the same geo-location
|
|
241
|
+
* {@linkcode PluginProgramSiteApi.getLocation} returns. Returns `null` when
|
|
242
|
+
* the project is not geo-located on terrain.
|
|
243
|
+
*
|
|
244
|
+
* @returns A {@linkcode PluginProgramSiteTimezoneResult} — the IANA timezone
|
|
245
|
+
* id string, or `null` when the project has no geo-located site.
|
|
246
|
+
*
|
|
247
|
+
* @examplePrompt What timezone is this project in?
|
|
248
|
+
* @examplePrompt Get the site's IANA timezone
|
|
249
|
+
* @examplePrompt What's the local time zone at the project location?
|
|
250
|
+
* @examplePrompt Which timezone should I use for the sun study schedule?
|
|
251
|
+
*
|
|
252
|
+
* # Example
|
|
253
|
+
* ```ts
|
|
254
|
+
* const timezone = await snaptrude.program.site.getTimezone()
|
|
255
|
+
* if (timezone) console.log(`Project timezone: ${timezone}`)
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
public abstract getTimezone(): PluginApiReturn<PluginProgramSiteTimezoneResult>
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Get the weather file resolved for the project site.
|
|
262
|
+
*
|
|
263
|
+
* A lightweight read of the EPW weather file the `analysis.*` sun and
|
|
264
|
+
* daylight studies compute against — its catalog id, station name, content
|
|
265
|
+
* checksum, and how it was selected. This is the same file (same
|
|
266
|
+
* `weatherFileId`) that {@linkcode PluginAnalysisWeatherApi.getSeries} reads
|
|
267
|
+
* rows from and that a daylight run echoes in its provenance. Returns `null`
|
|
268
|
+
* when the project has no geo-located site (no weather file to resolve).
|
|
269
|
+
*
|
|
270
|
+
* @returns A {@linkcode PluginProgramSiteWeatherResult} —
|
|
271
|
+
* `{ weatherFileId, station, checksum, selectionMethod }`, or `null` when
|
|
272
|
+
* the project has no geo-located site.
|
|
273
|
+
*
|
|
274
|
+
* @examplePrompt Which weather file is my project using?
|
|
275
|
+
* @examplePrompt What EPW station was resolved for this site?
|
|
276
|
+
* @examplePrompt Get the weather file id for the daylight analysis
|
|
277
|
+
*
|
|
278
|
+
* # Example
|
|
279
|
+
* ```ts
|
|
280
|
+
* const weather = await snaptrude.program.site.getWeather()
|
|
281
|
+
* if (weather) console.log(weather.station, weather.selectionMethod)
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
public abstract getWeather(): PluginApiReturn<PluginProgramSiteWeatherResult>
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Read the persisted Site Analysis sheet for the active proposal.
|
|
288
|
+
*
|
|
289
|
+
* The read works without Program mode open. When a Program tab is open, the
|
|
290
|
+
* host first makes a best-effort attempt to flush its pending edits. The
|
|
291
|
+
* active proposal's sheet is preferred, with the base `"Site Analysis"`
|
|
292
|
+
* sheet as fallback. Returns `null` when no parseable sheet is persisted.
|
|
293
|
+
*
|
|
294
|
+
* @returns The persisted site location, polygon, and constraint rows, or
|
|
295
|
+
* `null` when no Site Analysis data exists. This read never throws.
|
|
296
|
+
*
|
|
297
|
+
* @examplePrompt Read the current Site Analysis sheet
|
|
298
|
+
* @examplePrompt What zoning constraints are recorded for this proposal?
|
|
299
|
+
*
|
|
300
|
+
* # Example
|
|
301
|
+
* ```ts
|
|
302
|
+
* const analysis = await snaptrude.program.site.getSiteAnalysis()
|
|
303
|
+
* if (analysis) console.log(analysis.sheetName, analysis.rows)
|
|
304
|
+
* ```
|
|
305
|
+
*/
|
|
306
|
+
public abstract getSiteAnalysis(): PluginApiReturn<PluginProgramSiteAnalysisResult>
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Merge sourced site/zoning constraints into the active proposal's persisted
|
|
310
|
+
* Site Analysis sheet.
|
|
311
|
+
*
|
|
312
|
+
* Rows match by trimmed, case-insensitive Category + Description. Matched
|
|
313
|
+
* rows update only Quantity/Unit; unmatched rows append. Existing labels,
|
|
314
|
+
* formatting, and unrelated rows remain intact. There is deliberately no
|
|
315
|
+
* replace/reset mode — an appended duplicate row can NEVER be removed, so
|
|
316
|
+
* there is no "write now, fix later". Send only the rows that were actually
|
|
317
|
+
* sourced, ALWAYS call `getSiteAnalysis` first and reuse the sheet's exact
|
|
318
|
+
* labels, and never use `program.spreadsheet.setValues` for Site Analysis
|
|
319
|
+
* data — this method is the only correct writer. Check the result:
|
|
320
|
+
* `updatedRows` should account for every row that had a template match; an
|
|
321
|
+
* unexpected `appendedRows` usually means a label did not match the read's
|
|
322
|
+
* vocabulary.
|
|
323
|
+
*
|
|
324
|
+
* When Program mode is open, the host writes through the live sheet. Without
|
|
325
|
+
* a live tab it safely merges the persisted document. The call rejects rather
|
|
326
|
+
* than risk overwriting unflushed live edits or an unparseable existing sheet.
|
|
327
|
+
*
|
|
328
|
+
* @param rows - One or more sourced constraint rows to merge or append.
|
|
329
|
+
* @param options - Optional site location and JSON-encoded site polygon.
|
|
330
|
+
* @returns The target sheet name and merge counts.
|
|
331
|
+
* @throws PRECONDITION_FAILED when proposals exist but none is active, or
|
|
332
|
+
* when live Program edits cannot be flushed safely.
|
|
333
|
+
*
|
|
334
|
+
* @examplePrompt Save these zoning constraints to Site Analysis
|
|
335
|
+
* @examplePrompt Update the FAR and setbacks in the Site Analysis sheet
|
|
336
|
+
*
|
|
337
|
+
* # Example
|
|
338
|
+
* ```ts
|
|
339
|
+
* const result = await snaptrude.program.site.updateSiteAnalysis([
|
|
340
|
+
* { category: "FAR", description: "Floor Area Ratio", quantity: 3.5, unit: "ratio" },
|
|
341
|
+
* { category: "Set backs", description: "Front setbacks", quantity: 6, unit: "m" },
|
|
342
|
+
* ])
|
|
343
|
+
* console.log(result.sheetName, result.updatedRows, result.appendedRows)
|
|
344
|
+
* ```
|
|
345
|
+
*/
|
|
346
|
+
public abstract updateSiteAnalysis(
|
|
347
|
+
rows: PluginSiteAnalysisRow[],
|
|
348
|
+
options?: PluginSiteAnalysisUpdateOptions,
|
|
349
|
+
): PluginApiReturn<PluginProgramSiteAnalysisUpdateResult>
|
|
130
350
|
}
|
|
131
351
|
|
|
132
352
|
/**
|
|
133
|
-
* A
|
|
134
|
-
*
|
|
353
|
+
* A constraint row stored in the Site Analysis sheet. A `quantity` of `"-"`
|
|
354
|
+
* means the value is not recorded yet — never echo `"-"` back as a sourced
|
|
355
|
+
* value.
|
|
356
|
+
*/
|
|
357
|
+
export const PluginSiteAnalysisRow = z.object({
|
|
358
|
+
category: z.string().min(1),
|
|
359
|
+
description: z.string(),
|
|
360
|
+
quantity: z.union([z.string(), z.number()]),
|
|
361
|
+
unit: z.string(),
|
|
362
|
+
})
|
|
363
|
+
export type PluginSiteAnalysisRow = z.infer<typeof PluginSiteAnalysisRow>
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Optional site context persisted alongside Site Analysis constraint rows.
|
|
367
|
+
* `null` and `undefined` are both accepted as "no options".
|
|
368
|
+
*/
|
|
369
|
+
export const PluginSiteAnalysisUpdateOptions = z
|
|
370
|
+
.object({
|
|
371
|
+
siteLocation: z.object({ lat: z.number(), lng: z.number() }).optional(),
|
|
372
|
+
/** JSON-encoded polygon string written to the Site Polygon row. */
|
|
373
|
+
sitePolygon: z.string().optional(),
|
|
374
|
+
})
|
|
375
|
+
.nullish()
|
|
376
|
+
export type PluginSiteAnalysisUpdateOptions = z.infer<
|
|
377
|
+
typeof PluginSiteAnalysisUpdateOptions
|
|
378
|
+
>
|
|
379
|
+
|
|
380
|
+
/** Persisted Site Analysis data for the active proposal. */
|
|
381
|
+
export const PluginProgramSiteAnalysisResult = z
|
|
382
|
+
.object({
|
|
383
|
+
sheetName: z.string(),
|
|
384
|
+
siteLocation: z.object({ lat: z.number(), lng: z.number() }).nullable(),
|
|
385
|
+
sitePolygon: z.string().nullable(),
|
|
386
|
+
rows: z.array(PluginSiteAnalysisRow),
|
|
387
|
+
})
|
|
388
|
+
.nullable()
|
|
389
|
+
export type PluginProgramSiteAnalysisResult = z.infer<
|
|
390
|
+
typeof PluginProgramSiteAnalysisResult
|
|
391
|
+
>
|
|
392
|
+
|
|
393
|
+
/** Result of a merge/append Site Analysis write. */
|
|
394
|
+
export const PluginProgramSiteAnalysisUpdateResult = z.object({
|
|
395
|
+
sheetName: z.string(),
|
|
396
|
+
/** Constraint rows on the sheet after the write. */
|
|
397
|
+
rowCount: z.number(),
|
|
398
|
+
updatedRows: z.number(),
|
|
399
|
+
appendedRows: z.number(),
|
|
400
|
+
})
|
|
401
|
+
export type PluginProgramSiteAnalysisUpdateResult = z.infer<
|
|
402
|
+
typeof PluginProgramSiteAnalysisUpdateResult
|
|
403
|
+
>
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* A 2D ground-plane point of a site parcel footprint, in world XZ plan
|
|
407
|
+
* coordinates (Snaptrude units) — the same plan space as a space's
|
|
408
|
+
* `planPoints`, so site parcels overlay space footprints directly.
|
|
135
409
|
*
|
|
136
410
|
* | Property | Type | Description |
|
|
137
411
|
* |---|---|---|
|
|
138
|
-
* | `x` | `number` | X coordinate (
|
|
139
|
-
* | `z` | `number` | Z coordinate (
|
|
412
|
+
* | `x` | `number` | X coordinate (world, Snaptrude units) |
|
|
413
|
+
* | `z` | `number` | Z coordinate (world, Snaptrude units) |
|
|
140
414
|
*/
|
|
141
415
|
export const PluginSiteFootprintPoint = z.object({
|
|
142
416
|
x: z.number(),
|
|
@@ -324,3 +598,151 @@ export const PluginProgramSiteContextResult =
|
|
|
324
598
|
export type PluginProgramSiteContextResult = z.infer<
|
|
325
599
|
typeof PluginProgramSiteContextResult
|
|
326
600
|
>
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* The project's geographic location (WGS84).
|
|
604
|
+
*
|
|
605
|
+
* | Property | Type | Description |
|
|
606
|
+
* |---|---|---|
|
|
607
|
+
* | `latitude` | `number` | Latitude (degrees) |
|
|
608
|
+
* | `longitude` | `number` | Longitude (degrees) |
|
|
609
|
+
*/
|
|
610
|
+
export const PluginProgramSiteLocation = z.object({
|
|
611
|
+
latitude: z.number(),
|
|
612
|
+
longitude: z.number(),
|
|
613
|
+
})
|
|
614
|
+
export type PluginProgramSiteLocation = z.infer<
|
|
615
|
+
typeof PluginProgramSiteLocation
|
|
616
|
+
>
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* Result of {@linkcode PluginProgramSiteApi.getLocation} — the location, or
|
|
620
|
+
* `null` when the project is not geo-located.
|
|
621
|
+
*/
|
|
622
|
+
export const PluginProgramSiteLocationResult =
|
|
623
|
+
PluginProgramSiteLocation.nullable()
|
|
624
|
+
export type PluginProgramSiteLocationResult = z.infer<
|
|
625
|
+
typeof PluginProgramSiteLocationResult
|
|
626
|
+
>
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Result of {@linkcode PluginProgramSiteApi.getNorthAngle} — the true-north
|
|
630
|
+
* angle in degrees (`[0, 360)`, clockwise-positive), or `null` when the
|
|
631
|
+
* project is not geo-located.
|
|
632
|
+
*/
|
|
633
|
+
export const PluginProgramSiteNorthAngleResult = z.number().nullable()
|
|
634
|
+
export type PluginProgramSiteNorthAngleResult = z.infer<
|
|
635
|
+
typeof PluginProgramSiteNorthAngleResult
|
|
636
|
+
>
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Result of {@linkcode PluginProgramSiteApi.getTimezone} — the IANA timezone
|
|
640
|
+
* id of the project's geo-location (e.g. `"Europe/London"`), or `null` when
|
|
641
|
+
* the project is not geo-located.
|
|
642
|
+
*/
|
|
643
|
+
export const PluginProgramSiteTimezoneResult = z.string().nullable()
|
|
644
|
+
export type PluginProgramSiteTimezoneResult = z.infer<
|
|
645
|
+
typeof PluginProgramSiteTimezoneResult
|
|
646
|
+
>
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* A summary of the weather file resolved for the project site. Matches the
|
|
650
|
+
* relevant fields of `analysis.weather`'s `PluginWeatherSourceMeta`;
|
|
651
|
+
* `selectionMethod` is one of `"nearest-station"`, `"user-upload"`, or
|
|
652
|
+
* `"project-override"`.
|
|
653
|
+
*
|
|
654
|
+
* | Property | Type | Description |
|
|
655
|
+
* |---|---|---|
|
|
656
|
+
* | `weatherFileId` | `string` | Catalog id (same key as `core.io.import.epw`) |
|
|
657
|
+
* | `station` | `string` | Station/file name |
|
|
658
|
+
* | `checksum` | `string` | sha256 of the EPW file |
|
|
659
|
+
* | `selectionMethod` | `"nearest-station" \| "user-upload" \| "project-override"` | How the file was matched |
|
|
660
|
+
*/
|
|
661
|
+
export const PluginProgramSiteWeather = z.object({
|
|
662
|
+
weatherFileId: z.string(),
|
|
663
|
+
station: z.string(),
|
|
664
|
+
checksum: z.string(),
|
|
665
|
+
selectionMethod: z.enum([
|
|
666
|
+
"nearest-station",
|
|
667
|
+
"user-upload",
|
|
668
|
+
"project-override",
|
|
669
|
+
]),
|
|
670
|
+
})
|
|
671
|
+
export type PluginProgramSiteWeather = z.infer<typeof PluginProgramSiteWeather>
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Result of {@linkcode PluginProgramSiteApi.getWeather} — the resolved weather
|
|
675
|
+
* file summary, or `null` when the project has no geo-located site.
|
|
676
|
+
*/
|
|
677
|
+
export const PluginProgramSiteWeatherResult =
|
|
678
|
+
PluginProgramSiteWeather.nullable()
|
|
679
|
+
export type PluginProgramSiteWeatherResult = z.infer<
|
|
680
|
+
typeof PluginProgramSiteWeatherResult
|
|
681
|
+
>
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Front / side / rear classification of one site-boundary edge. `"street"`
|
|
685
|
+
* never appears — the backend synonym resolves to `front`.
|
|
686
|
+
*/
|
|
687
|
+
export const PluginProgramSiteEdgeRole = z.enum(["front", "side", "rear"])
|
|
688
|
+
export type PluginProgramSiteEdgeRole = z.infer<
|
|
689
|
+
typeof PluginProgramSiteEdgeRole
|
|
690
|
+
>
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* One boundary edge of a site parcel, as {@linkcode PluginProgramSiteApi.listEdges}
|
|
694
|
+
* returns it. Coordinates and lengths are world meters.
|
|
695
|
+
*
|
|
696
|
+
* | Property | Type | Description |
|
|
697
|
+
* |---|---|---|
|
|
698
|
+
* | `edgeIndex` | `number` | Index in the canonicalized (sanitized, CCW) boundary — the same index space the envelope's `edgeOverrides` use |
|
|
699
|
+
* | `start` / `end` | `{ x, z }` | Edge endpoints, world XZ meters |
|
|
700
|
+
* | `lengthMeters` | `number` | Edge length in meters |
|
|
701
|
+
* | `role` | `"front" \| "side" \| "rear"` | Resolved classification (user override wins over the heuristic) |
|
|
702
|
+
* | `roleSource` | `"override" \| "heuristic"` | Whether the user reassigned this edge's role or the tangent heuristic classified it |
|
|
703
|
+
* | `setbackMeters` | `number \| null` | Effective base setback (per-edge exception ?? role value); `null` when the parcel has no zoning envelope |
|
|
704
|
+
*/
|
|
705
|
+
export const PluginProgramSiteEdge = z.object({
|
|
706
|
+
edgeIndex: z.number().int().nonnegative(),
|
|
707
|
+
start: z.object({ x: z.number(), z: z.number() }),
|
|
708
|
+
end: z.object({ x: z.number(), z: z.number() }),
|
|
709
|
+
lengthMeters: z.number(),
|
|
710
|
+
role: PluginProgramSiteEdgeRole,
|
|
711
|
+
roleSource: z.enum(["override", "heuristic"]),
|
|
712
|
+
setbackMeters: z.number().nullable(),
|
|
713
|
+
})
|
|
714
|
+
export type PluginProgramSiteEdge = z.infer<typeof PluginProgramSiteEdge>
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Per-parcel entry of {@linkcode PluginProgramSiteApi.listEdges}.
|
|
718
|
+
*
|
|
719
|
+
* | Property | Type | Description |
|
|
720
|
+
* |---|---|---|
|
|
721
|
+
* | `siteId` | `string` | The parcel's component id (same id space as `listPolygons`) |
|
|
722
|
+
* | `buildableEnvelopeId` | `string \| null` | Linked zoning envelope, when one exists |
|
|
723
|
+
* | `usingLiveSiteBoundary` | `boolean` | `true` when edges come from the live site boundary; `false` when only the envelope's persisted source polygon was resolvable |
|
|
724
|
+
* | `staleOverridesDropped` | `boolean` | `true` when persisted edge overrides no longer index-align with the live boundary and were ignored |
|
|
725
|
+
* | `edges` | `PluginProgramSiteEdge[]` | The classified boundary edges |
|
|
726
|
+
*/
|
|
727
|
+
export const PluginProgramSiteEdgesEntry = z.object({
|
|
728
|
+
siteId: z.string(),
|
|
729
|
+
buildableEnvelopeId: z.string().nullable(),
|
|
730
|
+
usingLiveSiteBoundary: z.boolean(),
|
|
731
|
+
staleOverridesDropped: z.boolean(),
|
|
732
|
+
edges: z.array(PluginProgramSiteEdge),
|
|
733
|
+
})
|
|
734
|
+
export type PluginProgramSiteEdgesEntry = z.infer<
|
|
735
|
+
typeof PluginProgramSiteEdgesEntry
|
|
736
|
+
>
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* Result of {@linkcode PluginProgramSiteApi.listEdges} — one entry per site
|
|
740
|
+
* parcel; empty when the project has no site. `lengthUnit` is always `"m"`.
|
|
741
|
+
*/
|
|
742
|
+
export const PluginProgramSiteListEdgesResult = z.object({
|
|
743
|
+
lengthUnit: z.literal("m"),
|
|
744
|
+
sites: z.array(PluginProgramSiteEdgesEntry),
|
|
745
|
+
})
|
|
746
|
+
export type PluginProgramSiteListEdgesResult = z.infer<
|
|
747
|
+
typeof PluginProgramSiteListEdgesResult
|
|
748
|
+
>
|