@snaptrude/plugin-core 0.3.0 → 0.6.0
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/AGENTS.md +130 -48
- package/CHANGELOG.md +163 -0
- package/api-manifest.full.json +5600 -0
- package/api-manifest.json +5502 -0
- package/dist/api/analysis/heatmaps.d.ts +234 -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 +44 -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/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/core/buildings.d.ts +427 -0
- package/dist/api/core/buildings.d.ts.map +1 -0
- package/dist/api/core/comment/index.d.ts +230 -0
- package/dist/api/core/comment/index.d.ts.map +1 -0
- package/dist/api/core/geom/create/index.d.ts +247 -0
- package/dist/api/core/geom/create/index.d.ts.map +1 -0
- package/dist/api/core/geom/delete/index.d.ts +72 -0
- package/dist/api/core/geom/delete/index.d.ts.map +1 -0
- package/dist/api/core/geom/index.d.ts +24 -23
- package/dist/api/core/geom/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/arc.d.ts +169 -0
- package/dist/api/core/geom/query/arc.d.ts.map +1 -0
- package/dist/api/core/geom/query/brep.d.ts +402 -0
- package/dist/api/core/geom/query/brep.d.ts.map +1 -0
- package/dist/api/core/geom/query/circle.d.ts +378 -0
- package/dist/api/core/geom/query/circle.d.ts.map +1 -0
- package/dist/api/core/geom/query/contour.d.ts +450 -0
- package/dist/api/core/geom/query/contour.d.ts.map +1 -0
- package/dist/api/core/geom/query/curve.d.ts +918 -0
- package/dist/api/core/geom/query/curve.d.ts.map +1 -0
- package/dist/api/core/geom/query/edge.d.ts +128 -0
- package/dist/api/core/geom/query/edge.d.ts.map +1 -0
- package/dist/api/core/geom/query/face.d.ts +363 -0
- package/dist/api/core/geom/query/face.d.ts.map +1 -0
- package/dist/api/core/geom/query/halfedge.d.ts +206 -0
- package/dist/api/core/geom/query/halfedge.d.ts.map +1 -0
- package/dist/api/core/geom/query/index.d.ts +61 -0
- package/dist/api/core/geom/query/index.d.ts.map +1 -0
- package/dist/api/core/geom/query/profile.d.ts +410 -0
- package/dist/api/core/geom/query/profile.d.ts.map +1 -0
- package/dist/api/core/geom/query/vertex.d.ts +187 -0
- package/dist/api/core/geom/query/vertex.d.ts.map +1 -0
- package/dist/api/core/geom/update/contour.d.ts +272 -0
- package/dist/api/core/geom/update/contour.d.ts.map +1 -0
- package/dist/api/core/geom/update/curve.d.ts +180 -0
- package/dist/api/core/geom/update/curve.d.ts.map +1 -0
- package/dist/api/core/geom/update/index.d.ts +27 -0
- package/dist/api/core/geom/update/index.d.ts.map +1 -0
- package/dist/api/core/geom/update/profile.d.ts +329 -0
- package/dist/api/core/geom/update/profile.d.ts.map +1 -0
- package/dist/api/core/groups.d.ts +485 -0
- package/dist/api/core/groups.d.ts.map +1 -0
- package/dist/api/core/history/index.d.ts +78 -0
- package/dist/api/core/history/index.d.ts.map +1 -0
- package/dist/api/core/index.d.ts +51 -1
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/io/import/index.d.ts +392 -0
- package/dist/api/core/io/import/index.d.ts.map +1 -0
- package/dist/api/core/io/index.d.ts +35 -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 +206 -0
- package/dist/api/core/io/terrain/index.d.ts.map +1 -0
- package/dist/api/core/io/underlay/index.d.ts +286 -0
- package/dist/api/core/io/underlay/index.d.ts.map +1 -0
- package/dist/api/core/layers.d.ts +402 -0
- package/dist/api/core/layers.d.ts.map +1 -0
- package/dist/api/core/math/quat.d.ts +111 -128
- package/dist/api/core/math/quat.d.ts.map +1 -1
- package/dist/api/core/math/vec3.d.ts +120 -102
- package/dist/api/core/math/vec3.d.ts.map +1 -1
- package/dist/api/core/project/index.d.ts +399 -0
- package/dist/api/core/project/index.d.ts.map +1 -0
- package/dist/api/core/tags.d.ts +755 -0
- package/dist/api/core/tags.d.ts.map +1 -0
- package/dist/api/core/units/index.d.ts +175 -0
- package/dist/api/core/units/index.d.ts.map +1 -0
- package/dist/api/core/zoom/index.d.ts +45 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -0
- package/dist/api/design/boolean/index.d.ts +168 -0
- package/dist/api/design/boolean/index.d.ts.map +1 -0
- package/dist/api/design/create/index.d.ts +837 -0
- package/dist/api/design/create/index.d.ts.map +1 -0
- package/dist/api/design/delete/index.d.ts +63 -0
- package/dist/api/design/delete/index.d.ts.map +1 -0
- package/dist/api/design/doors/index.d.ts +268 -0
- package/dist/api/design/doors/index.d.ts.map +1 -0
- package/dist/api/design/edit/index.d.ts +49 -0
- package/dist/api/design/edit/index.d.ts.map +1 -0
- package/dist/api/design/erase/index.d.ts +160 -0
- package/dist/api/design/erase/index.d.ts.map +1 -0
- package/dist/api/design/furniture/index.d.ts +123 -0
- package/dist/api/design/furniture/index.d.ts.map +1 -0
- package/dist/api/design/index.d.ts +153 -0
- package/dist/api/design/index.d.ts.map +1 -0
- package/dist/api/design/lock.d.ts +41 -0
- package/dist/api/design/lock.d.ts.map +1 -0
- package/dist/api/design/materials/index.d.ts +297 -0
- package/dist/api/design/materials/index.d.ts.map +1 -0
- package/dist/api/design/query/geometry/index.d.ts +140 -0
- package/dist/api/design/query/geometry/index.d.ts.map +1 -0
- package/dist/api/design/query/index.d.ts +1011 -0
- package/dist/api/design/query/index.d.ts.map +1 -0
- package/dist/api/design/query/spaces.d.ts +221 -0
- package/dist/api/design/query/spaces.d.ts.map +1 -0
- package/dist/api/design/selection/index.d.ts +282 -0
- package/dist/api/design/selection/index.d.ts.map +1 -0
- package/dist/api/design/shared.d.ts +38 -0
- package/dist/api/design/shared.d.ts.map +1 -0
- package/dist/api/design/transform/index.d.ts +87 -0
- package/dist/api/design/transform/index.d.ts.map +1 -0
- package/dist/api/design/update/index.d.ts +178 -0
- package/dist/api/design/update/index.d.ts.map +1 -0
- package/dist/api/design/windows/index.d.ts +189 -0
- package/dist/api/design/windows/index.d.ts.map +1 -0
- package/dist/api/entity/buildableEnvelope.d.ts +261 -0
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -0
- package/dist/api/entity/department.d.ts +0 -98
- package/dist/api/entity/department.d.ts.map +1 -1
- package/dist/api/entity/index.d.ts +9 -9
- package/dist/api/entity/index.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +49 -106
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +484 -251
- package/dist/api/entity/space.d.ts.map +1 -1
- package/dist/api/entity/story.d.ts +49 -39
- package/dist/api/entity/story.d.ts.map +1 -1
- package/dist/api/index.d.ts +22 -12
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +440 -0
- package/dist/api/presentation/aiInspiration.d.ts.map +1 -0
- package/dist/api/presentation/diagrams.d.ts +81 -0
- package/dist/api/presentation/diagrams.d.ts.map +1 -0
- package/dist/api/presentation/import.d.ts +113 -0
- package/dist/api/presentation/import.d.ts.map +1 -0
- package/dist/api/presentation/index.d.ts +46 -0
- package/dist/api/presentation/index.d.ts.map +1 -0
- package/dist/api/presentation/sheets.d.ts +176 -0
- package/dist/api/presentation/sheets.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +296 -0
- package/dist/api/presentation/views.d.ts.map +1 -0
- package/dist/api/program/adjacency.d.ts +155 -0
- package/dist/api/program/adjacency.d.ts.map +1 -0
- package/dist/api/program/areas.d.ts +360 -0
- package/dist/api/program/areas.d.ts.map +1 -0
- package/dist/api/program/classification.d.ts +135 -0
- package/dist/api/program/classification.d.ts.map +1 -0
- package/dist/api/program/cores.d.ts +174 -0
- package/dist/api/program/cores.d.ts.map +1 -0
- package/dist/api/program/departments.d.ts +431 -0
- package/dist/api/program/departments.d.ts.map +1 -0
- package/dist/api/program/index.d.ts +69 -0
- package/dist/api/program/index.d.ts.map +1 -0
- package/dist/api/program/layout.d.ts +63 -0
- package/dist/api/program/layout.d.ts.map +1 -0
- package/dist/api/program/metrics.d.ts +108 -0
- package/dist/api/program/metrics.d.ts.map +1 -0
- package/dist/api/program/site.d.ts +451 -0
- package/dist/api/program/site.d.ts.map +1 -0
- package/dist/api/program/spreadsheet.d.ts +2041 -0
- package/dist/api/program/spreadsheet.d.ts.map +1 -0
- package/dist/handles.d.ts +171 -0
- package/dist/handles.d.ts.map +1 -0
- package/dist/host-utils.d.ts +7 -5
- package/dist/host-utils.d.ts.map +1 -1
- package/dist/index.cjs +4344 -899
- 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 +3682 -865
- package/dist/index.js.map +1 -1
- package/package.json +6 -2
- package/scripts/generate-manifest.mjs +193 -0
- package/scripts/generate-manifest.test.mjs +215 -0
- package/src/api/analysis/heatmaps.ts +256 -0
- package/src/api/analysis/illuminance.ts +155 -0
- package/src/api/analysis/index.ts +46 -0
- package/src/api/analysis/shadows.ts +183 -0
- package/src/api/analysis/sunlightHours.ts +211 -0
- package/src/api/analysis/sunpath.ts +83 -0
- package/src/api/core/buildings.ts +485 -0
- package/src/api/core/comment/index.ts +258 -0
- package/src/api/core/geom/create/index.ts +293 -0
- package/src/api/core/geom/delete/index.ts +78 -0
- package/src/api/core/geom/index.ts +24 -23
- package/src/api/core/geom/query/arc.ts +169 -0
- package/src/api/core/geom/query/brep.ts +444 -0
- package/src/api/core/geom/query/circle.ts +404 -0
- package/src/api/core/geom/query/contour.ts +540 -0
- package/src/api/core/geom/query/curve.ts +1078 -0
- package/src/api/core/geom/query/edge.ts +130 -0
- package/src/api/core/geom/query/face.ts +403 -0
- package/src/api/core/geom/query/halfedge.ts +210 -0
- package/src/api/core/geom/query/index.ts +63 -0
- package/src/api/core/geom/query/profile.ts +473 -0
- package/src/api/core/geom/query/vertex.ts +205 -0
- package/src/api/core/geom/update/contour.ts +315 -0
- package/src/api/core/geom/update/curve.ts +209 -0
- package/src/api/core/geom/update/index.ts +29 -0
- package/src/api/core/geom/update/profile.ts +377 -0
- package/src/api/core/groups.ts +521 -0
- package/src/api/core/history/index.ts +84 -0
- package/src/api/core/index.ts +51 -1
- package/src/api/core/io/import/index.ts +432 -0
- package/src/api/core/io/index.ts +37 -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 +214 -0
- package/src/api/core/io/underlay/index.ts +295 -0
- package/src/api/core/layers.ts +333 -0
- package/src/api/core/math/quat.ts +112 -235
- package/src/api/core/math/vec3.ts +124 -159
- package/src/api/core/project/index.ts +418 -0
- package/src/api/core/tags.ts +808 -0
- package/src/api/core/units/index.ts +164 -0
- package/src/api/core/zoom/index.ts +47 -0
- package/src/api/design/boolean/index.ts +179 -0
- package/src/api/design/create/index.ts +895 -0
- package/src/api/design/delete/index.ts +67 -0
- package/src/api/design/doors/index.ts +285 -0
- package/src/api/design/edit/index.ts +54 -0
- package/src/api/design/erase/index.ts +151 -0
- package/src/api/design/furniture/index.ts +130 -0
- package/src/api/design/index.ts +162 -0
- package/src/api/design/lock.ts +42 -0
- package/src/api/design/materials/index.ts +301 -0
- package/src/api/design/query/geometry/index.ts +166 -0
- package/src/api/design/query/index.ts +937 -0
- package/src/api/design/query/spaces.ts +132 -0
- package/src/api/design/selection/index.ts +273 -0
- package/src/api/design/shared.ts +40 -0
- package/src/api/design/transform/index.ts +93 -0
- package/src/api/design/update/index.ts +117 -0
- package/src/api/design/windows/index.ts +207 -0
- package/src/api/entity/buildableEnvelope.ts +318 -0
- package/src/api/entity/department.ts +0 -113
- package/src/api/entity/index.ts +9 -9
- package/src/api/entity/referenceLine.ts +50 -38
- package/src/api/entity/space.ts +285 -226
- package/src/api/entity/story.ts +53 -42
- package/src/api/index.ts +22 -12
- package/src/api/presentation/aiInspiration.ts +362 -0
- package/src/api/presentation/diagrams.ts +84 -0
- package/src/api/presentation/import.ts +112 -0
- package/src/api/presentation/index.ts +48 -0
- package/src/api/presentation/sheets.ts +198 -0
- package/src/api/presentation/views.ts +303 -0
- package/src/api/program/adjacency.ts +164 -0
- package/src/api/program/areas.ts +335 -0
- package/src/api/program/classification.ts +138 -0
- package/src/api/program/cores.ts +171 -0
- package/src/api/program/departments.ts +465 -0
- package/src/api/program/index.ts +71 -0
- package/src/api/program/layout.ts +68 -0
- package/src/api/program/metrics.ts +120 -0
- package/src/api/program/site.ts +419 -0
- package/src/api/program/spreadsheet.ts +2075 -0
- package/src/handles.ts +194 -0
- package/src/host-utils.ts +10 -6
- package/src/index.ts +1 -0
- package/dist/api/core/geom/arc.d.ts +0 -81
- package/dist/api/core/geom/arc.d.ts.map +0 -1
- package/dist/api/core/geom/curve.d.ts +0 -70
- package/dist/api/core/geom/curve.d.ts.map +0 -1
- package/dist/api/core/geom/line.d.ts +0 -56
- package/dist/api/core/geom/line.d.ts.map +0 -1
- package/dist/api/core/geom/profile.d.ts +0 -121
- package/dist/api/core/geom/profile.d.ts.map +0 -1
- package/dist/api/tools/copy.d.ts +0 -59
- package/dist/api/tools/copy.d.ts.map +0 -1
- package/dist/api/tools/index.d.ts +0 -33
- package/dist/api/tools/index.d.ts.map +0 -1
- package/dist/api/tools/material.d.ts +0 -51
- package/dist/api/tools/material.d.ts.map +0 -1
- package/dist/api/tools/offset.d.ts +0 -43
- package/dist/api/tools/offset.d.ts.map +0 -1
- package/dist/api/tools/selection.d.ts +0 -48
- package/dist/api/tools/selection.d.ts.map +0 -1
- package/dist/api/tools/transform.d.ts +0 -114
- package/dist/api/tools/transform.d.ts.map +0 -1
- package/dist/api/units/index.d.ts +0 -163
- package/dist/api/units/index.d.ts.map +0 -1
- package/src/api/core/geom/arc.ts +0 -70
- package/src/api/core/geom/curve.ts +0 -41
- package/src/api/core/geom/line.ts +0 -53
- package/src/api/core/geom/profile.ts +0 -94
- package/src/api/tools/copy.ts +0 -55
- package/src/api/tools/index.ts +0 -39
- package/src/api/tools/material.ts +0 -49
- package/src/api/tools/offset.ts +0 -43
- package/src/api/tools/selection.ts +0 -51
- package/src/api/tools/transform.ts +0 -117
- package/src/api/units/index.ts +0 -163
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { PluginApiReturn } from "../../types";
|
|
3
|
+
import { ComponentHandle } from "../../handles";
|
|
4
|
+
/**
|
|
5
|
+
* Analysis heatmaps — render plugin-computed scalar data as a heatmap.
|
|
6
|
+
*
|
|
7
|
+
* Unlike the built-in studies ({@linkcode PluginAnalysisSunlightHoursApi},
|
|
8
|
+
* {@linkcode PluginAnalysisIlluminanceApi}) where the host computes the
|
|
9
|
+
* values, here the **plugin brings its own numbers** and the host renders
|
|
10
|
+
* them. Two render modes:
|
|
11
|
+
*
|
|
12
|
+
* - {@linkcode PluginAnalysisHeatmapsApi.renderSpaces} — one flat colour per
|
|
13
|
+
* space, painted on the space's top face (occupancy, energy use, any
|
|
14
|
+
* per-room metric).
|
|
15
|
+
* - {@linkcode PluginAnalysisHeatmapsApi.renderGrid} — a coloured grid mesh
|
|
16
|
+
* from point samples in world coordinates (wind, noise, microclimate — any
|
|
17
|
+
* field sampled over an area).
|
|
18
|
+
*
|
|
19
|
+
* Shared semantics:
|
|
20
|
+
*
|
|
21
|
+
* - **Single active heatmap** — a render call **replaces** whatever heatmap
|
|
22
|
+
* is currently showing (from either mode).
|
|
23
|
+
* - **Legend** — the host renders a legend card from
|
|
24
|
+
* {@linkcode PluginAnalysisHeatmapOptions} (title, unit, min/max, colour
|
|
25
|
+
* segments). Values outside `[min, max]` **clamp to the end colours** and
|
|
26
|
+
* the legend shows `<` / `>` markers at the clamped ends.
|
|
27
|
+
* - **Ephemeral** — the heatmap is a transient overlay: never persisted,
|
|
28
|
+
* never saved with views, and auto-cleared when a scene-mutating edit
|
|
29
|
+
* invalidates it. Re-render after changing the model.
|
|
30
|
+
*
|
|
31
|
+
* Accessed via `snaptrude.analysis.heatmaps`.
|
|
32
|
+
*/
|
|
33
|
+
export declare abstract class PluginAnalysisHeatmapsApi {
|
|
34
|
+
constructor();
|
|
35
|
+
/**
|
|
36
|
+
* Render a per-space heatmap — one flat colour per space's top face.
|
|
37
|
+
*
|
|
38
|
+
* Each entry maps a space to a scalar value; the value is mapped through
|
|
39
|
+
* the colour ramp (see {@linkcode PluginAnalysisHeatmapOptions}) and the
|
|
40
|
+
* space's top face is painted that single flat colour. Replaces any
|
|
41
|
+
* heatmap currently showing (single active heatmap). Spaces whose top
|
|
42
|
+
* face is not flat (pitched/sloped tops) are **skipped with a console
|
|
43
|
+
* warning** — the rest of the heatmap still renders.
|
|
44
|
+
*
|
|
45
|
+
* The heatmap is ephemeral: it is auto-cleared by scene-mutating edits
|
|
46
|
+
* and is never persisted or saved with views.
|
|
47
|
+
*
|
|
48
|
+
* @param entries - One {@linkcode PluginAnalysisHeatmapSpaceEntry} per
|
|
49
|
+
* space: the space's handle and its scalar value.
|
|
50
|
+
* @param options - {@linkcode PluginAnalysisHeatmapOptions} — legend
|
|
51
|
+
* title/unit, explicit min/max range (auto-derived from the data when
|
|
52
|
+
* omitted), and the colour ramp.
|
|
53
|
+
* @returns A {@linkcode PluginAnalysisHeatmapsRenderResult} —
|
|
54
|
+
* `{ success: true }` once the heatmap is rendered.
|
|
55
|
+
* @throws When `entries` is empty or a handle does not resolve to a space.
|
|
56
|
+
* @throws When no space had a flat top face to paint (every entry was
|
|
57
|
+
* skipped).
|
|
58
|
+
* @throws When `options.min` is greater than `options.max`.
|
|
59
|
+
* @throws When a colour in `options.colors` is not a 6-digit hex colour.
|
|
60
|
+
* @throws When plugin writes are disabled.
|
|
61
|
+
*
|
|
62
|
+
* @examplePrompt Color each room by its occupancy count
|
|
63
|
+
* @examplePrompt Show my energy simulation results as a heatmap per space
|
|
64
|
+
* @examplePrompt Paint the rooms red to blue by temperature
|
|
65
|
+
*
|
|
66
|
+
* # Example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const spaces = await snaptrude.design.query.listSpaces()
|
|
69
|
+
* await snaptrude.analysis.heatmaps.renderSpaces(
|
|
70
|
+
* spaces.map((space) => ({ space, value: occupancy[space] ?? 0 })),
|
|
71
|
+
* { title: "Occupancy", unit: "people", min: 0, max: 50 },
|
|
72
|
+
* )
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
abstract renderSpaces(entries: PluginAnalysisHeatmapSpaceEntry[], options?: PluginAnalysisHeatmapOptions): PluginApiReturn<PluginAnalysisHeatmapsRenderResult>;
|
|
76
|
+
/**
|
|
77
|
+
* Render a grid heatmap — a coloured mesh from point samples.
|
|
78
|
+
*
|
|
79
|
+
* Each cell is a scalar sample at a **world-coordinate** position
|
|
80
|
+
* (**y is up** — a ground-level field sits at `y = 0`); the host builds
|
|
81
|
+
* one square cell of edge `cellSize` per sample — in the same Snaptrude
|
|
82
|
+
* internal units as `position` (convert real-world lengths via
|
|
83
|
+
* {@linkcode PluginUnitsApi.convert}) — coloured by mapping the value
|
|
84
|
+
* through the colour ramp
|
|
85
|
+
* (see {@linkcode PluginAnalysisHeatmapOptions}). This is the mode for
|
|
86
|
+
* field data — wind, noise, microclimate — sampled over an area. Replaces
|
|
87
|
+
* any heatmap currently showing (single active heatmap).
|
|
88
|
+
*
|
|
89
|
+
* The heatmap is ephemeral: it is auto-cleared by scene-mutating edits
|
|
90
|
+
* and is never persisted or saved with views.
|
|
91
|
+
*
|
|
92
|
+
* @param cells - One {@linkcode PluginAnalysisHeatmapGridCell} per
|
|
93
|
+
* sample: a world-coordinate `position` (y up) and its scalar `value`.
|
|
94
|
+
* @param cellSize - Edge length of each (square) cell, in the same
|
|
95
|
+
* Snaptrude internal units as `position` (see
|
|
96
|
+
* {@linkcode PluginUnitsApi.convert}). Must be a positive, finite number.
|
|
97
|
+
* @param options - {@linkcode PluginAnalysisHeatmapOptions} — legend
|
|
98
|
+
* title/unit, explicit min/max range (auto-derived from the data when
|
|
99
|
+
* omitted), and the colour ramp.
|
|
100
|
+
* @returns A {@linkcode PluginAnalysisHeatmapsRenderResult} —
|
|
101
|
+
* `{ success: true }` once the heatmap is rendered.
|
|
102
|
+
* @throws When `cells` is empty or `cellSize` is not a positive, finite number.
|
|
103
|
+
* @throws When `options.min` is greater than `options.max`.
|
|
104
|
+
* @throws When a colour in `options.colors` is not a 6-digit hex colour.
|
|
105
|
+
* @throws When plugin writes are disabled.
|
|
106
|
+
*
|
|
107
|
+
* @examplePrompt Overlay my CFD wind simulation results on the site
|
|
108
|
+
* @examplePrompt Render a noise-level grid around the building
|
|
109
|
+
* @examplePrompt Show these sampled microclimate values as a colored grid
|
|
110
|
+
*
|
|
111
|
+
* # Example
|
|
112
|
+
* ```ts
|
|
113
|
+
* // World coordinates are y-up: a ground-level field varies in x/z at y = 0.
|
|
114
|
+
* await snaptrude.analysis.heatmaps.renderGrid(
|
|
115
|
+
* samples.map((s) => ({ position: { x: s.x, y: 0, z: s.z }, value: s.windSpeed })),
|
|
116
|
+
* 2, // 2-unit square cells
|
|
117
|
+
* { title: "Wind speed", unit: "m/s", colors: ["#0000ff", "#00ff00", "#ff0000"] },
|
|
118
|
+
* )
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
abstract renderGrid(cells: PluginAnalysisHeatmapGridCell[], cellSize: number, options?: PluginAnalysisHeatmapOptions): PluginApiReturn<PluginAnalysisHeatmapsRenderResult>;
|
|
122
|
+
/**
|
|
123
|
+
* Clear the plugin heatmap from the scene.
|
|
124
|
+
*
|
|
125
|
+
* Un-applies the rendered heatmap (either mode) and removes its legend.
|
|
126
|
+
* A no-op (returns `false`) when no plugin heatmap is showing. Does not
|
|
127
|
+
* touch the built-in study heatmaps (`sunlightHours` / `illuminance`) —
|
|
128
|
+
* they have their own `reset`.
|
|
129
|
+
*
|
|
130
|
+
* @returns `true` when a heatmap was cleared, `false` when none was
|
|
131
|
+
* showing.
|
|
132
|
+
* @throws When plugin writes are disabled.
|
|
133
|
+
*
|
|
134
|
+
* @examplePrompt Clear my custom heatmap
|
|
135
|
+
* @examplePrompt Remove the wind overlay from the model
|
|
136
|
+
* @examplePrompt Reset the plugin heatmap view
|
|
137
|
+
*
|
|
138
|
+
* # Example
|
|
139
|
+
* ```ts
|
|
140
|
+
* await snaptrude.analysis.heatmaps.reset()
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
abstract reset(): PluginApiReturn<boolean>;
|
|
144
|
+
/**
|
|
145
|
+
* Is a plugin heatmap currently showing?
|
|
146
|
+
*
|
|
147
|
+
* `true` between a successful render and the next
|
|
148
|
+
* {@linkcode PluginAnalysisHeatmapsApi.reset} — or the scene-mutating
|
|
149
|
+
* edit that auto-clears it (heatmaps are ephemeral).
|
|
150
|
+
*
|
|
151
|
+
* @returns `true` when a plugin heatmap is rendered on the scene.
|
|
152
|
+
*
|
|
153
|
+
* @examplePrompt Is my heatmap still showing?
|
|
154
|
+
* @examplePrompt Check whether the custom heatmap is active
|
|
155
|
+
* @examplePrompt Do I need to re-render the wind overlay?
|
|
156
|
+
*
|
|
157
|
+
* # Example
|
|
158
|
+
* ```ts
|
|
159
|
+
* if (!(await snaptrude.analysis.heatmaps.isActive())) {
|
|
160
|
+
* await snaptrude.analysis.heatmaps.renderGrid(cells, 2)
|
|
161
|
+
* }
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
abstract isActive(): PluginApiReturn<boolean>;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* One space's entry in {@linkcode PluginAnalysisHeatmapsApi.renderSpaces}.
|
|
168
|
+
*
|
|
169
|
+
* | Property | Type | Description |
|
|
170
|
+
* |---|---|---|
|
|
171
|
+
* | `space` | {@linkcode ComponentHandle} | Handle of the space to colour |
|
|
172
|
+
* | `value` | `number` | The scalar value mapped to a colour |
|
|
173
|
+
*/
|
|
174
|
+
export declare const PluginAnalysisHeatmapSpaceEntry: z.ZodObject<{
|
|
175
|
+
space: z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>;
|
|
176
|
+
value: z.ZodNumber;
|
|
177
|
+
}, z.core.$strip>;
|
|
178
|
+
export type PluginAnalysisHeatmapSpaceEntry = z.infer<typeof PluginAnalysisHeatmapSpaceEntry>;
|
|
179
|
+
/**
|
|
180
|
+
* One grid sample in {@linkcode PluginAnalysisHeatmapsApi.renderGrid}.
|
|
181
|
+
*
|
|
182
|
+
* | Property | Type | Description |
|
|
183
|
+
* |---|---|---|
|
|
184
|
+
* | `position` | `{ x, y, z }` | Cell centre in **world coordinates** (y is up) |
|
|
185
|
+
* | `value` | `number` | The scalar value mapped to a colour |
|
|
186
|
+
*/
|
|
187
|
+
export declare const PluginAnalysisHeatmapGridCell: z.ZodObject<{
|
|
188
|
+
position: z.ZodObject<{
|
|
189
|
+
x: z.ZodNumber;
|
|
190
|
+
y: z.ZodNumber;
|
|
191
|
+
z: z.ZodNumber;
|
|
192
|
+
}, z.core.$strip>;
|
|
193
|
+
value: z.ZodNumber;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
export type PluginAnalysisHeatmapGridCell = z.infer<typeof PluginAnalysisHeatmapGridCell>;
|
|
196
|
+
/**
|
|
197
|
+
* Display options shared by both heatmap render modes.
|
|
198
|
+
*
|
|
199
|
+
* The colour ramp maps values to colours: `colors` is an **ordered list of
|
|
200
|
+
* hex colour stops, low → high** (e.g. `["#0000ff", "#ff0000"]`). When
|
|
201
|
+
* omitted, the host's default blue → cyan → green → yellow → red ramp is used. Values outside
|
|
202
|
+
* `[min, max]` clamp to the end colours; the legend marks the clamped ends
|
|
203
|
+
* with `<` / `>`. `min`/`max` are auto-derived from the data when omitted.
|
|
204
|
+
*
|
|
205
|
+
* | Property | Type | Description |
|
|
206
|
+
* |---|---|---|
|
|
207
|
+
* | `title` | `string \| undefined` | Legend title |
|
|
208
|
+
* | `unit` | `string \| undefined` | Unit label shown on the legend (e.g. `"m/s"`) |
|
|
209
|
+
* | `min` | `number \| undefined` | Value mapped to the first colour stop; data minimum when omitted |
|
|
210
|
+
* | `max` | `number \| undefined` | Value mapped to the last colour stop; data maximum when omitted |
|
|
211
|
+
* | `colors` | `string[] \| undefined` | Ordered 6-digit hex colour stops (e.g. `"#0000ff"`), low → high; host blue → cyan → green → yellow → red default |
|
|
212
|
+
*/
|
|
213
|
+
export declare const PluginAnalysisHeatmapOptions: z.ZodObject<{
|
|
214
|
+
title: z.ZodOptional<z.ZodString>;
|
|
215
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
216
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
217
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
218
|
+
colors: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
219
|
+
}, z.core.$strip>;
|
|
220
|
+
export type PluginAnalysisHeatmapOptions = z.infer<typeof PluginAnalysisHeatmapOptions>;
|
|
221
|
+
/**
|
|
222
|
+
* Result of {@linkcode PluginAnalysisHeatmapsApi.renderSpaces} /
|
|
223
|
+
* {@linkcode PluginAnalysisHeatmapsApi.renderGrid} — render failures throw,
|
|
224
|
+
* so a returned value always carries `success: true`.
|
|
225
|
+
*
|
|
226
|
+
* | Property | Type | Description |
|
|
227
|
+
* |---|---|---|
|
|
228
|
+
* | `success` | `true` | The heatmap is rendered on the scene |
|
|
229
|
+
*/
|
|
230
|
+
export declare const PluginAnalysisHeatmapsRenderResult: z.ZodObject<{
|
|
231
|
+
success: z.ZodLiteral<true>;
|
|
232
|
+
}, z.core.$strip>;
|
|
233
|
+
export type PluginAnalysisHeatmapsRenderResult = z.infer<typeof PluginAnalysisHeatmapsRenderResult>;
|
|
234
|
+
//# sourceMappingURL=heatmaps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heatmaps.d.ts","sourceRoot":"","sources":["../../../src/api/analysis/heatmaps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAkB,MAAM,eAAe,CAAA;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,8BAAsB,yBAAyB;;IAG7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;aACa,YAAY,CAC1B,OAAO,EAAE,+BAA+B,EAAE,EAC1C,OAAO,CAAC,EAAE,4BAA4B,GACrC,eAAe,CAAC,kCAAkC,CAAC;IAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;aACa,UAAU,CACxB,KAAK,EAAE,6BAA6B,EAAE,EACtC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,4BAA4B,GACrC,eAAe,CAAC,kCAAkC,CAAC;IAEtD;;;;;;;;;;;;;;;;;;;;OAoBG;aACa,KAAK,IAAI,eAAe,CAAC,OAAO,CAAC;IAEjD;;;;;;;;;;;;;;;;;;;OAmBG;aACa,QAAQ,IAAI,eAAe,CAAC,OAAO,CAAC;CACrD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B;;;iBAG1C,CAAA;AACF,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACnD,OAAO,+BAA+B,CACvC,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B;;;;;;;iBAGxC,CAAA;AACF,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,6BAA6B,CACrC,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,4BAA4B;;;;;;iBASvC,CAAA;AACF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,4BAA4B,CACpC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC;;iBAE7C,CAAA;AACF,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CACtD,OAAO,kCAAkC,CAC1C,CAAA"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { PluginApiReturn } from "../../types";
|
|
2
|
+
import { PluginAnalysisComputeResult, PluginAnalysisJobStateResult } from "./sunlightHours";
|
|
3
|
+
/**
|
|
4
|
+
* Analysis illuminance — the daylight illuminance (lux) heatmap study.
|
|
5
|
+
*
|
|
6
|
+
* Computes interior daylight illuminance over a date range and renders the
|
|
7
|
+
* result as a heatmap on the scene. **Pro-gated**: every method that starts
|
|
8
|
+
* a run throws when the workspace is not on a Pro plan.
|
|
9
|
+
*
|
|
10
|
+
* Like {@linkcode PluginAnalysisSunlightHoursApi} (`analysis.sunlightHours`),
|
|
11
|
+
* this is an **asynchronous backend job**:
|
|
12
|
+
*
|
|
13
|
+
* 1. {@linkcode PluginAnalysisIlluminanceApi.compute} starts the job and
|
|
14
|
+
* returns immediately.
|
|
15
|
+
* 2. Poll {@linkcode PluginAnalysisIlluminanceApi.get} until `status` is
|
|
16
|
+
* `"active"` (heatmap rendered) — a run typically takes minutes. There is
|
|
17
|
+
* no completion event; polling is the pattern.
|
|
18
|
+
* 3. {@linkcode PluginAnalysisIlluminanceApi.cancel} aborts an in-flight
|
|
19
|
+
* run; {@linkcode PluginAnalysisIlluminanceApi.reset} clears a rendered
|
|
20
|
+
* heatmap.
|
|
21
|
+
*
|
|
22
|
+
* Illuminance analyses BIM slab and roof objects (floors, roofs, …) — walls
|
|
23
|
+
* or bare Masses are not enough — and requires the 3D view. Heatmaps are invalidated by
|
|
24
|
+
* scene-mutating edits. Dates cross as ISO 8601 date strings
|
|
25
|
+
* (`"YYYY-MM-DD"`).
|
|
26
|
+
*
|
|
27
|
+
* Accessed via `snaptrude.analysis.illuminance`.
|
|
28
|
+
*/
|
|
29
|
+
export declare abstract class PluginAnalysisIlluminanceApi {
|
|
30
|
+
constructor();
|
|
31
|
+
/**
|
|
32
|
+
* Start a daylight-illuminance run for a date range.
|
|
33
|
+
*
|
|
34
|
+
* Starts the backend job and **returns immediately** — it does not wait
|
|
35
|
+
* for the heatmap. Poll {@linkcode PluginAnalysisIlluminanceApi.get} until
|
|
36
|
+
* `status` is `"active"`. Starting a new run while one is in flight
|
|
37
|
+
* replaces it. Shadows and the heatmap analyses are mutually exclusive in
|
|
38
|
+
* the product: starting a run disables real-time shadows and resets/cancels
|
|
39
|
+
* any {@linkcode PluginAnalysisSunlightHoursApi}
|
|
40
|
+
* (`analysis.sunlightHours`) study.
|
|
41
|
+
*
|
|
42
|
+
* @param startDate - Start of the study range, ISO date `"YYYY-MM-DD"`.
|
|
43
|
+
* @param endDate - End of the study range, ISO date `"YYYY-MM-DD"` (on or
|
|
44
|
+
* after `startDate`).
|
|
45
|
+
* @returns A {@linkcode PluginAnalysisComputeResult} — `{ success: true }`
|
|
46
|
+
* when the job was started. The `{ success: false, error }` arm is
|
|
47
|
+
* reserved — not yet emitted (start failures currently throw).
|
|
48
|
+
* @throws When the workspace is not on a **Pro** plan (illuminance is a
|
|
49
|
+
* Pro feature).
|
|
50
|
+
* @throws When the project has no geo-located site/terrain (no location to
|
|
51
|
+
* compute daylight for — there is no fallback location).
|
|
52
|
+
* @throws When the scene has no slab or roof BIM object to analyse (walls
|
|
53
|
+
* or bare Masses are not enough) or the editor is not in the 3D view.
|
|
54
|
+
* @throws When a date is not a parseable ISO date or the range is inverted.
|
|
55
|
+
* @throws When plugin writes are disabled.
|
|
56
|
+
*
|
|
57
|
+
* @examplePrompt Run a daylight illuminance analysis for December
|
|
58
|
+
* @examplePrompt Compute the lux levels inside the building for winter
|
|
59
|
+
* @examplePrompt How much daylight do the interior floors get?
|
|
60
|
+
*
|
|
61
|
+
* # Example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const { success } = await snaptrude.analysis.illuminance.compute(
|
|
64
|
+
* "2026-12-01",
|
|
65
|
+
* "2026-12-31",
|
|
66
|
+
* )
|
|
67
|
+
* // poll until the heatmap is rendered
|
|
68
|
+
* let job = await snaptrude.analysis.illuminance.get()
|
|
69
|
+
* while (job?.status === "running") {
|
|
70
|
+
* await new Promise((r) => setTimeout(r, 5000))
|
|
71
|
+
* job = await snaptrude.analysis.illuminance.get()
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
abstract compute(startDate: string, endDate: string): PluginApiReturn<PluginAnalysisComputeResult>;
|
|
76
|
+
/**
|
|
77
|
+
* Get the state of the illuminance study.
|
|
78
|
+
*
|
|
79
|
+
* The polling read for the async job started by
|
|
80
|
+
* {@linkcode PluginAnalysisIlluminanceApi.compute}. `status` values:
|
|
81
|
+
*
|
|
82
|
+
* | Status | Meaning |
|
|
83
|
+
* |---|---|
|
|
84
|
+
* | `"running"` | A run is in flight — keep polling |
|
|
85
|
+
* | `"active"` | The heatmap is rendered on the scene |
|
|
86
|
+
* | `"inactive"` | A previous run exists but its heatmap is not showing |
|
|
87
|
+
*
|
|
88
|
+
* @returns A {@linkcode PluginAnalysisJobStateResult} with the `status` and
|
|
89
|
+
* the run's ISO `startDate`/`endDate`, or `null` when no run result is
|
|
90
|
+
* available (the study never ran, was cancelled, or the last run failed).
|
|
91
|
+
*
|
|
92
|
+
* @examplePrompt Is the illuminance analysis done?
|
|
93
|
+
* @examplePrompt Check the status of the daylight lux run
|
|
94
|
+
* @examplePrompt What date range was the illuminance heatmap computed for?
|
|
95
|
+
*
|
|
96
|
+
* # Example
|
|
97
|
+
* ```ts
|
|
98
|
+
* const job = await snaptrude.analysis.illuminance.get()
|
|
99
|
+
* if (job?.status === "active") console.log(job.startDate, job.endDate)
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
abstract get(): PluginApiReturn<PluginAnalysisJobStateResult>;
|
|
103
|
+
/**
|
|
104
|
+
* Cancel the in-flight illuminance run.
|
|
105
|
+
*
|
|
106
|
+
* Aborts the backend job. A no-op (returns `false`) when nothing is
|
|
107
|
+
* running.
|
|
108
|
+
*
|
|
109
|
+
* @returns `true` when a run was cancelled, `false` when nothing was
|
|
110
|
+
* running.
|
|
111
|
+
* @throws When plugin writes are disabled.
|
|
112
|
+
*
|
|
113
|
+
* @examplePrompt Cancel the illuminance analysis
|
|
114
|
+
* @examplePrompt Stop the running daylight computation
|
|
115
|
+
* @examplePrompt Abort the lux study
|
|
116
|
+
*
|
|
117
|
+
* # Example
|
|
118
|
+
* ```ts
|
|
119
|
+
* await snaptrude.analysis.illuminance.cancel()
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
abstract cancel(): PluginApiReturn<boolean>;
|
|
123
|
+
/**
|
|
124
|
+
* Clear the illuminance heatmap from the scene.
|
|
125
|
+
*
|
|
126
|
+
* Un-applies the rendered heatmap and restores the normal material view.
|
|
127
|
+
* A no-op (returns `false`) when no heatmap is showing. Does not cancel an
|
|
128
|
+
* in-flight run — use {@linkcode PluginAnalysisIlluminanceApi.cancel}.
|
|
129
|
+
*
|
|
130
|
+
* @returns `true` when a heatmap was cleared, `false` when none was
|
|
131
|
+
* showing.
|
|
132
|
+
* @throws When plugin writes are disabled.
|
|
133
|
+
*
|
|
134
|
+
* @examplePrompt Clear the illuminance heatmap
|
|
135
|
+
* @examplePrompt Remove the daylight lux colours from the model
|
|
136
|
+
* @examplePrompt Reset the illuminance analysis view
|
|
137
|
+
*
|
|
138
|
+
* # Example
|
|
139
|
+
* ```ts
|
|
140
|
+
* await snaptrude.analysis.illuminance.reset()
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
abstract reset(): PluginApiReturn<boolean>;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=illuminance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"illuminance.d.ts","sourceRoot":"","sources":["../../../src/api/analysis/illuminance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,iBAAiB,CAAA;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,8BAAsB,4BAA4B;;IAGhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;aACa,OAAO,CACrB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACd,eAAe,CAAC,2BAA2B,CAAC;IAE/C;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;aACa,GAAG,IAAI,eAAe,CAAC,4BAA4B,CAAC;IAEpE;;;;;;;;;;;;;;;;;;OAkBG;aACa,MAAM,IAAI,eAAe,CAAC,OAAO,CAAC;IAElD;;;;;;;;;;;;;;;;;;;OAmBG;aACa,KAAK,IAAI,eAAe,CAAC,OAAO,CAAC;CAClD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { PluginAnalysisSunpathApi } from "./sunpath";
|
|
2
|
+
import { PluginAnalysisShadowsApi } from "./shadows";
|
|
3
|
+
import { PluginAnalysisSunlightHoursApi } from "./sunlightHours";
|
|
4
|
+
import { PluginAnalysisIlluminanceApi } from "./illuminance";
|
|
5
|
+
import { PluginAnalysisHeatmapsApi } from "./heatmaps";
|
|
6
|
+
/**
|
|
7
|
+
* Sustainability-analysis APIs.
|
|
8
|
+
*
|
|
9
|
+
* Analysis is the environmental-performance layer: sun and daylight studies
|
|
10
|
+
* computed for the project's geo-located site. The synchronous visual
|
|
11
|
+
* overlays (sun-path diagram, real-time shadows) toggle instantly; the
|
|
12
|
+
* heatmap studies (direct sunlight hours, daylight illuminance) are
|
|
13
|
+
* asynchronous backend jobs — start them, poll their state, and cancel or
|
|
14
|
+
* clear them. Shadows and the heatmap analyses are **mutually exclusive**
|
|
15
|
+
* (enabling one resets the other), exactly as in the sustainability sidebar.
|
|
16
|
+
* Site inputs (location, true north) are read via `program.site`.
|
|
17
|
+
*
|
|
18
|
+
* - {@linkcode PluginAnalysisApi.sunpath} — Toggle & query the sun-path diagram overlay
|
|
19
|
+
* - {@linkcode PluginAnalysisApi.shadows} — Toggle real-time shadows and scrub the sun's date-time
|
|
20
|
+
* - {@linkcode PluginAnalysisApi.sunlightHours} — Direct-sunlight-hours heatmap job (start / poll / cancel / clear)
|
|
21
|
+
* - {@linkcode PluginAnalysisApi.illuminance} — Daylight-illuminance heatmap job, Pro-gated (start / poll / cancel / clear)
|
|
22
|
+
* - {@linkcode PluginAnalysisApi.heatmaps} — Render plugin-computed scalar data as a heatmap (per-space / grid)
|
|
23
|
+
*
|
|
24
|
+
* Accessed via `snaptrude.analysis`.
|
|
25
|
+
*/
|
|
26
|
+
export declare abstract class PluginAnalysisApi {
|
|
27
|
+
/** Sun-path diagram overlay — enable/disable/isActive. See {@linkcode PluginAnalysisSunpathApi}. */
|
|
28
|
+
abstract sunpath: PluginAnalysisSunpathApi;
|
|
29
|
+
/** Real-time sun shadows + sun date-time. See {@linkcode PluginAnalysisShadowsApi}. */
|
|
30
|
+
abstract shadows: PluginAnalysisShadowsApi;
|
|
31
|
+
/** Direct-sunlight-hours heatmap job. See {@linkcode PluginAnalysisSunlightHoursApi}. */
|
|
32
|
+
abstract sunlightHours: PluginAnalysisSunlightHoursApi;
|
|
33
|
+
/** Daylight-illuminance heatmap job (Pro). See {@linkcode PluginAnalysisIlluminanceApi}. */
|
|
34
|
+
abstract illuminance: PluginAnalysisIlluminanceApi;
|
|
35
|
+
/** Plugin-supplied scalar-data heatmaps. See {@linkcode PluginAnalysisHeatmapsApi}. */
|
|
36
|
+
abstract heatmaps: PluginAnalysisHeatmapsApi;
|
|
37
|
+
constructor();
|
|
38
|
+
}
|
|
39
|
+
export * from "./sunpath";
|
|
40
|
+
export * from "./shadows";
|
|
41
|
+
export * from "./sunlightHours";
|
|
42
|
+
export * from "./illuminance";
|
|
43
|
+
export * from "./heatmaps";
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/analysis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AACpD,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAEtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8BAAsB,iBAAiB;IACrC,oGAAoG;IACpG,SAAgB,OAAO,EAAE,wBAAwB,CAAA;IACjD,uFAAuF;IACvF,SAAgB,OAAO,EAAE,wBAAwB,CAAA;IACjD,yFAAyF;IACzF,SAAgB,aAAa,EAAE,8BAA8B,CAAA;IAC7D,4FAA4F;IAC5F,SAAgB,WAAW,EAAE,4BAA4B,CAAA;IACzD,uFAAuF;IACvF,SAAgB,QAAQ,EAAE,yBAAyB,CAAA;;CAGpD;AAED,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { PluginApiReturn } from "../../types";
|
|
3
|
+
/**
|
|
4
|
+
* Analysis shadows — real-time sun shadows in the scene.
|
|
5
|
+
*
|
|
6
|
+
* Shadows are cast for the sun position at a specific date and time at the
|
|
7
|
+
* project's geographic location. The date-time crosses this API as an **ISO
|
|
8
|
+
* 8601 date-time string** in the project's local time (e.g.
|
|
9
|
+
* `"2026-06-21T14:30"`); the engine snaps the time **down** to its half-hour
|
|
10
|
+
* grid (`14:59` → `14:30`); seconds, if provided, are discarded. The
|
|
11
|
+
* timezone is derived from the site location by the engine — do not append
|
|
12
|
+
* a UTC offset.
|
|
13
|
+
*
|
|
14
|
+
* Methods that position the sun **throw** when the project has no geo-located
|
|
15
|
+
* site/terrain — there is no fallback location. Set the site location first;
|
|
16
|
+
* read it via `program.site.getLocation`.
|
|
17
|
+
*
|
|
18
|
+
* Accessed via `snaptrude.analysis.shadows`.
|
|
19
|
+
*/
|
|
20
|
+
export declare abstract class PluginAnalysisShadowsApi {
|
|
21
|
+
constructor();
|
|
22
|
+
/**
|
|
23
|
+
* Turn real-time sun shadows ON, optionally at a specific date and time.
|
|
24
|
+
*
|
|
25
|
+
* Without `options.dateTime` the shadows use the current stored sun
|
|
26
|
+
* position; with it, the sun is moved first (same as
|
|
27
|
+
* {@linkcode PluginAnalysisShadowsApi.setDateTime}). Enabling shadows
|
|
28
|
+
* resets any active heatmap analysis (`sunlightHours` / `illuminance`) —
|
|
29
|
+
* they are mutually exclusive in the product.
|
|
30
|
+
*
|
|
31
|
+
* @param options - Optional `dateTime`: ISO 8601 local date-time to
|
|
32
|
+
* position the sun at (snapped to the engine's half-hour grid).
|
|
33
|
+
* @returns `true` — shadows are enabled after the call.
|
|
34
|
+
* @throws When the project has no geo-located site/terrain.
|
|
35
|
+
* @throws When `options.dateTime` is not a parseable ISO date-time.
|
|
36
|
+
* @throws When plugin writes are disabled.
|
|
37
|
+
*
|
|
38
|
+
* @examplePrompt Turn on shadows
|
|
39
|
+
* @examplePrompt Show the shadows at 3pm on June 21st
|
|
40
|
+
* @examplePrompt Enable sun shadows for the summer solstice afternoon
|
|
41
|
+
*
|
|
42
|
+
* # Example
|
|
43
|
+
* ```ts
|
|
44
|
+
* await snaptrude.analysis.shadows.enable({ dateTime: "2026-06-21T15:00" })
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
abstract enable(options?: PluginAnalysisShadowsEnableOptions): PluginApiReturn<boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* Turn real-time sun shadows OFF.
|
|
50
|
+
*
|
|
51
|
+
* A no-op (returns `false`) when shadows are already off. The stored sun
|
|
52
|
+
* date-time is kept for the next enable.
|
|
53
|
+
*
|
|
54
|
+
* @returns `false` — shadows are disabled after the call.
|
|
55
|
+
* @throws When plugin writes are disabled.
|
|
56
|
+
*
|
|
57
|
+
* @examplePrompt Turn off shadows
|
|
58
|
+
* @examplePrompt Hide the sun shadows
|
|
59
|
+
* @examplePrompt Disable shadow rendering in the scene
|
|
60
|
+
*
|
|
61
|
+
* # Example
|
|
62
|
+
* ```ts
|
|
63
|
+
* await snaptrude.analysis.shadows.disable()
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
abstract disable(): PluginApiReturn<boolean>;
|
|
67
|
+
/**
|
|
68
|
+
* Whether real-time sun shadows are currently enabled.
|
|
69
|
+
*
|
|
70
|
+
* A pure read — never mutates, never throws.
|
|
71
|
+
*
|
|
72
|
+
* @returns `true` when shadows are rendering.
|
|
73
|
+
*
|
|
74
|
+
* @examplePrompt Are shadows on?
|
|
75
|
+
* @examplePrompt Check whether sun shadows are enabled
|
|
76
|
+
* @examplePrompt Is the scene showing shadows right now?
|
|
77
|
+
*
|
|
78
|
+
* # Example
|
|
79
|
+
* ```ts
|
|
80
|
+
* const on = await snaptrude.analysis.shadows.isEnabled()
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
abstract isEnabled(): PluginApiReturn<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* Move the sun to a specific date and time.
|
|
86
|
+
*
|
|
87
|
+
* Takes an ISO 8601 date-time string in the project's local time; the
|
|
88
|
+
* engine snaps the time down to its half-hour grid and re-renders the shadows
|
|
89
|
+
* (when they are enabled). The engine stores no year — only the month, day,
|
|
90
|
+
* and time are applied, and the returned date-time always carries the
|
|
91
|
+
* **current year** (setting `"2020-12-21T09:30"` returns
|
|
92
|
+
* `"2026-12-21T09:30"` in 2026). Paired with
|
|
93
|
+
* {@linkcode PluginAnalysisShadowsApi.getDateTime}.
|
|
94
|
+
*
|
|
95
|
+
* @param dateTime - ISO 8601 local date-time, e.g. `"2026-12-21T09:30"`.
|
|
96
|
+
* @returns A {@linkcode PluginAnalysisShadowsDateTimeResult} — the applied
|
|
97
|
+
* ISO date-time after half-hour snapping.
|
|
98
|
+
* @throws When the project has no geo-located site/terrain.
|
|
99
|
+
* @throws When `dateTime` is not a parseable ISO date-time.
|
|
100
|
+
* @throws When plugin writes are disabled.
|
|
101
|
+
*
|
|
102
|
+
* @examplePrompt Set the shadow time to 9:30 am on the winter solstice
|
|
103
|
+
* @examplePrompt Move the sun to noon on March 1st
|
|
104
|
+
* @examplePrompt Change the shadow study date to December 21
|
|
105
|
+
*
|
|
106
|
+
* # Example
|
|
107
|
+
* ```ts
|
|
108
|
+
* const applied = await snaptrude.analysis.shadows.setDateTime("2026-12-21T09:30")
|
|
109
|
+
* console.log(applied) // "2026-12-21T09:30" (snapped to the half-hour grid)
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
abstract setDateTime(dateTime: string): PluginApiReturn<PluginAnalysisShadowsDateTimeResult>;
|
|
113
|
+
/**
|
|
114
|
+
* Get the sun's current date and time.
|
|
115
|
+
*
|
|
116
|
+
* Returns the stored sun position as an ISO 8601 local date-time string —
|
|
117
|
+
* the value shadows render at (whether or not they are enabled). The engine
|
|
118
|
+
* stores no year, so the returned string always carries the **current
|
|
119
|
+
* year**, whatever year was passed to
|
|
120
|
+
* {@linkcode PluginAnalysisShadowsApi.setDateTime} (its pair).
|
|
121
|
+
*
|
|
122
|
+
* @returns A {@linkcode PluginAnalysisShadowsDateTimeResult} — the current
|
|
123
|
+
* ISO local date-time of the sun.
|
|
124
|
+
*
|
|
125
|
+
* @examplePrompt What date and time are the shadows set to?
|
|
126
|
+
* @examplePrompt Get the current sun position date
|
|
127
|
+
* @examplePrompt Which time of day is the shadow study showing?
|
|
128
|
+
*
|
|
129
|
+
* # Example
|
|
130
|
+
* ```ts
|
|
131
|
+
* const dateTime = await snaptrude.analysis.shadows.getDateTime()
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
abstract getDateTime(): PluginApiReturn<PluginAnalysisShadowsDateTimeResult>;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Options for {@linkcode PluginAnalysisShadowsApi.enable}.
|
|
138
|
+
*
|
|
139
|
+
* | Property | Type | Description |
|
|
140
|
+
* |---|---|---|
|
|
141
|
+
* | `dateTime` | `string \| undefined` | ISO 8601 local date-time to position the sun at (snapped to the half-hour grid) |
|
|
142
|
+
*/
|
|
143
|
+
export declare const PluginAnalysisShadowsEnableOptions: z.ZodObject<{
|
|
144
|
+
dateTime: z.ZodOptional<z.ZodString>;
|
|
145
|
+
}, z.core.$strip>;
|
|
146
|
+
export type PluginAnalysisShadowsEnableOptions = z.infer<typeof PluginAnalysisShadowsEnableOptions>;
|
|
147
|
+
/**
|
|
148
|
+
* Arguments for {@linkcode PluginAnalysisShadowsApi.setDateTime}.
|
|
149
|
+
*
|
|
150
|
+
* | Property | Type | Description |
|
|
151
|
+
* |---|---|---|
|
|
152
|
+
* | `dateTime` | `string` | ISO 8601 local date-time, e.g. `"2026-06-21T14:30"` |
|
|
153
|
+
*/
|
|
154
|
+
export declare const PluginAnalysisShadowsSetDateTimeArgs: z.ZodObject<{
|
|
155
|
+
dateTime: z.ZodString;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
export type PluginAnalysisShadowsSetDateTimeArgs = z.infer<typeof PluginAnalysisShadowsSetDateTimeArgs>;
|
|
158
|
+
/**
|
|
159
|
+
* Result of {@linkcode PluginAnalysisShadowsApi.setDateTime} /
|
|
160
|
+
* {@linkcode PluginAnalysisShadowsApi.getDateTime} — the sun's ISO 8601
|
|
161
|
+
* local date-time (minute precision, on the engine's half-hour grid).
|
|
162
|
+
*/
|
|
163
|
+
export declare const PluginAnalysisShadowsDateTimeResult: z.ZodString;
|
|
164
|
+
export type PluginAnalysisShadowsDateTimeResult = z.infer<typeof PluginAnalysisShadowsDateTimeResult>;
|
|
165
|
+
//# sourceMappingURL=shadows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shadows.d.ts","sourceRoot":"","sources":["../../../src/api/analysis/shadows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C;;;;;;;;;;;;;;;;GAgBG;AACH,8BAAsB,wBAAwB;;IAG5C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;aACa,MAAM,CACpB,OAAO,CAAC,EAAE,kCAAkC,GAC3C,eAAe,CAAC,OAAO,CAAC;IAE3B;;;;;;;;;;;;;;;;;OAiBG;aACa,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC;IAEnD;;;;;;;;;;;;;;;OAeG;aACa,SAAS,IAAI,eAAe,CAAC,OAAO,CAAC;IAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;aACa,WAAW,CACzB,QAAQ,EAAE,MAAM,GACf,eAAe,CAAC,mCAAmC,CAAC;IAEvD;;;;;;;;;;;;;;;;;;;;OAoBG;aACa,WAAW,IAAI,eAAe,CAAC,mCAAmC,CAAC;CACpF;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kCAAkC;;iBAE7C,CAAA;AACF,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CACtD,OAAO,kCAAkC,CAC1C,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oCAAoC;;iBAE/C,CAAA;AACF,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CACxD,OAAO,oCAAoC,CAC5C,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,aAAa,CAAA;AAC7D,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,mCAAmC,CAC3C,CAAA"}
|