@snaptrude/plugin-core 0.7.1 → 0.9.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/CHANGELOG.md +29 -0
- package/api-manifest.full.json +7703 -0
- package/api-manifest.json +2946 -259
- 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 +245 -0
- package/dist/api/core/camera/index.d.ts.map +1 -0
- package/dist/api/core/comment/index.d.ts +105 -2
- package/dist/api/core/comment/index.d.ts.map +1 -1
- package/dist/api/core/geom/create/index.d.ts +331 -14
- package/dist/api/core/geom/create/index.d.ts.map +1 -1
- package/dist/api/core/geom/delete/index.d.ts +8 -2
- package/dist/api/core/geom/delete/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/arc.d.ts +5 -5
- package/dist/api/core/geom/query/brep.d.ts +18 -18
- package/dist/api/core/geom/query/circle.d.ts +18 -18
- package/dist/api/core/geom/query/contour.d.ts +20 -20
- package/dist/api/core/geom/query/curve.d.ts +49 -49
- package/dist/api/core/geom/query/edge.d.ts +5 -5
- package/dist/api/core/geom/query/face.d.ts +16 -16
- package/dist/api/core/geom/query/halfedge.d.ts +8 -8
- package/dist/api/core/geom/query/profile.d.ts +19 -19
- package/dist/api/core/geom/query/vertex.d.ts +8 -8
- package/dist/api/core/geom/update/contour.d.ts +14 -14
- package/dist/api/core/geom/update/curve.d.ts +7 -7
- package/dist/api/core/geom/update/profile.d.ts +16 -16
- package/dist/api/core/handles/index.d.ts +210 -0
- package/dist/api/core/handles/index.d.ts.map +1 -0
- package/dist/api/core/index.d.ts +24 -0
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/io/export/index.d.ts +134 -0
- package/dist/api/core/io/export/index.d.ts.map +1 -0
- package/dist/api/core/io/import/index.d.ts +62 -1
- package/dist/api/core/io/import/index.d.ts.map +1 -1
- package/dist/api/core/io/index.d.ts +5 -0
- package/dist/api/core/io/index.d.ts.map +1 -1
- package/dist/api/core/layers.d.ts +7 -7
- package/dist/api/core/mode/index.d.ts +99 -0
- package/dist/api/core/mode/index.d.ts.map +1 -0
- package/dist/api/core/proposals/index.d.ts +65 -9
- package/dist/api/core/proposals/index.d.ts.map +1 -1
- 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/user.d.ts +44 -0
- package/dist/api/core/user.d.ts.map +1 -0
- package/dist/api/core/zoom/index.d.ts +4 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -1
- package/dist/api/design/boolean/index.d.ts +4 -4
- package/dist/api/design/create/index.d.ts +253 -47
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/delete/index.d.ts +3 -0
- package/dist/api/design/delete/index.d.ts.map +1 -1
- package/dist/api/design/doors/index.d.ts +36 -0
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/edit/index.d.ts +1 -1
- package/dist/api/design/erase/index.d.ts +2 -2
- package/dist/api/design/furniture/index.d.ts +114 -3
- package/dist/api/design/furniture/index.d.ts.map +1 -1
- package/dist/api/design/index.d.ts +10 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/materials/index.d.ts +111 -14
- package/dist/api/design/materials/index.d.ts.map +1 -1
- package/dist/api/design/query/geometry/index.d.ts +112 -0
- package/dist/api/design/query/geometry/index.d.ts.map +1 -1
- package/dist/api/design/query/index.d.ts +35 -1
- 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 +178 -5
- package/dist/api/design/query/spaces.d.ts.map +1 -1
- package/dist/api/design/transform/index.d.ts +95 -14
- package/dist/api/design/transform/index.d.ts.map +1 -1
- package/dist/api/design/types/index.d.ts +181 -0
- package/dist/api/design/types/index.d.ts.map +1 -0
- package/dist/api/design/update/index.d.ts +385 -2
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/design/visibility.d.ts +98 -0
- package/dist/api/design/visibility.d.ts.map +1 -0
- package/dist/api/entity/buildableEnvelope.d.ts +4 -0
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +10 -2
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +19 -19
- package/dist/api/entity/story.d.ts +148 -15
- 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 +448 -0
- package/dist/api/presentation/annotate.d.ts.map +1 -0
- package/dist/api/presentation/diagrams.d.ts +49 -8
- package/dist/api/presentation/diagrams.d.ts.map +1 -1
- package/dist/api/presentation/export.d.ts +108 -0
- package/dist/api/presentation/export.d.ts.map +1 -0
- package/dist/api/presentation/import.d.ts +6 -0
- package/dist/api/presentation/import.d.ts.map +1 -1
- package/dist/api/presentation/index.d.ts +47 -0
- package/dist/api/presentation/index.d.ts.map +1 -1
- package/dist/api/presentation/placedViews.d.ts +370 -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 +410 -13
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/presentation/views.d.ts +165 -10
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/program/areas.d.ts +63 -3
- package/dist/api/program/areas.d.ts.map +1 -1
- package/dist/api/program/cores.d.ts +3 -99
- package/dist/api/program/cores.d.ts.map +1 -1
- package/dist/api/program/index.d.ts +2 -2
- package/dist/api/program/index.d.ts.map +1 -1
- package/dist/api/program/layout.d.ts +172 -12
- package/dist/api/program/layout.d.ts.map +1 -1
- package/dist/api/program/site.d.ts +105 -8
- package/dist/api/program/site.d.ts.map +1 -1
- package/dist/api/program/spreadsheet.d.ts +365 -41
- package/dist/api/program/spreadsheet.d.ts.map +1 -1
- package/dist/api/workspace/index.d.ts +460 -0
- package/dist/api/workspace/index.d.ts.map +1 -0
- package/dist/handles.d.ts +64 -25
- package/dist/handles.d.ts.map +1 -1
- package/dist/index.cjs +3210 -1671
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3008 -1666
- 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 +251 -0
- package/src/api/core/comment/index.ts +120 -2
- package/src/api/core/geom/create/index.ts +344 -1
- package/src/api/core/geom/delete/index.ts +6 -0
- package/src/api/core/handles/index.ts +233 -0
- package/src/api/core/index.ts +24 -0
- package/src/api/core/io/export/index.ts +126 -0
- package/src/api/core/io/import/index.ts +64 -0
- package/src/api/core/io/index.ts +5 -0
- package/src/api/core/mode/index.ts +96 -0
- package/src/api/core/proposals/index.ts +71 -11
- package/src/api/core/storeys/index.ts +279 -0
- package/src/api/core/tags.ts +27 -0
- package/src/api/core/user.ts +46 -0
- package/src/api/core/zoom/index.ts +4 -0
- package/src/api/design/create/index.ts +303 -36
- package/src/api/design/delete/index.ts +3 -0
- package/src/api/design/doors/index.ts +40 -0
- package/src/api/design/furniture/index.ts +127 -3
- package/src/api/design/index.ts +10 -0
- package/src/api/design/materials/index.ts +157 -30
- package/src/api/design/query/geometry/index.ts +125 -3
- package/src/api/design/query/index.ts +37 -7
- 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 +101 -12
- package/src/api/design/types/index.ts +156 -0
- package/src/api/design/update/index.ts +467 -6
- package/src/api/design/visibility.ts +109 -0
- package/src/api/entity/buildableEnvelope.ts +4 -0
- package/src/api/entity/referenceLine.ts +8 -0
- package/src/api/entity/story.ts +161 -15
- package/src/api/index.ts +5 -0
- package/src/api/presentation/annotate.ts +360 -0
- package/src/api/presentation/diagrams.ts +53 -8
- package/src/api/presentation/export.ts +108 -0
- package/src/api/presentation/import.ts +6 -0
- package/src/api/presentation/index.ts +55 -0
- package/src/api/presentation/placedViews.ts +363 -0
- package/src/api/presentation/shapes.ts +274 -0
- package/src/api/presentation/sheets.ts +346 -13
- package/src/api/presentation/views.ts +164 -12
- package/src/api/program/areas.ts +57 -6
- package/src/api/program/cores.ts +3 -91
- package/src/api/program/index.ts +2 -2
- package/src/api/program/layout.ts +182 -12
- package/src/api/program/site.ts +106 -8
- package/src/api/program/spreadsheet.ts +376 -35
- package/src/api/workspace/index.ts +516 -0
- package/src/handles.ts +77 -13
- package/tsconfig.json +7 -2
|
@@ -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
|
|
@@ -168,6 +169,7 @@ export type PluginDesignQueryComponentsArgs = z.infer<
|
|
|
168
169
|
* | `spaceType` | {@linkcode PluginSpaceType} | Space-type (spaces only) |
|
|
169
170
|
* | `areaClass` | {@linkcode PluginAreaClass} | Area classification (spaces only) |
|
|
170
171
|
* | `departmentId` | `string` | Department (masses only) |
|
|
172
|
+
* | `buildingType` | `string` | Assigned building type NAME (walls / slabs / floors / roofs / ceilings only) — the Object Properties panel's Wall/Slab/Floor/Roof/Ceiling Type dropdown value, matching the names from `design.types.list(kind)` |
|
|
171
173
|
* | `isLocked` | `boolean` | Lock flag |
|
|
172
174
|
* | `isHidden` | `boolean` | User-hidden flag |
|
|
173
175
|
* | `isSelected` | `boolean` | Current selection state |
|
|
@@ -186,6 +188,7 @@ export const PluginEntityProperties = z
|
|
|
186
188
|
spaceType: PluginSpaceType,
|
|
187
189
|
areaClass: PluginAreaClass,
|
|
188
190
|
departmentId: z.string(),
|
|
191
|
+
buildingType: z.string(),
|
|
189
192
|
isLocked: z.boolean(),
|
|
190
193
|
isHidden: z.boolean(),
|
|
191
194
|
isSelected: z.boolean(),
|
|
@@ -201,17 +204,28 @@ export type PluginEntityProperties = z.infer<typeof PluginEntityProperties>
|
|
|
201
204
|
* entity's type computes them (area: floors/masses/slabs/roofs/beams/columns;
|
|
202
205
|
* volume: all; length: walls/beams).
|
|
203
206
|
*
|
|
207
|
+
* `thickness` and `height` are the Object Properties panel's dimension reads
|
|
208
|
+
* (the same engine source `design.update.wall` / `design.update.slab` etc.
|
|
209
|
+
* write through), in engine units. `thickness`: walls (the plan thickness —
|
|
210
|
+
* present only for straight orthogonal walls, exactly when the panel shows it)
|
|
211
|
+
* and slabs/floors/roofs/ceilings (the vertical extent the panel calls
|
|
212
|
+
* Thickness). `height`: walls only.
|
|
213
|
+
*
|
|
204
214
|
* | Property | Type | Description |
|
|
205
215
|
* |---|---|---|
|
|
206
216
|
* | `area` | `number`? | Bottom-face area |
|
|
207
217
|
* | `volume` | `number`? | Solid volume |
|
|
208
218
|
* | `length` | `number`? | Running length (linear elements) |
|
|
219
|
+
* | `thickness` | `number`? | Panel Thickness — walls (straight orthogonal only) and the slab family |
|
|
220
|
+
* | `height` | `number`? | Panel Height — walls only |
|
|
209
221
|
* | `boundingBox` | {@linkcode BBoxComponents} | World-space AABB (always present) |
|
|
210
222
|
*/
|
|
211
223
|
export const PluginEntityMeasurements = z.object({
|
|
212
224
|
area: z.number().optional(),
|
|
213
225
|
volume: z.number().optional(),
|
|
214
226
|
length: z.number().optional(),
|
|
227
|
+
thickness: z.number().optional(),
|
|
228
|
+
height: z.number().optional(),
|
|
215
229
|
boundingBox: BBoxComponents,
|
|
216
230
|
})
|
|
217
231
|
export type PluginEntityMeasurements = z.infer<typeof PluginEntityMeasurements>
|
|
@@ -288,6 +302,8 @@ export abstract class PluginDesignQueryApi {
|
|
|
288
302
|
public abstract geometry: PluginDesignQueryGeometryApi
|
|
289
303
|
/** Space-specific reads (footprint, …). See {@linkcode PluginDesignQuerySpacesApi}. */
|
|
290
304
|
public abstract spaces: PluginDesignQuerySpacesApi
|
|
305
|
+
/** Reference-line-specific reads. See {@linkcode PluginDesignQueryReferenceLinesApi}. */
|
|
306
|
+
public abstract referenceLines: PluginDesignQueryReferenceLinesApi
|
|
291
307
|
|
|
292
308
|
constructor() {}
|
|
293
309
|
|
|
@@ -755,9 +771,7 @@ export abstract class PluginDesignQueryApi {
|
|
|
755
771
|
* }
|
|
756
772
|
* ```
|
|
757
773
|
*/
|
|
758
|
-
public abstract exists(
|
|
759
|
-
id: ComponentHandle,
|
|
760
|
-
): PluginApiReturn<boolean>
|
|
774
|
+
public abstract exists(id: ComponentHandle): PluginApiReturn<boolean>
|
|
761
775
|
|
|
762
776
|
/**
|
|
763
777
|
* Get the kind of BIM entity a handle refers to — wall, door, space, slab,
|
|
@@ -811,9 +825,7 @@ export abstract class PluginDesignQueryApi {
|
|
|
811
825
|
* }
|
|
812
826
|
* ```
|
|
813
827
|
*/
|
|
814
|
-
public abstract getLabel(
|
|
815
|
-
component: ComponentHandle,
|
|
816
|
-
): PluginApiReturn<string>
|
|
828
|
+
public abstract getLabel(component: ComponentHandle): PluginApiReturn<string>
|
|
817
829
|
|
|
818
830
|
/**
|
|
819
831
|
* Get a serializable, persistable reference to an entity. Under the all-handle
|
|
@@ -897,13 +909,16 @@ export abstract class PluginDesignQueryApi {
|
|
|
897
909
|
* Read an entity's common properties as a {@linkcode PluginEntityProperties}
|
|
898
910
|
* record (only applicable fields are present). For spaces/masses this includes
|
|
899
911
|
* `adjacency` — the per-entity adjacency read (bulk form:
|
|
900
|
-
* `program.adjacency.getMatrix`).
|
|
912
|
+
* `program.adjacency.getMatrix`). For walls and the slab family (slab / floor
|
|
913
|
+
* / roof / ceiling) this includes `buildingType` — the assigned building type
|
|
914
|
+
* NAME the panel's type dropdown shows, matching `design.types.list(kind)`.
|
|
901
915
|
*
|
|
902
916
|
* @param component - the entity's {@linkcode ComponentHandle}
|
|
903
917
|
* @returns the property record
|
|
904
918
|
*
|
|
905
919
|
* @examplePrompt Show me all the details of the selected object
|
|
906
920
|
* @examplePrompt What storey is this wall on?
|
|
921
|
+
* @examplePrompt Which wall type is assigned to this wall?
|
|
907
922
|
* @examplePrompt Which department does this room belong to?
|
|
908
923
|
* @examplePrompt Is this element locked or hidden?
|
|
909
924
|
* @examplePrompt Get the adjacencies of this space
|
|
@@ -933,11 +948,20 @@ export abstract class PluginDesignQueryApi {
|
|
|
933
948
|
* Measure an entity — read its area, volume, and/or running length (whichever
|
|
934
949
|
* its type supports) together with its world-space bounding box in one call.
|
|
935
950
|
*
|
|
951
|
+
* For walls and the slab family this also carries the Object Properties
|
|
952
|
+
* panel's dimension reads in engine units: `thickness` (walls — straight
|
|
953
|
+
* orthogonal only, exactly when the panel shows it; slabs / floors / roofs /
|
|
954
|
+
* ceilings — the vertical extent the panel calls Thickness) and `height`
|
|
955
|
+
* (walls). These are the read side of `design.update.wall` /
|
|
956
|
+
* `design.update.slab` / `.floor` / `.roof` / `.ceiling`.
|
|
957
|
+
*
|
|
936
958
|
* @param component - the entity's {@linkcode ComponentHandle}
|
|
937
959
|
* @returns a {@linkcode PluginEntityMeasurements}, or `null` if the entity is gone
|
|
938
960
|
*
|
|
939
961
|
* @examplePrompt What's the area of this room?
|
|
940
962
|
* @examplePrompt How long is the selected wall?
|
|
963
|
+
* @examplePrompt How thick is this wall?
|
|
964
|
+
* @examplePrompt Get the thickness of the slab on level 2
|
|
941
965
|
* @examplePrompt Get the volume of this mass
|
|
942
966
|
* @examplePrompt Give me the dimensions of the selected element
|
|
943
967
|
* @examplePrompt What's the floor area of the kitchen?
|
|
@@ -947,6 +971,11 @@ export abstract class PluginDesignQueryApi {
|
|
|
947
971
|
* const [space] = await snaptrude.design.query.listSpaces()
|
|
948
972
|
* const m = await snaptrude.design.query.measure(space)
|
|
949
973
|
* console.log(m?.area, m?.volume)
|
|
974
|
+
*
|
|
975
|
+
* // wall dimensions — the panel's Thickness / Height, in engine units
|
|
976
|
+
* const [wall] = await snaptrude.design.query.listWalls()
|
|
977
|
+
* const wm = await snaptrude.design.query.measure(wall)
|
|
978
|
+
* console.log(wm?.thickness, wm?.height)
|
|
950
979
|
* ```
|
|
951
980
|
*/
|
|
952
981
|
public abstract measure(
|
|
@@ -1016,3 +1045,4 @@ export abstract class PluginDesignQueryApi {
|
|
|
1016
1045
|
|
|
1017
1046
|
export * from "./geometry"
|
|
1018
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>
|