@snaptrude/plugin-core 0.8.0 → 0.9.1
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 +35 -1
- package/api-manifest.full.json +1350 -89
- package/api-manifest.json +1146 -48
- 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 +438 -14
- package/dist/api/analysis/heatmaps.d.ts.map +1 -1
- package/dist/api/analysis/index.d.ts +15 -0
- package/dist/api/analysis/index.d.ts.map +1 -1
- package/dist/api/analysis/solar.d.ts +249 -0
- package/dist/api/analysis/solar.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 +37 -0
- package/dist/api/core/camera/index.d.ts.map +1 -1
- package/dist/api/core/geom/create/index.d.ts +318 -1
- package/dist/api/core/geom/create/index.d.ts.map +1 -1
- package/dist/api/core/index.d.ts +9 -0
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/io/export/index.d.ts +3 -1
- package/dist/api/core/io/export/index.d.ts.map +1 -1
- package/dist/api/core/io/import/index.d.ts +61 -0
- package/dist/api/core/io/import/index.d.ts.map +1 -1
- package/dist/api/core/io/terrain/index.d.ts +132 -0
- package/dist/api/core/io/terrain/index.d.ts.map +1 -1
- 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/storeys/index.d.ts +251 -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/zoom/index.d.ts +4 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -1
- package/dist/api/design/create/index.d.ts +115 -4
- 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/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 +4 -0
- 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 +173 -0
- package/dist/api/design/query/spaces.d.ts.map +1 -1
- package/dist/api/design/transform/index.d.ts +12 -0
- package/dist/api/design/transform/index.d.ts.map +1 -1
- package/dist/api/design/update/index.d.ts +51 -1
- package/dist/api/design/update/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 +8 -0
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/story.d.ts +20 -0
- package/dist/api/entity/story.d.ts.map +1 -1
- package/dist/api/index.d.ts +5 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/presentation/annotate.d.ts +23 -4
- package/dist/api/presentation/annotate.d.ts.map +1 -1
- package/dist/api/presentation/diagrams.d.ts +64 -2
- package/dist/api/presentation/diagrams.d.ts.map +1 -1
- package/dist/api/presentation/export.d.ts +4 -0
- package/dist/api/presentation/export.d.ts.map +1 -1
- package/dist/api/presentation/import.d.ts +6 -0
- package/dist/api/presentation/import.d.ts.map +1 -1
- package/dist/api/presentation/index.d.ts +20 -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 +42 -0
- 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/program/site.d.ts +260 -2
- package/dist/api/program/site.d.ts.map +1 -1
- package/dist/api/program/spreadsheet.d.ts +260 -28
- 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/index.cjs +2904 -1761
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2762 -1761
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/scripts/generate-manifest.mjs +45 -0
- package/src/api/analysis/daylight.ts +470 -0
- package/src/api/analysis/heatmaps.ts +444 -17
- package/src/api/analysis/index.ts +15 -0
- package/src/api/analysis/solar.ts +237 -0
- package/src/api/analysis/weather.ts +179 -0
- package/src/api/core/camera/index.ts +39 -0
- package/src/api/core/geom/create/index.ts +344 -1
- package/src/api/core/index.ts +9 -0
- package/src/api/core/io/export/index.ts +3 -1
- package/src/api/core/io/import/index.ts +64 -0
- package/src/api/core/io/terrain/index.ts +143 -0
- package/src/api/core/mode/index.ts +96 -0
- package/src/api/core/storeys/index.ts +279 -0
- package/src/api/core/tags.ts +27 -0
- package/src/api/core/zoom/index.ts +4 -0
- package/src/api/design/create/index.ts +138 -1
- package/src/api/design/delete/index.ts +3 -0
- package/src/api/design/query/geometry/index.ts +125 -3
- package/src/api/design/query/index.ts +4 -0
- package/src/api/design/query/referenceLines.ts +52 -0
- package/src/api/design/query/spaces.ts +143 -0
- package/src/api/design/transform/index.ts +12 -0
- package/src/api/design/update/index.ts +66 -1
- package/src/api/entity/buildableEnvelope.ts +4 -0
- package/src/api/entity/referenceLine.ts +8 -0
- package/src/api/entity/story.ts +20 -0
- package/src/api/index.ts +5 -0
- package/src/api/presentation/annotate.ts +27 -2
- package/src/api/presentation/diagrams.ts +67 -2
- package/src/api/presentation/export.ts +4 -0
- package/src/api/presentation/import.ts +6 -0
- package/src/api/presentation/index.ts +20 -1
- package/src/api/presentation/placedViews.ts +1120 -0
- package/src/api/presentation/shapes.ts +274 -0
- package/src/api/presentation/sheets.ts +54 -0
- package/src/api/presentation/slideshow.ts +134 -0
- package/src/api/presentation/tables.ts +84 -0
- package/src/api/program/site.ts +205 -2
- package/src/api/program/spreadsheet.ts +251 -6
- package/src/api/workspace/index.ts +563 -0
|
@@ -18,6 +18,9 @@ import {
|
|
|
18
18
|
* {@linkcode ContourHandle} for its footprint outline;
|
|
19
19
|
* {@linkcode PluginDesignQueryGeometryApi.getCenterline} mints a
|
|
20
20
|
* {@linkcode CurveHandle} for a wall's core curve.
|
|
21
|
+
* {@linkcode PluginDesignQueryGeometryApi.getTriangulatedMeshes} is the
|
|
22
|
+
* handle-free exception: it returns the triangulated render meshes as plain
|
|
23
|
+
* world-space arrays.
|
|
21
24
|
*
|
|
22
25
|
* Returned handles are session-ephemeral and go stale on undo/redo/re-topologize
|
|
23
26
|
* — re-fetch a fresh one after edits.
|
|
@@ -48,7 +51,7 @@ export abstract class PluginDesignQueryGeometryApi {
|
|
|
48
51
|
* ```
|
|
49
52
|
*/
|
|
50
53
|
public abstract getBrep(
|
|
51
|
-
component: ComponentHandle
|
|
54
|
+
component: ComponentHandle,
|
|
52
55
|
): PluginApiReturn<BrepHandle | null>
|
|
53
56
|
|
|
54
57
|
/**
|
|
@@ -80,7 +83,7 @@ export abstract class PluginDesignQueryGeometryApi {
|
|
|
80
83
|
* ```
|
|
81
84
|
*/
|
|
82
85
|
public abstract getBottomContour(
|
|
83
|
-
component: ComponentHandle
|
|
86
|
+
component: ComponentHandle,
|
|
84
87
|
): PluginApiReturn<ContourHandle | null>
|
|
85
88
|
|
|
86
89
|
/**
|
|
@@ -116,8 +119,67 @@ export abstract class PluginDesignQueryGeometryApi {
|
|
|
116
119
|
* ```
|
|
117
120
|
*/
|
|
118
121
|
public abstract getCenterline(
|
|
119
|
-
component: ComponentHandle
|
|
122
|
+
component: ComponentHandle,
|
|
120
123
|
): PluginApiReturn<CurveHandle | null>
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Get the **triangulated render meshes** of scene components as plain,
|
|
127
|
+
* serializable arrays — flat world-space vertex `positions` (`[x0, y0, z0,
|
|
128
|
+
* x1, …]`) and triangle `indices` (three per triangle), one record per
|
|
129
|
+
* requested component.
|
|
130
|
+
*
|
|
131
|
+
* Unlike the other `geometry.*` reads this does NOT mint kernel handles — the
|
|
132
|
+
* raw arrays cross the boundary directly, ready for export, custom analysis,
|
|
133
|
+
* or feeding an external renderer. Positions are **always world-space**
|
|
134
|
+
* (instance/transform baked in; there is no local-coordinates mode) in plan
|
|
135
|
+
* units — no conversion needed. Raw doubles, unrounded.
|
|
136
|
+
*
|
|
137
|
+
* With `includeMaterialIds: true` each record also carries `materialIds`: one
|
|
138
|
+
* entry **per triangle** (`indices.length / 3` entries), the material *name*
|
|
139
|
+
* painted on that triangle, or `null` for unpainted/default faces.
|
|
140
|
+
*
|
|
141
|
+
* With `includeFaceIndices: true` each record also carries `faceIds`: one
|
|
142
|
+
* entry **per triangle** (input order), the B-rep face index owning that
|
|
143
|
+
* triangle (same ids as {@linkcode getBrep} faces), or `null` where there is
|
|
144
|
+
* no provenance. Non-B-rep meshes (Revit imports, generic models, furniture)
|
|
145
|
+
* yield all-`null` rather than an error.
|
|
146
|
+
*
|
|
147
|
+
* A resolvable component with no readable mesh geometry yields
|
|
148
|
+
* `{ id, positions: [], indices: [] }` — nothing is silently omitted.
|
|
149
|
+
*
|
|
150
|
+
* The call is capped at **500 000 triangles total**; over the cap it throws a
|
|
151
|
+
* `VALIDATION` error whose message includes the actual total — split the
|
|
152
|
+
* component list into smaller batches and call again.
|
|
153
|
+
*
|
|
154
|
+
* @param components - The scene components to triangulate
|
|
155
|
+
* @param options - `includeMaterialIds` adds the per-triangle material names;
|
|
156
|
+
* `includeFaceIndices` adds the per-triangle B-rep face indices
|
|
157
|
+
* @returns `{ meshes }` — one {@linkcode PluginTriangulatedMesh} per requested
|
|
158
|
+
* component, in input order
|
|
159
|
+
* @throws `HANDLE_INVALID` if any component handle is gone/forged;
|
|
160
|
+
* `VALIDATION` if the combined mesh exceeds 500 000 triangles
|
|
161
|
+
*
|
|
162
|
+
* @examplePrompt Export the selected masses as a triangle mesh
|
|
163
|
+
* @examplePrompt Get the raw vertices and triangles of this wall in world coordinates
|
|
164
|
+
* @examplePrompt Give me the triangulated geometry of every space with its materials
|
|
165
|
+
* @examplePrompt Compute the surface area of this roof from its triangles
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```ts
|
|
169
|
+
* const spaces = await snaptrude.design.query.listSpaces()
|
|
170
|
+
* const { meshes } = await snaptrude.design.query.geometry.getTriangulatedMeshes(spaces, {
|
|
171
|
+
* includeMaterialIds: true,
|
|
172
|
+
* })
|
|
173
|
+
* for (const mesh of meshes) {
|
|
174
|
+
* const triangleCount = mesh.indices.length / 3
|
|
175
|
+
* console.log(mesh.id, triangleCount, mesh.materialIds?.[0])
|
|
176
|
+
* }
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
public abstract getTriangulatedMeshes(
|
|
180
|
+
components: ComponentHandle[],
|
|
181
|
+
options?: PluginDesignQueryGeometryGetTriangulatedMeshesArgs["options"],
|
|
182
|
+
): PluginApiReturn<PluginDesignQueryGeometryGetTriangulatedMeshesResult>
|
|
121
183
|
}
|
|
122
184
|
|
|
123
185
|
/**
|
|
@@ -164,3 +226,63 @@ export const PluginDesignQueryGeometryGetCenterlineArgs = z.object({
|
|
|
164
226
|
export type PluginDesignQueryGeometryGetCenterlineArgs = z.infer<
|
|
165
227
|
typeof PluginDesignQueryGeometryGetCenterlineArgs
|
|
166
228
|
>
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* One component's triangulated world-space mesh, as plain serializable arrays
|
|
232
|
+
* (no handles).
|
|
233
|
+
*
|
|
234
|
+
* | Property | Type | Description |
|
|
235
|
+
* |---|---|---|
|
|
236
|
+
* | `id` | `string` | The component's id (its {@linkcode ComponentHandle} token) |
|
|
237
|
+
* | `positions` | `number[]` | Flat world-space vertex coordinates `[x0, y0, z0, x1, …]`, plan units, raw doubles |
|
|
238
|
+
* | `indices` | `number[]` | Triangle vertex indices, three per triangle, into `positions / 3` |
|
|
239
|
+
* | `materialIds` | `(string \| null)[]` _(optional)_ | One entry per triangle: the painted material's name, `null` for unpainted/default faces. Present only when requested via `includeMaterialIds` |
|
|
240
|
+
* | `faceIds` | `(number \| null)[]` _(optional)_ | One entry per triangle: the B-rep face index owning it (same ids as {@linkcode PluginDesignQueryGeometryApi.getBrep} faces), `null` where there is no provenance (non-B-rep mesh). Present only when requested via `includeFaceIndices` |
|
|
241
|
+
*/
|
|
242
|
+
export const PluginTriangulatedMesh = z.object({
|
|
243
|
+
id: z.string(),
|
|
244
|
+
positions: z.array(z.number()),
|
|
245
|
+
indices: z.array(z.number()),
|
|
246
|
+
materialIds: z.array(z.string().nullable()).optional(),
|
|
247
|
+
faceIds: z.array(z.number().nullable()).optional(),
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
export type PluginTriangulatedMesh = z.infer<typeof PluginTriangulatedMesh>
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Arguments for {@linkcode PluginDesignQueryGeometryApi.getTriangulatedMeshes}.
|
|
254
|
+
*
|
|
255
|
+
* | Property | Type | Description |
|
|
256
|
+
* |---|---|---|
|
|
257
|
+
* | `components` | {@linkcode ComponentHandle}`[]` | The scene components to triangulate |
|
|
258
|
+
* | `options.includeMaterialIds` | `boolean` _(optional)_ | Also return the per-triangle material names |
|
|
259
|
+
* | `options.includeFaceIndices` | `boolean` _(optional)_ | Also return the per-triangle B-rep face indices |
|
|
260
|
+
*/
|
|
261
|
+
export const PluginDesignQueryGeometryGetTriangulatedMeshesArgs = z.object({
|
|
262
|
+
components: z.array(ComponentHandle),
|
|
263
|
+
options: z
|
|
264
|
+
.object({
|
|
265
|
+
includeMaterialIds: z.boolean().optional(),
|
|
266
|
+
includeFaceIndices: z.boolean().optional(),
|
|
267
|
+
})
|
|
268
|
+
.optional(),
|
|
269
|
+
})
|
|
270
|
+
|
|
271
|
+
export type PluginDesignQueryGeometryGetTriangulatedMeshesArgs = z.infer<
|
|
272
|
+
typeof PluginDesignQueryGeometryGetTriangulatedMeshesArgs
|
|
273
|
+
>
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Result of {@linkcode PluginDesignQueryGeometryApi.getTriangulatedMeshes}.
|
|
277
|
+
*
|
|
278
|
+
* | Property | Type | Description |
|
|
279
|
+
* |---|---|---|
|
|
280
|
+
* | `meshes` | {@linkcode PluginTriangulatedMesh}`[]` | One record per requested component, in input order |
|
|
281
|
+
*/
|
|
282
|
+
export const PluginDesignQueryGeometryGetTriangulatedMeshesResult = z.object({
|
|
283
|
+
meshes: z.array(PluginTriangulatedMesh),
|
|
284
|
+
})
|
|
285
|
+
|
|
286
|
+
export type PluginDesignQueryGeometryGetTriangulatedMeshesResult = z.infer<
|
|
287
|
+
typeof PluginDesignQueryGeometryGetTriangulatedMeshesResult
|
|
288
|
+
>
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import { PluginStaircasePreset } from "../create"
|
|
11
11
|
import { PluginDesignQueryGeometryApi } from "./geometry"
|
|
12
12
|
import { PluginDesignQuerySpacesApi } from "./spaces"
|
|
13
|
+
import { PluginDesignQueryReferenceLinesApi } from "./referenceLines"
|
|
13
14
|
|
|
14
15
|
// ---------------------------------------------------------------------------
|
|
15
16
|
// Entity type vocabulary
|
|
@@ -301,6 +302,8 @@ export abstract class PluginDesignQueryApi {
|
|
|
301
302
|
public abstract geometry: PluginDesignQueryGeometryApi
|
|
302
303
|
/** Space-specific reads (footprint, …). See {@linkcode PluginDesignQuerySpacesApi}. */
|
|
303
304
|
public abstract spaces: PluginDesignQuerySpacesApi
|
|
305
|
+
/** Reference-line-specific reads. See {@linkcode PluginDesignQueryReferenceLinesApi}. */
|
|
306
|
+
public abstract referenceLines: PluginDesignQueryReferenceLinesApi
|
|
304
307
|
|
|
305
308
|
constructor() {}
|
|
306
309
|
|
|
@@ -1042,3 +1045,4 @@ export abstract class PluginDesignQueryApi {
|
|
|
1042
1045
|
|
|
1043
1046
|
export * from "./geometry"
|
|
1044
1047
|
export * from "./spaces"
|
|
1048
|
+
export * from "./referenceLines"
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../../types"
|
|
3
|
+
import {
|
|
4
|
+
PluginReferenceLineGetProperty,
|
|
5
|
+
PluginReferenceLineGetResult,
|
|
6
|
+
} from "../../entity/referenceLine"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* `design.query.referenceLines.*` — reference-line-specific reads.
|
|
10
|
+
*
|
|
11
|
+
* A **reference line** is a 2D guide line (or arc) in the scene, typically used
|
|
12
|
+
* for grid lines and alignment guides. Enumerate reference lines with
|
|
13
|
+
* `design.query.listReferenceLines`; read an individual line's properties here.
|
|
14
|
+
* This is the canonical home of the read formerly at `entity.referenceLine.get`
|
|
15
|
+
* (now deprecated).
|
|
16
|
+
*
|
|
17
|
+
* Accessed via `snaptrude.design.query.referenceLines`.
|
|
18
|
+
*/
|
|
19
|
+
export abstract class PluginDesignQueryReferenceLinesApi {
|
|
20
|
+
constructor() {}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Get properties of a reference line by its ID.
|
|
24
|
+
*
|
|
25
|
+
* Only the properties listed in `properties` are returned — unlisted
|
|
26
|
+
* properties will be `undefined` in the result.
|
|
27
|
+
*
|
|
28
|
+
* @param referenceLineId - The unique reference line ID
|
|
29
|
+
* @param properties - Array of property names to retrieve. See
|
|
30
|
+
* {@linkcode PluginReferenceLineGetProperty}.
|
|
31
|
+
* @returns A partial {@linkcode PluginReferenceLineGetResult} containing only the
|
|
32
|
+
* requested properties
|
|
33
|
+
* @throws If the reference line does not exist
|
|
34
|
+
*
|
|
35
|
+
* @examplePrompt Get the curve geometry of this reference line
|
|
36
|
+
* @examplePrompt Where does this grid line run?
|
|
37
|
+
* @examplePrompt Read the geometry of a guide line by its id
|
|
38
|
+
* @examplePrompt Look up the curve of the selected reference line
|
|
39
|
+
*
|
|
40
|
+
* # Example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const [refLine] = await snaptrude.design.query.listReferenceLines()
|
|
43
|
+
* const result = await snaptrude.design.query.referenceLines.get(refLine, ["curve"])
|
|
44
|
+
* // result.curve is an opaque CurveHandle; read its coordinates via
|
|
45
|
+
* // `snaptrude.core.geom.curve`.
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
public abstract get(
|
|
49
|
+
referenceLineId: string,
|
|
50
|
+
properties: z.infer<typeof PluginReferenceLineGetProperty>[],
|
|
51
|
+
): PluginApiReturn<PluginReferenceLineGetResult>
|
|
52
|
+
}
|
|
@@ -75,6 +75,55 @@ export abstract class PluginDesignQuerySpacesApi {
|
|
|
75
75
|
public abstract getFootprint(
|
|
76
76
|
space: ComponentHandle,
|
|
77
77
|
): PluginApiReturn<ContourHandle | null>
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Get the **enclosure** of a space — the floor and ceiling that cap it, the
|
|
81
|
+
* bounding walls around it (with each wall's door/window openings), and the
|
|
82
|
+
* neighbouring spaces it shares a boundary with.
|
|
83
|
+
*
|
|
84
|
+
* **Geometric v1 — best effort.** The engine has no persisted space→surface
|
|
85
|
+
* topology, so this read is derived purely from *plan geometry*: the space
|
|
86
|
+
* footprint is matched against the plan footprints/baselines of the slabs and
|
|
87
|
+
* walls on the same storey. Consequences a caller must account for:
|
|
88
|
+
*
|
|
89
|
+
* - `faceIndices` is **always `[]`**. The triangle→B-rep-face provenance that
|
|
90
|
+
* would populate it is a separate engine capability that does not exist yet;
|
|
91
|
+
* read a surface's full geometry via
|
|
92
|
+
* {@linkcode PluginDesignQueryGeometryApi.getBrep} on its `component` instead.
|
|
93
|
+
* - After heavy edits (move / stretch / boolean) or on imported models the plan
|
|
94
|
+
* match can miss or mis-attribute a surface — treat the result as advisory,
|
|
95
|
+
* not authoritative.
|
|
96
|
+
* - `adjacentSpaces` comes from the same adjacency data as
|
|
97
|
+
* {@linkcode PluginProgramAdjacencyApi.getMatrix} (so the two agree on which
|
|
98
|
+
* spaces neighbour). `sharedEdgeLength` is `0` because that data exposes no
|
|
99
|
+
* edge length, and `sharedSurface` is the common boundary wall only when one
|
|
100
|
+
* is found geometrically (else `null`).
|
|
101
|
+
*
|
|
102
|
+
* Read-only; never mutates the model.
|
|
103
|
+
*
|
|
104
|
+
* @param space - The space (room mass) to read
|
|
105
|
+
* @returns the {@linkcode PluginSpaceEnclosure}, or `null` when `space` is not a
|
|
106
|
+
* space (room mass) or has no extractable plan footprint
|
|
107
|
+
*
|
|
108
|
+
* @examplePrompt What walls, floor and ceiling enclose this room?
|
|
109
|
+
* @examplePrompt Which of this room's walls are external?
|
|
110
|
+
* @examplePrompt List the doors and windows around the selected space
|
|
111
|
+
* @examplePrompt Which spaces are adjacent to this room, and through which wall?
|
|
112
|
+
*
|
|
113
|
+
* # Example
|
|
114
|
+
* ```ts
|
|
115
|
+
* const [space] = await snaptrude.design.query.listSpaces()
|
|
116
|
+
* const enclosure = await snaptrude.design.query.spaces.getEnclosure(space)
|
|
117
|
+
* if (enclosure) {
|
|
118
|
+
* const walls = enclosure.surfaces.filter((s) => s.role === "wall")
|
|
119
|
+
* const external = walls.filter((s) => s.isExternal)
|
|
120
|
+
* console.log(`${walls.length} walls, ${external.length} external`)
|
|
121
|
+
* }
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
public abstract getEnclosure(
|
|
125
|
+
space: ComponentHandle,
|
|
126
|
+
): PluginApiReturn<PluginSpaceEnclosure | null>
|
|
78
127
|
}
|
|
79
128
|
|
|
80
129
|
/**
|
|
@@ -130,3 +179,97 @@ export const PluginDesignQuerySpacesGetResult = PluginSpaceGetResult.omit({
|
|
|
130
179
|
export type PluginDesignQuerySpacesGetResult = z.infer<
|
|
131
180
|
typeof PluginDesignQuerySpacesGetResult
|
|
132
181
|
>
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Arguments for {@linkcode PluginDesignQuerySpacesApi.getEnclosure}.
|
|
185
|
+
*
|
|
186
|
+
* | Property | Type | Description |
|
|
187
|
+
* |---|---|---|
|
|
188
|
+
* | `space` | {@linkcode ComponentHandle} | The space (room mass) to read |
|
|
189
|
+
*/
|
|
190
|
+
export const PluginDesignQuerySpacesGetEnclosureArgs = z.object({
|
|
191
|
+
space: ComponentHandle,
|
|
192
|
+
})
|
|
193
|
+
export type PluginDesignQuerySpacesGetEnclosureArgs = z.infer<
|
|
194
|
+
typeof PluginDesignQuerySpacesGetEnclosureArgs
|
|
195
|
+
>
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* The role a bounding surface plays in a {@linkcode PluginSpaceEnclosure}:
|
|
199
|
+
* `"floor"` (slab below), `"ceiling"` (slab/roof above), or `"wall"`.
|
|
200
|
+
*/
|
|
201
|
+
export const PluginEnclosureRole = z.enum(["floor", "ceiling", "wall"])
|
|
202
|
+
export type PluginEnclosureRole = z.infer<typeof PluginEnclosureRole>
|
|
203
|
+
|
|
204
|
+
/** The kind of opening hosted in a bounding wall. */
|
|
205
|
+
export const PluginEnclosureOpeningKind = z.enum(["door", "window", "void"])
|
|
206
|
+
export type PluginEnclosureOpeningKind = z.infer<
|
|
207
|
+
typeof PluginEnclosureOpeningKind
|
|
208
|
+
>
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* One opening (door / window / void) in a bounding wall.
|
|
212
|
+
*
|
|
213
|
+
* | Property | Type | Description |
|
|
214
|
+
* |---|---|---|
|
|
215
|
+
* | `kind` | {@linkcode PluginEnclosureOpeningKind} | `"door"`, `"window"`, or `"void"` |
|
|
216
|
+
* | `component` | {@linkcode ComponentHandle} | The opening entity |
|
|
217
|
+
*/
|
|
218
|
+
export const PluginEnclosureOpening = z.object({
|
|
219
|
+
kind: PluginEnclosureOpeningKind,
|
|
220
|
+
component: ComponentHandle,
|
|
221
|
+
})
|
|
222
|
+
export type PluginEnclosureOpening = z.infer<typeof PluginEnclosureOpening>
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* One bounding surface of a space's enclosure.
|
|
226
|
+
*
|
|
227
|
+
* | Property | Type | Description |
|
|
228
|
+
* |---|---|---|
|
|
229
|
+
* | `role` | {@linkcode PluginEnclosureRole} | `"floor"`, `"ceiling"`, or `"wall"` |
|
|
230
|
+
* | `component` | {@linkcode ComponentHandle} | The wall / slab / roof entity |
|
|
231
|
+
* | `faceIndices` | `number[]` | B-rep face indices facing the space. **Always `[]` in geometric v1** (no triangle→face provenance yet) |
|
|
232
|
+
* | `isExternal` | `boolean` | No space on the other side — for a wall, no other room bounds it; for a floor/ceiling, no room caps the storey below/above |
|
|
233
|
+
* | `openings` | {@linkcode PluginEnclosureOpening}`[]` | Doors/windows/voids in the surface (walls only; `[]` for floor/ceiling in v1) |
|
|
234
|
+
*/
|
|
235
|
+
export const PluginEnclosureSurface = z.object({
|
|
236
|
+
role: PluginEnclosureRole,
|
|
237
|
+
component: ComponentHandle,
|
|
238
|
+
faceIndices: z.array(z.number()),
|
|
239
|
+
isExternal: z.boolean(),
|
|
240
|
+
openings: z.array(PluginEnclosureOpening),
|
|
241
|
+
})
|
|
242
|
+
export type PluginEnclosureSurface = z.infer<typeof PluginEnclosureSurface>
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* A space that neighbours the queried space.
|
|
246
|
+
*
|
|
247
|
+
* | Property | Type | Description |
|
|
248
|
+
* |---|---|---|
|
|
249
|
+
* | `space` | {@linkcode ComponentHandle} | The neighbouring space |
|
|
250
|
+
* | `sharedSurface` | {@linkcode ComponentHandle}` \| null` | The common boundary wall when one is found geometrically, else `null` (e.g. an open-plan or non-physical adjacency) |
|
|
251
|
+
* | `sharedEdgeLength` | `number` | Plan-unit length of the shared boundary — **always `0` in geometric v1** (the adjacency data exposes no edge length) |
|
|
252
|
+
*/
|
|
253
|
+
export const PluginAdjacentSpace = z.object({
|
|
254
|
+
space: ComponentHandle,
|
|
255
|
+
sharedSurface: ComponentHandle.nullable(),
|
|
256
|
+
sharedEdgeLength: z.number(),
|
|
257
|
+
})
|
|
258
|
+
export type PluginAdjacentSpace = z.infer<typeof PluginAdjacentSpace>
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Result of {@linkcode PluginDesignQuerySpacesApi.getEnclosure} — the geometric
|
|
262
|
+
* v1 enclosure of a space.
|
|
263
|
+
*
|
|
264
|
+
* | Property | Type | Description |
|
|
265
|
+
* |---|---|---|
|
|
266
|
+
* | `space` | {@linkcode ComponentHandle} | The queried space |
|
|
267
|
+
* | `surfaces` | {@linkcode PluginEnclosureSurface}`[]` | Floor + ceiling + bounding walls, as a flat list (any of the three may be absent when no plan match is found) |
|
|
268
|
+
* | `adjacentSpaces` | {@linkcode PluginAdjacentSpace}`[]` | Neighbouring spaces from the adjacency data (`[]` when adjacency was never computed) |
|
|
269
|
+
*/
|
|
270
|
+
export const PluginSpaceEnclosure = z.object({
|
|
271
|
+
space: ComponentHandle,
|
|
272
|
+
surfaces: z.array(PluginEnclosureSurface),
|
|
273
|
+
adjacentSpaces: z.array(PluginAdjacentSpace),
|
|
274
|
+
})
|
|
275
|
+
export type PluginSpaceEnclosure = z.infer<typeof PluginSpaceEnclosure>
|
|
@@ -32,6 +32,9 @@ export abstract class PluginDesignTransformApi {
|
|
|
32
32
|
* @examplePrompt Translate the furniture block by (10, 0, 5)
|
|
33
33
|
* @examplePrompt Move these masses up one storey
|
|
34
34
|
*
|
|
35
|
+
* @performance Array API — one host round-trip for the whole set. Pass every target in a
|
|
36
|
+
* single call; never loop `design.transform.move` per entity.
|
|
37
|
+
*
|
|
35
38
|
* # Example
|
|
36
39
|
* ```ts
|
|
37
40
|
* const { vec3 } = snaptrude.core.math
|
|
@@ -64,6 +67,9 @@ export abstract class PluginDesignTransformApi {
|
|
|
64
67
|
* @examplePrompt Rotate these masses 30 degrees around the vertical axis
|
|
65
68
|
* @examplePrompt Rotate these walls 90 degrees about the origin
|
|
66
69
|
*
|
|
70
|
+
* @performance Array API — one host round-trip for the whole set. Pass every target in a
|
|
71
|
+
* single call; never loop `design.transform.rotate` per entity.
|
|
72
|
+
*
|
|
67
73
|
* # Example
|
|
68
74
|
* ```ts
|
|
69
75
|
* await snaptrude.design.transform.rotate(["space-id"], 90)
|
|
@@ -108,6 +114,9 @@ export abstract class PluginDesignTransformApi {
|
|
|
108
114
|
* @examplePrompt Align all the walls to the left edge of this reference wall
|
|
109
115
|
* @examplePrompt Snap the bottom edges of these spaces together
|
|
110
116
|
*
|
|
117
|
+
* @performance Array API — one host round-trip for the whole set. Pass every target in a
|
|
118
|
+
* single call; never loop `design.transform.align` per entity.
|
|
119
|
+
*
|
|
111
120
|
* # Example
|
|
112
121
|
* ```ts
|
|
113
122
|
* const rooms = await snaptrude.design.selection.get()
|
|
@@ -150,6 +159,9 @@ export abstract class PluginDesignTransformApi {
|
|
|
150
159
|
* @examplePrompt Flip the selected walls front to back
|
|
151
160
|
* @examplePrompt Create a mirror image of these masses about the z axis
|
|
152
161
|
*
|
|
162
|
+
* @performance Array API — one host round-trip for the whole set. Pass every target in a
|
|
163
|
+
* single call; never loop `design.transform.mirror` per entity.
|
|
164
|
+
*
|
|
153
165
|
* # Example
|
|
154
166
|
* ```ts
|
|
155
167
|
* const rooms = await snaptrude.design.selection.get()
|
|
@@ -9,6 +9,12 @@ import {
|
|
|
9
9
|
PluginSpaceUpdateResult,
|
|
10
10
|
} from "../../entity/space"
|
|
11
11
|
import { PluginDesignChangeResult } from "../lock"
|
|
12
|
+
import {
|
|
13
|
+
PluginBuildableEnvelopePolygonVertex,
|
|
14
|
+
PluginBuildableEnvelopeSetbackTier,
|
|
15
|
+
PluginBuildableEnvelopeVerticalCap,
|
|
16
|
+
PluginBuildableEnvelopeUpdateResult,
|
|
17
|
+
} from "../../entity/buildableEnvelope"
|
|
12
18
|
|
|
13
19
|
/**
|
|
14
20
|
* Sparse property updates for a space. Only provided fields change.
|
|
@@ -300,6 +306,9 @@ export abstract class PluginDesignUpdateApi {
|
|
|
300
306
|
* @examplePrompt Move this space into the Circulation department
|
|
301
307
|
* @examplePrompt Exclude this room from the area calculations
|
|
302
308
|
*
|
|
309
|
+
* @performance For MORE THAN ONE space, call `design.update.spaces(items[])` — the whole
|
|
310
|
+
* batch is one host round-trip. Looping this single-space updater is N round-trips.
|
|
311
|
+
*
|
|
303
312
|
* # Example
|
|
304
313
|
* ```ts
|
|
305
314
|
* await snaptrude.design.update.space("space-id", { properties: { room_type: "Office" } })
|
|
@@ -330,6 +339,9 @@ export abstract class PluginDesignUpdateApi {
|
|
|
330
339
|
* @examplePrompt Bulk-assign these spaces to the Service department
|
|
331
340
|
* @examplePrompt Mark all of these rooms as excluded from area in one update
|
|
332
341
|
*
|
|
342
|
+
* @performance Bulk update — the whole batch is ONE host round-trip. Prefer over looping
|
|
343
|
+
* `design.update.space`: build the `items[]` array first, then make one call.
|
|
344
|
+
*
|
|
333
345
|
* # Example
|
|
334
346
|
* ```ts
|
|
335
347
|
* // Re-label every selected room and mark it NET area — one undoable bulk update
|
|
@@ -649,7 +661,7 @@ export abstract class PluginDesignUpdateApi {
|
|
|
649
661
|
* `storey` is an integer storey number in the `entity.story` convention
|
|
650
662
|
* (`1` is the ground storey, `-1` the first basement; `0` does not exist)
|
|
651
663
|
* and **must already exist** in each component's building — this call never
|
|
652
|
-
* creates storeys (use `
|
|
664
|
+
* creates storeys (use `core.storeys.create` first). Components already on
|
|
653
665
|
* the target storey are skipped (no-op) and are not echoed in `affected`.
|
|
654
666
|
*
|
|
655
667
|
* Throws when the target storey does not exist, when any component is
|
|
@@ -677,4 +689,57 @@ export abstract class PluginDesignUpdateApi {
|
|
|
677
689
|
components: ComponentHandle[],
|
|
678
690
|
storey: number,
|
|
679
691
|
): PluginApiReturn<PluginDesignChangeResult>
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Update an existing parametric buildable envelope — regenerate the zoning
|
|
695
|
+
* volume from a revised site polygon, setbacks, vertical cap, or FAR and
|
|
696
|
+
* lot-coverage limits, keeping the same envelope id. Canonical home of the
|
|
697
|
+
* update formerly at `entity.buildableEnvelope.update` (now deprecated).
|
|
698
|
+
*
|
|
699
|
+
* @param buildableEnvelopeId - Existing envelope ID to update; non-empty and
|
|
700
|
+
* must match an existing envelope on the canvas.
|
|
701
|
+
* @param sitePolygon - Site polygon vertices in `lengthUnit`; minimum 3 vertices.
|
|
702
|
+
* @param lengthUnit - Unit used by all length fields (`"ft" | "m"`).
|
|
703
|
+
* @param setbacks - Setback profile, ground tier first; minimum 1 tier.
|
|
704
|
+
* @param verticalCap - Maximum height or floor count.
|
|
705
|
+
* @param floorToFloor - Required floor-to-floor height in `lengthUnit`.
|
|
706
|
+
* @param farRatio - Optional FAR value, positive when provided.
|
|
707
|
+
* @param lotCoverageMaxPct - Optional lot coverage cap, `0..100`.
|
|
708
|
+
* @returns A {@linkcode PluginBuildableEnvelopeUpdateResult} with the
|
|
709
|
+
* `buildableEnvelopeId` of the updated envelope.
|
|
710
|
+
* @throws If validation fails, the envelope does not exist, or generation
|
|
711
|
+
* produces no renderable geometry.
|
|
712
|
+
*
|
|
713
|
+
* @examplePrompt Change the envelope's height limit to 175 feet
|
|
714
|
+
* @examplePrompt Update the setbacks on the buildable envelope
|
|
715
|
+
* @examplePrompt Regenerate the zoning envelope with a new site boundary
|
|
716
|
+
* @examplePrompt Increase the FAR on the buildable volume
|
|
717
|
+
*
|
|
718
|
+
* # Example
|
|
719
|
+
* ```ts
|
|
720
|
+
* const { buildableEnvelopeId } = await snaptrude.design.update.buildableEnvelope(
|
|
721
|
+
* existingId,
|
|
722
|
+
* [
|
|
723
|
+
* { x: 0, z: 0 },
|
|
724
|
+
* { x: 100, z: 0 },
|
|
725
|
+
* { x: 100, z: 80 },
|
|
726
|
+
* { x: 0, z: 80 },
|
|
727
|
+
* ],
|
|
728
|
+
* "ft",
|
|
729
|
+
* [{ aboveHeight: 0, front: 10, side: 5, rear: 10 }],
|
|
730
|
+
* { kind: "max_height", maxHeight: 175 },
|
|
731
|
+
* 12,
|
|
732
|
+
* )
|
|
733
|
+
* ```
|
|
734
|
+
*/
|
|
735
|
+
public abstract buildableEnvelope(
|
|
736
|
+
buildableEnvelopeId: string,
|
|
737
|
+
sitePolygon: PluginBuildableEnvelopePolygonVertex[],
|
|
738
|
+
lengthUnit: "ft" | "m",
|
|
739
|
+
setbacks: PluginBuildableEnvelopeSetbackTier[],
|
|
740
|
+
verticalCap: PluginBuildableEnvelopeVerticalCap,
|
|
741
|
+
floorToFloor: number,
|
|
742
|
+
farRatio?: number,
|
|
743
|
+
lotCoverageMaxPct?: number,
|
|
744
|
+
): PluginApiReturn<PluginBuildableEnvelopeUpdateResult>
|
|
680
745
|
}
|
|
@@ -54,6 +54,8 @@ export abstract class PluginBuildableEnvelopeApi {
|
|
|
54
54
|
* 12,
|
|
55
55
|
* )
|
|
56
56
|
* ```
|
|
57
|
+
*
|
|
58
|
+
* @deprecated Use `design.create.buildableEnvelope`
|
|
57
59
|
*/
|
|
58
60
|
public abstract create(
|
|
59
61
|
sitePolygon: PluginBuildableEnvelopePolygonVertex[],
|
|
@@ -106,6 +108,8 @@ export abstract class PluginBuildableEnvelopeApi {
|
|
|
106
108
|
* 12,
|
|
107
109
|
* )
|
|
108
110
|
* ```
|
|
111
|
+
*
|
|
112
|
+
* @deprecated Use `design.update.buildableEnvelope`
|
|
109
113
|
*/
|
|
110
114
|
public abstract update(
|
|
111
115
|
buildableEnvelopeId: string,
|
|
@@ -49,6 +49,8 @@ export abstract class PluginReferenceLineApi {
|
|
|
49
49
|
*
|
|
50
50
|
* const { referenceLineIds } = await snaptrude.entity.referenceLine.createMulti(profile)
|
|
51
51
|
* ```
|
|
52
|
+
*
|
|
53
|
+
* @deprecated Use `design.create.referenceLines`
|
|
52
54
|
*/
|
|
53
55
|
public abstract createMulti(
|
|
54
56
|
profile: ProfileHandle
|
|
@@ -78,6 +80,8 @@ export abstract class PluginReferenceLineApi {
|
|
|
78
80
|
* // result.curve is an opaque CurveHandle; a dedicated curve read API for its
|
|
79
81
|
* // coordinates is exposed separately via `snaptrude.core.geom.curve`.
|
|
80
82
|
* ```
|
|
83
|
+
*
|
|
84
|
+
* @deprecated Use `design.query.referenceLines.get`
|
|
81
85
|
*/
|
|
82
86
|
public abstract get(
|
|
83
87
|
referenceLineId: string,
|
|
@@ -104,6 +108,8 @@ export abstract class PluginReferenceLineApi {
|
|
|
104
108
|
* const { referenceLineIds } = await snaptrude.entity.referenceLine.getAll()
|
|
105
109
|
* console.log(`Project has ${referenceLineIds.length} reference lines`)
|
|
106
110
|
* ```
|
|
111
|
+
*
|
|
112
|
+
* @deprecated Use `design.query.listReferenceLines`
|
|
107
113
|
*/
|
|
108
114
|
public abstract getAll(): PluginApiReturn<PluginReferenceLineGetAllResult>
|
|
109
115
|
|
|
@@ -125,6 +131,8 @@ export abstract class PluginReferenceLineApi {
|
|
|
125
131
|
* ```ts
|
|
126
132
|
* await snaptrude.entity.referenceLine.delete("some-ref-line-id")
|
|
127
133
|
* ```
|
|
134
|
+
*
|
|
135
|
+
* @deprecated Use `design.delete.entities`
|
|
128
136
|
*/
|
|
129
137
|
public abstract delete(
|
|
130
138
|
referenceLineId: string
|
package/src/api/entity/story.ts
CHANGED
|
@@ -41,6 +41,8 @@ export abstract class PluginStoryApi {
|
|
|
41
41
|
* const info = await snaptrude.entity.story.get(1, ["height", "name", "spacesCount"])
|
|
42
42
|
* console.log(info.name, info.height, info.spacesCount)
|
|
43
43
|
* ```
|
|
44
|
+
*
|
|
45
|
+
* @deprecated Use `core.storeys.get`
|
|
44
46
|
*/
|
|
45
47
|
public abstract get(
|
|
46
48
|
storyValue: number,
|
|
@@ -68,6 +70,8 @@ export abstract class PluginStoryApi {
|
|
|
68
70
|
* console.log(`Story ${s.value}: ${s.name} (id: ${s.id})`)
|
|
69
71
|
* }
|
|
70
72
|
* ```
|
|
73
|
+
*
|
|
74
|
+
* @deprecated Use `core.storeys.list`
|
|
71
75
|
*/
|
|
72
76
|
public abstract getAll(): PluginApiReturn<PluginStoryGetAllResult>
|
|
73
77
|
|
|
@@ -95,6 +99,8 @@ export abstract class PluginStoryApi {
|
|
|
95
99
|
* // Create a new third floor with custom height
|
|
96
100
|
* const { storyId } = await snaptrude.entity.story.create(3, 4.5)
|
|
97
101
|
* ```
|
|
102
|
+
*
|
|
103
|
+
* @deprecated Use `core.storeys.create`
|
|
98
104
|
*/
|
|
99
105
|
public abstract create(
|
|
100
106
|
storyValue: number,
|
|
@@ -147,6 +153,8 @@ export abstract class PluginStoryApi {
|
|
|
147
153
|
* // Rename only, leaving the height untouched.
|
|
148
154
|
* await snaptrude.entity.story.update(1, undefined, { name: "Lobby" })
|
|
149
155
|
* ```
|
|
156
|
+
*
|
|
157
|
+
* @deprecated Use `core.storeys.update`
|
|
150
158
|
*/
|
|
151
159
|
public abstract update(
|
|
152
160
|
storyValue: number,
|
|
@@ -174,6 +182,8 @@ export abstract class PluginStoryApi {
|
|
|
174
182
|
* // Activate story 2, then draw a wall — it lands on story 2.
|
|
175
183
|
* await snaptrude.entity.story.setActive(2)
|
|
176
184
|
* ```
|
|
185
|
+
*
|
|
186
|
+
* @deprecated Use `core.storeys.setActive`
|
|
177
187
|
*/
|
|
178
188
|
public abstract setActive(
|
|
179
189
|
storyValue: number,
|
|
@@ -201,6 +211,8 @@ export abstract class PluginStoryApi {
|
|
|
201
211
|
* const { newActiveStory } = await snaptrude.entity.story.delete(3)
|
|
202
212
|
* console.log(`Deleted story 3; now on story ${newActiveStory}`)
|
|
203
213
|
* ```
|
|
214
|
+
*
|
|
215
|
+
* @deprecated Use `core.storeys.delete`
|
|
204
216
|
*/
|
|
205
217
|
public abstract delete(
|
|
206
218
|
storyValue: number,
|
|
@@ -240,6 +252,12 @@ export abstract class PluginStoryApi {
|
|
|
240
252
|
* @examplePrompt Repeat this level upwards with its own independent geometry
|
|
241
253
|
* @examplePrompt Duplicate just the selected walls onto the next floor up
|
|
242
254
|
*
|
|
255
|
+
* @performance For storeys that share a layout, duplicate the storey instead of recreating
|
|
256
|
+
* its contents floor by floor — this copies every eligible element in one call, and the
|
|
257
|
+
* default instanced copies keep the floors linked. To stack many identical floors, either
|
|
258
|
+
* call this per level or capture the storey's component ids and
|
|
259
|
+
* `design.create.copy(ids, oneFloorRise, { count })` to lay them all down in a single call.
|
|
260
|
+
*
|
|
243
261
|
* # Example
|
|
244
262
|
* ```ts
|
|
245
263
|
* // Duplicate the whole active story one level up (instanced copies).
|
|
@@ -248,6 +266,8 @@ export abstract class PluginStoryApi {
|
|
|
248
266
|
* console.log(`Copied ${created.length} elements onto story ${targetStories}`)
|
|
249
267
|
* if (skipped) console.log(`${skipped} elements were skipped`)
|
|
250
268
|
* ```
|
|
269
|
+
*
|
|
270
|
+
* @deprecated Use `core.storeys.copy`
|
|
251
271
|
*/
|
|
252
272
|
public abstract duplicate(
|
|
253
273
|
direction: "up" | "down",
|
package/src/api/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { PluginEntityApi } from "./entity"
|
|
|
4
4
|
import { PluginProgramApi } from "./program"
|
|
5
5
|
import { PluginPresentationApi } from "./presentation"
|
|
6
6
|
import { PluginAnalysisApi } from "./analysis"
|
|
7
|
+
import { PluginWorkspaceApi } from "./workspace"
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Root API surface for Snaptrude plugins.
|
|
@@ -16,6 +17,7 @@ import { PluginAnalysisApi } from "./analysis"
|
|
|
16
17
|
* - {@linkcode PluginApi.program} — Program-mode planning reads (departments, metrics)
|
|
17
18
|
* - {@linkcode PluginApi.presentation} — Presentation preparation (views, AI Inspiration)
|
|
18
19
|
* - {@linkcode PluginApi.analysis} — Sustainability analysis (sunpath, shadows, sunlight/illuminance heatmaps)
|
|
20
|
+
* - {@linkcode PluginApi.workspace} — Dashboard surface: projects and teams
|
|
19
21
|
*/
|
|
20
22
|
export abstract class PluginApi {
|
|
21
23
|
/** Core math, geometry, history, and units primitives. See {@linkcode PluginCoreApi}. */
|
|
@@ -30,6 +32,8 @@ export abstract class PluginApi {
|
|
|
30
32
|
public abstract presentation: PluginPresentationApi
|
|
31
33
|
/** Sustainability analysis — sun & daylight studies. See {@linkcode PluginAnalysisApi}. */
|
|
32
34
|
public abstract analysis: PluginAnalysisApi
|
|
35
|
+
/** Dashboard surface — projects and teams. See {@linkcode PluginWorkspaceApi}. */
|
|
36
|
+
public abstract workspace: PluginWorkspaceApi
|
|
33
37
|
|
|
34
38
|
constructor() {}
|
|
35
39
|
}
|
|
@@ -40,3 +44,4 @@ export * from "./entity"
|
|
|
40
44
|
export * from "./program"
|
|
41
45
|
export * from "./presentation"
|
|
42
46
|
export * from "./analysis"
|
|
47
|
+
export * from "./workspace"
|