@snaptrude/plugin-core 0.9.14 → 0.9.16-networks-20261008.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 +28 -0
- package/dist/api/analysis/daylight.d.ts +5 -5
- package/dist/api/analysis/solar.d.ts +2 -2
- package/dist/api/core/camera/index.d.ts +418 -0
- package/dist/api/core/camera/index.d.ts.map +1 -1
- package/dist/api/core/index.d.ts +4 -4
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/layers.d.ts +377 -255
- package/dist/api/core/layers.d.ts.map +1 -1
- package/dist/api/core/proposals/index.d.ts +4 -3
- package/dist/api/core/proposals/index.d.ts.map +1 -1
- package/dist/api/core/storeys/index.d.ts +12 -0
- package/dist/api/core/storeys/index.d.ts.map +1 -1
- package/dist/api/core/storeys/layers.d.ts +408 -0
- package/dist/api/core/storeys/layers.d.ts.map +1 -0
- package/dist/api/core/tags.d.ts +3 -3
- package/dist/api/design/bim.d.ts +209 -0
- package/dist/api/design/bim.d.ts.map +1 -0
- package/dist/api/design/catalog.d.ts +242 -0
- package/dist/api/design/catalog.d.ts.map +1 -0
- package/dist/api/design/create/bulk-items.d.ts +55 -3
- package/dist/api/design/create/bulk-items.d.ts.map +1 -1
- package/dist/api/design/create/index.d.ts +77 -22
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/family.d.ts +576 -12
- package/dist/api/design/family.d.ts.map +1 -1
- package/dist/api/design/index.d.ts +16 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/networks.d.ts +1703 -0
- package/dist/api/design/networks.d.ts.map +1 -0
- package/dist/api/design/query/index.d.ts +30 -30
- package/dist/api/design/selection/index.d.ts +12 -12
- package/dist/api/design/types/index.d.ts +40 -24
- package/dist/api/design/types/index.d.ts.map +1 -1
- package/dist/api/design/update/index.d.ts +113 -3
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +23 -23
- package/dist/api/presentation/camera.d.ts +265 -0
- package/dist/api/presentation/camera.d.ts.map +1 -0
- package/dist/api/presentation/index.d.ts +14 -0
- package/dist/api/presentation/index.d.ts.map +1 -1
- package/dist/api/presentation/placedViews.d.ts +1 -1
- package/dist/api/presentation/views.d.ts +3 -1
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/presentation/walkthroughs.d.ts +1350 -0
- package/dist/api/presentation/walkthroughs.d.ts.map +1 -0
- package/dist/index.cjs +3886 -2598
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3744 -2595
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/generate-manifest.mjs +5 -0
- package/scripts/generate-manifest.test.mjs +14 -3
- package/src/api/core/camera/index.ts +400 -1
- package/src/api/core/index.ts +4 -4
- package/src/api/core/layers.ts +380 -173
- package/src/api/core/proposals/index.ts +4 -3
- package/src/api/core/storeys/index.ts +14 -0
- package/src/api/core/storeys/layers.ts +339 -0
- package/src/api/design/bim.ts +121 -0
- package/src/api/design/catalog.ts +128 -0
- package/src/api/design/create/bulk-items.ts +74 -2
- package/src/api/design/create/index.ts +92 -36
- package/src/api/design/family.ts +448 -17
- package/src/api/design/index.ts +34 -4
- package/src/api/design/networks.ts +607 -0
- package/src/api/design/types/index.ts +31 -24
- package/src/api/design/update/index.ts +121 -4
- package/src/api/presentation/camera.ts +289 -0
- package/src/api/presentation/index.ts +14 -0
- package/src/api/presentation/views.ts +3 -1
- package/src/api/presentation/walkthroughs.ts +1201 -0
- package/api-manifest.json +0 -9117
|
@@ -6,7 +6,8 @@ import { ComponentHandle } from "../../../handles"
|
|
|
6
6
|
* Proposals — read and edit the project's design options ("proposals").
|
|
7
7
|
*
|
|
8
8
|
* A **proposal** is a design option: one of several variants of the same
|
|
9
|
-
* project. Each proposal owns a set of buckets (a bucket
|
|
9
|
+
* project. Each proposal owns a set of buckets (a bucket is a layer in the
|
|
10
|
+
* Layers panel; read them with `core.layers.get` / {@linkcode PluginCoreLayersApi}),
|
|
10
11
|
* and switching the active proposal shows/hides the buckets it owns. Proposals
|
|
11
12
|
* are **infrastructure**, not design — they own the buckets/layers geometry
|
|
12
13
|
* lives in — so they sit under `core`, not `design` (constitution §2A).
|
|
@@ -324,8 +325,8 @@ export abstract class PluginCoreProposalsApi {
|
|
|
324
325
|
* | `id` | `string` | Stable public proposal id (e.g. `"prop_1"`) |
|
|
325
326
|
* | `name` | `string` | Display name (≤ 24 chars) |
|
|
326
327
|
* | `isActive` | `boolean` | Whether this is the active proposal |
|
|
327
|
-
* | `defaultBucketId` | `string` | Id of the proposal's default
|
|
328
|
-
* | `bucketIds` | `string[]` | Ids of every
|
|
328
|
+
* | `defaultBucketId` | `string` | Id of the proposal's default layer (cannot be unshared); read it with `core.layers.get` ({@linkcode PluginCoreLayersApi}) |
|
|
329
|
+
* | `bucketIds` | `string[]` | Ids of every layer in the Layers panel the proposal owns; read them with `core.layers.get` ({@linkcode PluginCoreLayersApi}) |
|
|
329
330
|
* | `createdAt` | `string` | ISO creation timestamp |
|
|
330
331
|
* | `createdBy` | `string` | User id of the creator |
|
|
331
332
|
*/
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
PluginStoryDeleteResult,
|
|
12
12
|
PluginStoryDuplicateResult,
|
|
13
13
|
} from "../../entity/story"
|
|
14
|
+
import { PluginCoreStoreysLayersApi } from "./layers"
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Storey (floor) management.
|
|
@@ -24,11 +25,22 @@ import {
|
|
|
24
25
|
* API calls** that return Promises and support undo/redo via Snaptrude's command
|
|
25
26
|
* system (except {@linkcode PluginCoreStoreysApi.setActive}, a view change).
|
|
26
27
|
*
|
|
28
|
+
* - {@linkcode PluginCoreStoreysApi.layers} — each storey's sketch surfaces
|
|
29
|
+
* (Wall, Rough) and imported underlays (CAD, PDF, image, terrain): list, get,
|
|
30
|
+
* active layer get/set, show/hide. Not the Layers panel; that is `core.layers`.
|
|
31
|
+
*
|
|
27
32
|
* Accessed via `snaptrude.core.storeys`.
|
|
28
33
|
*/
|
|
29
34
|
export abstract class PluginCoreStoreysApi {
|
|
30
35
|
constructor() {}
|
|
31
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Storey layers — each storey's sketch surfaces and imported underlays (ids
|
|
39
|
+
* like `ly_5`), formerly `core.layers`. Not the layers in the Layers panel;
|
|
40
|
+
* use `core.layers` for those. See {@linkcode PluginCoreStoreysLayersApi}.
|
|
41
|
+
*/
|
|
42
|
+
public abstract layers: PluginCoreStoreysLayersApi
|
|
43
|
+
|
|
32
44
|
/**
|
|
33
45
|
* Get properties of a storey by its storey number.
|
|
34
46
|
*
|
|
@@ -292,3 +304,5 @@ export const PluginCoreStoreysListResult = z.object({
|
|
|
292
304
|
export type PluginCoreStoreysListResult = z.infer<
|
|
293
305
|
typeof PluginCoreStoreysListResult
|
|
294
306
|
>
|
|
307
|
+
|
|
308
|
+
export * from "./layers"
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../../types"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Storey layers — read and toggle a storey's sketch surfaces and imported
|
|
6
|
+
* underlays.
|
|
7
|
+
*
|
|
8
|
+
* These are each storey's built-in sketch surfaces (Wall, Rough) and its
|
|
9
|
+
* imported underlays (CAD, PDF, images, terrain, neighbourhood buildings), with
|
|
10
|
+
* ids like `ly_5`. They are **NOT** the layers in the product's Layers panel in
|
|
11
|
+
* the left sidebar; use {@linkcode PluginCoreLayersApi} (`core.layers`) for
|
|
12
|
+
* those. They are also not wall/floor construction-assembly material layers.
|
|
13
|
+
*
|
|
14
|
+
* Reads return plain records and never throw for a missing layer (`get` and
|
|
15
|
+
* `getActive` return `null`, `list` returns `[]`).
|
|
16
|
+
*
|
|
17
|
+
* Storey layers are created only by storey creation and `core.io.import.*`;
|
|
18
|
+
* delete underlays with `core.io.underlay.delete` / `core.io.terrain.delete`.
|
|
19
|
+
*
|
|
20
|
+
* Sub-namespace members typed as optional (`?`) are **authored ahead of the
|
|
21
|
+
* host** — declared so plugins and codegen can see the shape, but kept out of the
|
|
22
|
+
* discovery manifest until the host lands them (at which point they are promoted
|
|
23
|
+
* to required `abstract` members).
|
|
24
|
+
*
|
|
25
|
+
* Accessed via `snaptrude.core.storeys.layers` (formerly `core.layers`).
|
|
26
|
+
*
|
|
27
|
+
* Formerly `core.layers`. Calls in that shape on `core.layers` (`list(storeyId)`,
|
|
28
|
+
* `getActive(storeyId)`, `get` / `setActive` / `update(layerId, hidden)` with a
|
|
29
|
+
* `ly_*` id) are still routed here, so plugins built before 0.9.15 keep working.
|
|
30
|
+
*/
|
|
31
|
+
export abstract class PluginCoreStoreysLayersApi {
|
|
32
|
+
constructor() {}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* List the storey layers of a storey.
|
|
36
|
+
*
|
|
37
|
+
* Optionally filter to a single {@linkcode PluginCoreStoreyLayerType}.
|
|
38
|
+
*
|
|
39
|
+
* @param storeyId - The storey whose layers to read.
|
|
40
|
+
* @param layerType - Optional {@linkcode PluginCoreStoreyLayerType} filter.
|
|
41
|
+
* @returns A {@linkcode PluginCoreStoreysLayersListResult} with a `layers` array
|
|
42
|
+
* (empty when the storey is missing or has no matching layers).
|
|
43
|
+
*
|
|
44
|
+
* @examplePrompt List the sketch surfaces and underlays on this storey
|
|
45
|
+
* @examplePrompt Show all the PDF underlays on storey st_2
|
|
46
|
+
* @examplePrompt What CAD layers are on the ground floor?
|
|
47
|
+
*
|
|
48
|
+
* # Example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const { layers } = await snaptrude.core.storeys.layers.list("st_2")
|
|
51
|
+
* for (const l of layers) console.log(l.name, l.layerType, l.hidden)
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
public abstract list(
|
|
55
|
+
storeyId: string,
|
|
56
|
+
layerType?: PluginCoreStoreyLayerType,
|
|
57
|
+
): PluginApiReturn<PluginCoreStoreysLayersListResult>
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Get a single storey layer by id.
|
|
61
|
+
*
|
|
62
|
+
* @param layerId - The id of the layer to read.
|
|
63
|
+
* @returns The matching {@linkcode PluginCoreStoreyLayer}, or `null` if no layer has
|
|
64
|
+
* that id.
|
|
65
|
+
*
|
|
66
|
+
* @examplePrompt Get the storey drawing layer with id ly_5
|
|
67
|
+
* @examplePrompt Is storey layer ly_5 hidden?
|
|
68
|
+
* @examplePrompt Look up a storey underlay layer by id
|
|
69
|
+
*
|
|
70
|
+
* # Example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const layer = await snaptrude.core.storeys.layers.get("ly_5")
|
|
73
|
+
* if (layer) console.log(layer.name, layer.hidden, layer.locked)
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
public abstract get(
|
|
77
|
+
layerId: string,
|
|
78
|
+
): PluginApiReturn<PluginCoreStoreysLayersGetResult>
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Get the active storey layer of a storey.
|
|
82
|
+
*
|
|
83
|
+
* The active layer is the one new sketch geometry is drawn onto. Paired with
|
|
84
|
+
* {@linkcode PluginCoreStoreysLayersApi.setActive}.
|
|
85
|
+
*
|
|
86
|
+
* @param storeyId - The storey whose active layer to read.
|
|
87
|
+
* @returns The active {@linkcode PluginCoreStoreyLayer}, or `null` if the storey is
|
|
88
|
+
* missing or has no active layer.
|
|
89
|
+
*
|
|
90
|
+
* @examplePrompt Which sketch surface (Wall/Rough) is active on this storey?
|
|
91
|
+
* @examplePrompt Get the active storey drawing layer on st_2
|
|
92
|
+
* @examplePrompt Which storey layer is new sketch geometry drawn onto?
|
|
93
|
+
*
|
|
94
|
+
* # Example
|
|
95
|
+
* ```ts
|
|
96
|
+
* const active = await snaptrude.core.storeys.layers.getActive("st_2")
|
|
97
|
+
* if (active) console.log(active.name)
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
public abstract getActive(
|
|
101
|
+
storeyId: string,
|
|
102
|
+
): PluginApiReturn<PluginCoreStoreysLayersGetActiveResult>
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Make a storey layer the active layer of its storey.
|
|
106
|
+
*
|
|
107
|
+
* Paired with {@linkcode PluginCoreStoreysLayersApi.getActive}.
|
|
108
|
+
*
|
|
109
|
+
* @param layerId - The id of the layer to activate.
|
|
110
|
+
* @returns The id of the now-active layer.
|
|
111
|
+
* @throws If no layer has the given id.
|
|
112
|
+
*
|
|
113
|
+
* @examplePrompt Switch this storey's sketch surface to the Rough layer
|
|
114
|
+
* @examplePrompt Make storey layer ly_5 the active sketch surface
|
|
115
|
+
* @examplePrompt Switch the active storey layer to the CAD underlay
|
|
116
|
+
*
|
|
117
|
+
* # Example
|
|
118
|
+
* ```ts
|
|
119
|
+
* await snaptrude.core.storeys.layers.setActive("ly_5")
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
public abstract setActive(
|
|
123
|
+
layerId: string,
|
|
124
|
+
): PluginApiReturn<PluginCoreStoreysLayersSetActiveResult>
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Update a storey layer's visibility.
|
|
128
|
+
*
|
|
129
|
+
* A **sparse** update: omit `hidden` to leave it unchanged. This edit is **not
|
|
130
|
+
* undoable**. Locking and renaming are not exposed — layer `locked` is a
|
|
131
|
+
* read-only status here (setting it at runtime does not lock the live meshes or
|
|
132
|
+
* show a padlock in the app until a reload), and a rename cascades to every member
|
|
133
|
+
* mesh's `layerName`, a corruption hazard.
|
|
134
|
+
*
|
|
135
|
+
* @param layerId - The id of the layer to update.
|
|
136
|
+
* @param hidden - New hidden state (unchanged if omitted).
|
|
137
|
+
* @returns The updated {@linkcode PluginCoreStoreyLayer}.
|
|
138
|
+
* @throws If no layer has the given id.
|
|
139
|
+
*
|
|
140
|
+
* @examplePrompt Hide the PDF underlay layer
|
|
141
|
+
* @examplePrompt Show the CAD underlay again
|
|
142
|
+
* @examplePrompt Hide storey layer ly_5
|
|
143
|
+
*
|
|
144
|
+
* # Example
|
|
145
|
+
* ```ts
|
|
146
|
+
* const layer = await snaptrude.core.storeys.layers.update("ly_5", true)
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
public abstract update(
|
|
150
|
+
layerId: string,
|
|
151
|
+
hidden?: boolean,
|
|
152
|
+
): PluginApiReturn<PluginCoreStoreysLayersUpdateResult>
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The kind of a storey layer.
|
|
157
|
+
*
|
|
158
|
+
* Author-drawable kinds (`floor`, `wall`, `ceiling`, `rough`, `default`) plus
|
|
159
|
+
* read-only imported underlays (`image`, `cad`, `pdf`, `terrain`, `buildings`).
|
|
160
|
+
*/
|
|
161
|
+
export const PluginCoreStoreyLayerType = z.enum([
|
|
162
|
+
"floor",
|
|
163
|
+
"wall",
|
|
164
|
+
"ceiling",
|
|
165
|
+
"rough",
|
|
166
|
+
"default",
|
|
167
|
+
"image",
|
|
168
|
+
"cad",
|
|
169
|
+
"pdf",
|
|
170
|
+
"terrain",
|
|
171
|
+
"buildings",
|
|
172
|
+
])
|
|
173
|
+
export type PluginCoreStoreyLayerType = z.infer<typeof PluginCoreStoreyLayerType>
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* A storey layer on a storey.
|
|
177
|
+
*
|
|
178
|
+
* | Property | Type | Description |
|
|
179
|
+
* |---|---|---|
|
|
180
|
+
* | `id` | `string` | Stable public layer id (e.g. `"ly_5"`) |
|
|
181
|
+
* | `name` | `string` | Display name |
|
|
182
|
+
* | `layerType` | {@linkcode PluginCoreStoreyLayerType} | The layer's kind |
|
|
183
|
+
* | `storeyId` | `string` | The stable id of the storey this layer belongs to |
|
|
184
|
+
* | `buildingId` | `string` | The stable id of the building this layer belongs to |
|
|
185
|
+
* | `hidden` | `boolean` | Whether the layer is hidden |
|
|
186
|
+
* | `locked` | `boolean` | Whether the layer is locked against edits |
|
|
187
|
+
* | `contentSummary` | `object` | A summary of what the layer holds (see below) |
|
|
188
|
+
*
|
|
189
|
+
* `contentSummary`:
|
|
190
|
+
*
|
|
191
|
+
* | Property | Type | Description |
|
|
192
|
+
* |---|---|---|
|
|
193
|
+
* | `hasFloorplan` | `boolean` | Whether the layer holds drawn floorplan geometry |
|
|
194
|
+
* | `pdfCount` | `number` | Number of PDF underlays on the layer |
|
|
195
|
+
* | `hasTerrain` | `boolean` | Whether the layer holds terrain |
|
|
196
|
+
*/
|
|
197
|
+
export const PluginCoreStoreyLayer = z.object({
|
|
198
|
+
id: z.string(),
|
|
199
|
+
name: z.string(),
|
|
200
|
+
layerType: PluginCoreStoreyLayerType,
|
|
201
|
+
storeyId: z.string(),
|
|
202
|
+
buildingId: z.string(),
|
|
203
|
+
hidden: z.boolean(),
|
|
204
|
+
locked: z.boolean(),
|
|
205
|
+
contentSummary: z.object({
|
|
206
|
+
hasFloorplan: z.boolean(),
|
|
207
|
+
pdfCount: z.number().int(),
|
|
208
|
+
hasTerrain: z.boolean(),
|
|
209
|
+
}),
|
|
210
|
+
})
|
|
211
|
+
export type PluginCoreStoreyLayer = z.infer<typeof PluginCoreStoreyLayer>
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Arguments for {@linkcode PluginCoreStoreysLayersApi.list}.
|
|
215
|
+
*
|
|
216
|
+
* | Property | Type | Description |
|
|
217
|
+
* |---|---|---|
|
|
218
|
+
* | `storeyId` | `string` | The storey whose layers to read |
|
|
219
|
+
* | `layerType` | {@linkcode PluginCoreStoreyLayerType}` \| undefined` | Optional layer-type filter |
|
|
220
|
+
*/
|
|
221
|
+
export const PluginCoreStoreysLayersListArgs = z.object({
|
|
222
|
+
storeyId: z.string(),
|
|
223
|
+
layerType: PluginCoreStoreyLayerType.optional(),
|
|
224
|
+
})
|
|
225
|
+
export type PluginCoreStoreysLayersListArgs = z.infer<
|
|
226
|
+
typeof PluginCoreStoreysLayersListArgs
|
|
227
|
+
>
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Result of {@linkcode PluginCoreStoreysLayersApi.list}.
|
|
231
|
+
*
|
|
232
|
+
* | Property | Type | Description |
|
|
233
|
+
* |---|---|---|
|
|
234
|
+
* | `layers` | {@linkcode PluginCoreStoreyLayer}`[]` | The storey's storey layers (empty when missing or none match) |
|
|
235
|
+
*/
|
|
236
|
+
export const PluginCoreStoreysLayersListResult = z.object({
|
|
237
|
+
layers: z.array(PluginCoreStoreyLayer),
|
|
238
|
+
})
|
|
239
|
+
export type PluginCoreStoreysLayersListResult = z.infer<
|
|
240
|
+
typeof PluginCoreStoreysLayersListResult
|
|
241
|
+
>
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Arguments for {@linkcode PluginCoreStoreysLayersApi.get}.
|
|
245
|
+
*
|
|
246
|
+
* | Property | Type | Description |
|
|
247
|
+
* |---|---|---|
|
|
248
|
+
* | `layerId` | `string` | The id of the layer to read |
|
|
249
|
+
*/
|
|
250
|
+
export const PluginCoreStoreysLayersGetArgs = z.object({
|
|
251
|
+
layerId: z.string(),
|
|
252
|
+
})
|
|
253
|
+
export type PluginCoreStoreysLayersGetArgs = z.infer<
|
|
254
|
+
typeof PluginCoreStoreysLayersGetArgs
|
|
255
|
+
>
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Result of {@linkcode PluginCoreStoreysLayersApi.get} — the layer, or `null`
|
|
259
|
+
* when no layer has the given id.
|
|
260
|
+
*/
|
|
261
|
+
export const PluginCoreStoreysLayersGetResult = PluginCoreStoreyLayer.nullable()
|
|
262
|
+
export type PluginCoreStoreysLayersGetResult = z.infer<
|
|
263
|
+
typeof PluginCoreStoreysLayersGetResult
|
|
264
|
+
>
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Arguments for {@linkcode PluginCoreStoreysLayersApi.getActive}.
|
|
268
|
+
*
|
|
269
|
+
* | Property | Type | Description |
|
|
270
|
+
* |---|---|---|
|
|
271
|
+
* | `storeyId` | `string` | The storey whose active layer to read |
|
|
272
|
+
*/
|
|
273
|
+
export const PluginCoreStoreysLayersGetActiveArgs = z.object({
|
|
274
|
+
storeyId: z.string(),
|
|
275
|
+
})
|
|
276
|
+
export type PluginCoreStoreysLayersGetActiveArgs = z.infer<
|
|
277
|
+
typeof PluginCoreStoreysLayersGetActiveArgs
|
|
278
|
+
>
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Result of {@linkcode PluginCoreStoreysLayersApi.getActive} — the active layer,
|
|
282
|
+
* or `null` when the storey is missing or has no active layer.
|
|
283
|
+
*/
|
|
284
|
+
export const PluginCoreStoreysLayersGetActiveResult = PluginCoreStoreyLayer.nullable()
|
|
285
|
+
export type PluginCoreStoreysLayersGetActiveResult = z.infer<
|
|
286
|
+
typeof PluginCoreStoreysLayersGetActiveResult
|
|
287
|
+
>
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Arguments for {@linkcode PluginCoreStoreysLayersApi.setActive}.
|
|
291
|
+
*
|
|
292
|
+
* | Property | Type | Description |
|
|
293
|
+
* |---|---|---|
|
|
294
|
+
* | `layerId` | `string` | The id of the layer to activate |
|
|
295
|
+
*/
|
|
296
|
+
export const PluginCoreStoreysLayersSetActiveArgs = z.object({
|
|
297
|
+
layerId: z.string(),
|
|
298
|
+
})
|
|
299
|
+
export type PluginCoreStoreysLayersSetActiveArgs = z.infer<
|
|
300
|
+
typeof PluginCoreStoreysLayersSetActiveArgs
|
|
301
|
+
>
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Result of {@linkcode PluginCoreStoreysLayersApi.setActive} — the now-active
|
|
305
|
+
* layer's id.
|
|
306
|
+
*
|
|
307
|
+
* | Property | Type | Description |
|
|
308
|
+
* |---|---|---|
|
|
309
|
+
* | `layerId` | `string` | The id of the now-active layer |
|
|
310
|
+
*/
|
|
311
|
+
export const PluginCoreStoreysLayersSetActiveResult = z.object({
|
|
312
|
+
layerId: z.string(),
|
|
313
|
+
})
|
|
314
|
+
export type PluginCoreStoreysLayersSetActiveResult = z.infer<
|
|
315
|
+
typeof PluginCoreStoreysLayersSetActiveResult
|
|
316
|
+
>
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Arguments for {@linkcode PluginCoreStoreysLayersApi.update}. Sparse — only the
|
|
320
|
+
* provided fields are changed.
|
|
321
|
+
*
|
|
322
|
+
* | Property | Type | Description |
|
|
323
|
+
* |---|---|---|
|
|
324
|
+
* | `layerId` | `string` | The id of the layer to update |
|
|
325
|
+
* | `hidden` | `boolean \| undefined` | New hidden state (unchanged if omitted) |
|
|
326
|
+
*/
|
|
327
|
+
export const PluginCoreStoreysLayersUpdateArgs = z.object({
|
|
328
|
+
layerId: z.string(),
|
|
329
|
+
hidden: z.boolean().optional(),
|
|
330
|
+
})
|
|
331
|
+
export type PluginCoreStoreysLayersUpdateArgs = z.infer<
|
|
332
|
+
typeof PluginCoreStoreysLayersUpdateArgs
|
|
333
|
+
>
|
|
334
|
+
|
|
335
|
+
/** Result of {@linkcode PluginCoreStoreysLayersApi.update} — the updated layer. */
|
|
336
|
+
export const PluginCoreStoreysLayersUpdateResult = PluginCoreStoreyLayer
|
|
337
|
+
export type PluginCoreStoreysLayersUpdateResult = z.infer<
|
|
338
|
+
typeof PluginCoreStoreysLayersUpdateResult
|
|
339
|
+
>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { ComponentHandle } from "../../handles"
|
|
3
|
+
import type { PluginApiReturn } from "../../types"
|
|
4
|
+
import { PluginConstructionType, PluginFamilyValues } from "./catalog"
|
|
5
|
+
import { PluginFamilyBundleSchema } from "./family"
|
|
6
|
+
|
|
7
|
+
const id = z.string().min(1).max(300)
|
|
8
|
+
const spaces = z.array(ComponentHandle).min(1).max(1000)
|
|
9
|
+
|
|
10
|
+
/** Read scope. Omit spaces to inspect the active proposal's sketch spaces. */
|
|
11
|
+
export const PluginBimContextArgs = z.object({ spaces: spaces.optional() }).strict()
|
|
12
|
+
export type PluginBimContextArgs = z.infer<typeof PluginBimContextArgs>
|
|
13
|
+
|
|
14
|
+
/** Directed graph edge. Side A lies along world-up × curve-direction; side B is opposite.
|
|
15
|
+
* Region IDs are snapshot identifiers, not component handles. Null means no adjacent region.
|
|
16
|
+
*/
|
|
17
|
+
export const PluginBimEdge = z.object({
|
|
18
|
+
id,
|
|
19
|
+
startMm: z.tuple([z.number(), z.number(), z.number()]),
|
|
20
|
+
endMm: z.tuple([z.number(), z.number(), z.number()]),
|
|
21
|
+
lengthMm: z.number(),
|
|
22
|
+
heightMm: z.number(),
|
|
23
|
+
sideA: id.nullable(),
|
|
24
|
+
sideB: id.nullable(),
|
|
25
|
+
wall: ComponentHandle.nullable(),
|
|
26
|
+
supported: z.boolean(),
|
|
27
|
+
})
|
|
28
|
+
export type PluginBimEdge = z.infer<typeof PluginBimEdge>
|
|
29
|
+
|
|
30
|
+
/** Construction context is detached. Revision covers geometry, room metadata and construction state. */
|
|
31
|
+
export const PluginBimContext = z.object({
|
|
32
|
+
revision: id,
|
|
33
|
+
proposalId: id,
|
|
34
|
+
units: z.literal("mm"),
|
|
35
|
+
spaces: z.array(z.object({
|
|
36
|
+
component: ComponentHandle,
|
|
37
|
+
label: z.string(),
|
|
38
|
+
storey: z.number(),
|
|
39
|
+
eligible: z.boolean(),
|
|
40
|
+
reason: z.string().optional(),
|
|
41
|
+
})),
|
|
42
|
+
regions: z.array(z.object({ id, spaces: z.array(ComponentHandle) })),
|
|
43
|
+
edges: z.array(PluginBimEdge),
|
|
44
|
+
})
|
|
45
|
+
export type PluginBimContext = z.infer<typeof PluginBimContext>
|
|
46
|
+
|
|
47
|
+
/** Plan-local key selects either an existing construction or a new project-only native recipe.
|
|
48
|
+
* Bundles use the native DSL's SU/unit-expression rules; values overrides use mm/degrees.
|
|
49
|
+
*/
|
|
50
|
+
export const PluginBimConstruction = z.union([
|
|
51
|
+
z.object({ key: id, reference: PluginConstructionType }).strict(),
|
|
52
|
+
z.object({ key: id, bundle: PluginFamilyBundleSchema }).strict(),
|
|
53
|
+
])
|
|
54
|
+
export type PluginBimConstruction = z.infer<typeof PluginBimConstruction>
|
|
55
|
+
|
|
56
|
+
/** Every unwalled edge in the selected scope needs exactly one assignment.
|
|
57
|
+
* The first authored layer faces sideA unless reversed. Alignment sets the initial core-centre offset.
|
|
58
|
+
* Later parameter edits preserve the offset and reject invalid core alignment.
|
|
59
|
+
*/
|
|
60
|
+
export const PluginBimWallAssignment = z.object({
|
|
61
|
+
edgeId: id,
|
|
62
|
+
construction: id,
|
|
63
|
+
values: PluginFamilyValues.optional(),
|
|
64
|
+
reversed: z.boolean(),
|
|
65
|
+
alignment: z.literal("coreCentre"),
|
|
66
|
+
}).strict()
|
|
67
|
+
export type PluginBimWallAssignment = z.infer<typeof PluginBimWallAssignment>
|
|
68
|
+
|
|
69
|
+
export const PluginBimPrepareArgs = z.object({
|
|
70
|
+
revision: id,
|
|
71
|
+
spaces,
|
|
72
|
+
constructions: z.array(PluginBimConstruction).max(1000),
|
|
73
|
+
walls: z.array(PluginBimWallAssignment).max(10000),
|
|
74
|
+
}).strict()
|
|
75
|
+
export type PluginBimPrepareArgs = z.infer<typeof PluginBimPrepareArgs>
|
|
76
|
+
|
|
77
|
+
/** Expected recipe/plan failures are diagnostics. No scene or library change occurs during prepare. */
|
|
78
|
+
export const PluginBimPreparation = z.object({
|
|
79
|
+
ok: z.boolean(),
|
|
80
|
+
preparationId: id.optional(),
|
|
81
|
+
diagnostics: z.array(z.object({ path: z.string(), message: z.string() })),
|
|
82
|
+
})
|
|
83
|
+
export type PluginBimPreparation = z.infer<typeof PluginBimPreparation>
|
|
84
|
+
export const PluginBimCreateArgs = z.object({ preparationId: id }).strict()
|
|
85
|
+
|
|
86
|
+
/** Source IDs identify removed sketch spaces, not live handles. Successful storeys share one undo step.
|
|
87
|
+
* Failed storeys remain spaces. Cancellation rolls back the whole conversion. Persistence is queued
|
|
88
|
+
* through normal model commands; this result is not a durable server-save acknowledgement.
|
|
89
|
+
*/
|
|
90
|
+
export const PluginBimResult = z.object({
|
|
91
|
+
status: z.enum(["created", "partial", "cancelled", "unchanged"]),
|
|
92
|
+
convertedSpaceIds: z.array(z.string()),
|
|
93
|
+
created: z.array(ComponentHandle),
|
|
94
|
+
kept: z.array(z.object({ space: ComponentHandle, reason: z.string() })),
|
|
95
|
+
})
|
|
96
|
+
export type PluginBimResult = z.infer<typeof PluginBimResult>
|
|
97
|
+
|
|
98
|
+
/** Agent-driven Sketch-to-BIM. Uses PG2 topology; never redraws routes or publishes library families. */
|
|
99
|
+
export abstract class PluginDesignBimApi {
|
|
100
|
+
/** Read room adjacency and native conversion eligibility in the active proposal.
|
|
101
|
+
* @param options Optional explicit spaces; filters edges but keeps adjacent room metadata.
|
|
102
|
+
* @returns Rooms, directed boundaries in mm, eligibility and revision.
|
|
103
|
+
* @examplePrompt Inspect the rooms on each side of these sketch wall boundaries
|
|
104
|
+
*/
|
|
105
|
+
abstract getContext(options?: PluginBimContextArgs): PluginApiReturn<PluginBimContext>
|
|
106
|
+
|
|
107
|
+
/** Stage a complete wall-construction assignment. A new prepare replaces this plugin's prior plan.
|
|
108
|
+
* @param plan Exact context revision, selected spaces, constructions and edge assignments.
|
|
109
|
+
* @returns Diagnostics or an opaque preparation ID, scoped to the caller and current project.
|
|
110
|
+
* @examplePrompt Validate wall layer assignments before converting sketch rooms to BIM
|
|
111
|
+
*/
|
|
112
|
+
abstract prepare(plan: PluginBimPrepareArgs): PluginApiReturn<PluginBimPreparation>
|
|
113
|
+
|
|
114
|
+
/** Execute native Sketch-to-BIM. Revalidates scope, catalogue access and construction before mutation.
|
|
115
|
+
* Uses native progress/cancel controls and worker cancellation. Floors/roofs retain project defaults.
|
|
116
|
+
* @param preparationId ID returned by prepare. Consumed once; stale or foreign IDs throw PRECONDITION_FAILED.
|
|
117
|
+
* @returns Created component handles and explicit converted/kept outcomes, including partial success.
|
|
118
|
+
* @examplePrompt Convert these sketch rooms to BIM with wall layers chosen for each room boundary
|
|
119
|
+
*/
|
|
120
|
+
abstract create(preparationId: string): PluginApiReturn<PluginBimResult>
|
|
121
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { ContourHandle, LineHandle, Vec3Handle } from "../../handles"
|
|
3
|
+
import type { PluginApiReturn } from "../../types"
|
|
4
|
+
import { PluginFamilyDefinitionParameter, PluginFamilyBundleSchema } from "./family"
|
|
5
|
+
import { NetworkFamilyContract } from "./networks"
|
|
6
|
+
|
|
7
|
+
/** Exact saved family identity. A label or a selected Draw type is not an identity. */
|
|
8
|
+
export const PluginSavedFamilyReference = z
|
|
9
|
+
.object({
|
|
10
|
+
id: z.string().min(1),
|
|
11
|
+
version: z.number().int().positive(),
|
|
12
|
+
})
|
|
13
|
+
.strict()
|
|
14
|
+
export type PluginSavedFamilyReference = z.infer<
|
|
15
|
+
typeof PluginSavedFamilyReference
|
|
16
|
+
>
|
|
17
|
+
|
|
18
|
+
/** Public overrides: physical lengths use mm, angles use degrees. Omitted values retain defaults. */
|
|
19
|
+
export const PluginFamilyValues = z.record(
|
|
20
|
+
z.string(),
|
|
21
|
+
z.union([z.number().finite(), z.string(), z.boolean()]),
|
|
22
|
+
)
|
|
23
|
+
export type PluginFamilyValues = z.infer<typeof PluginFamilyValues>
|
|
24
|
+
|
|
25
|
+
/** Native construction uses a saved family or a project assembly token from the catalogue. */
|
|
26
|
+
export const PluginConstructionType = z.union([
|
|
27
|
+
PluginSavedFamilyReference,
|
|
28
|
+
z.string().min(1),
|
|
29
|
+
])
|
|
30
|
+
export type PluginConstructionType = z.infer<typeof PluginConstructionType>
|
|
31
|
+
|
|
32
|
+
/** Family owns its layers/section. Geometry owns the footprint/axis; it is never a values override. */
|
|
33
|
+
export const PluginFamilyPlacement = z
|
|
34
|
+
.object({
|
|
35
|
+
type: PluginConstructionType,
|
|
36
|
+
values: PluginFamilyValues.optional(),
|
|
37
|
+
})
|
|
38
|
+
.strict()
|
|
39
|
+
export type PluginFamilyPlacement = z.infer<typeof PluginFamilyPlacement>
|
|
40
|
+
|
|
41
|
+
/** Sparse native family edit. Omitted type keeps the component's exact saved reference. */
|
|
42
|
+
export const PluginFamilyUpdates = PluginFamilyPlacement.partial().refine(
|
|
43
|
+
(updates) => updates.type !== undefined || updates.values !== undefined,
|
|
44
|
+
{ message: "Supply a type or parameter values" },
|
|
45
|
+
)
|
|
46
|
+
export type PluginFamilyUpdates = z.infer<typeof PluginFamilyUpdates>
|
|
47
|
+
|
|
48
|
+
export const PluginFamilyFloorOptions = PluginFamilyPlacement.extend({
|
|
49
|
+
position: Vec3Handle.optional(),
|
|
50
|
+
})
|
|
51
|
+
export type PluginFamilyFloorOptions = z.infer<typeof PluginFamilyFloorOptions>
|
|
52
|
+
export const PluginFamilySlabOptions = PluginFamilyPlacement.extend({
|
|
53
|
+
direction: z.enum(["up", "down"]).optional(),
|
|
54
|
+
})
|
|
55
|
+
export type PluginFamilySlabOptions = z.infer<typeof PluginFamilySlabOptions>
|
|
56
|
+
export const PluginFamilyCeilingOptions = PluginFamilyPlacement.extend({
|
|
57
|
+
heightFromFloor: z.number().finite().optional(),
|
|
58
|
+
})
|
|
59
|
+
export type PluginFamilyCeilingOptions = z.infer<
|
|
60
|
+
typeof PluginFamilyCeilingOptions
|
|
61
|
+
>
|
|
62
|
+
export const PluginFamilyContourArgs = z.object({
|
|
63
|
+
contour: ContourHandle,
|
|
64
|
+
options: PluginFamilyPlacement,
|
|
65
|
+
})
|
|
66
|
+
export const PluginFamilyAxisArgs = z.object({
|
|
67
|
+
axis: LineHandle,
|
|
68
|
+
options: PluginFamilyPlacement,
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
/** Inventory includes architectural recipes, ordinary PCs, and the existing placement libraries. */
|
|
72
|
+
export const PluginCatalogKind = z.enum([
|
|
73
|
+
"wall",
|
|
74
|
+
"floor",
|
|
75
|
+
"slab",
|
|
76
|
+
"roof",
|
|
77
|
+
"ceiling",
|
|
78
|
+
"beam",
|
|
79
|
+
"column",
|
|
80
|
+
"component",
|
|
81
|
+
"door",
|
|
82
|
+
"window",
|
|
83
|
+
"furniture",
|
|
84
|
+
])
|
|
85
|
+
export type PluginCatalogKind = z.infer<typeof PluginCatalogKind>
|
|
86
|
+
export const PluginCatalogReference = z.union([
|
|
87
|
+
PluginSavedFamilyReference,
|
|
88
|
+
// Project assemblies retain kind:name; asset tokens retain the underlying library identity.
|
|
89
|
+
z.string().min(1),
|
|
90
|
+
])
|
|
91
|
+
export type PluginCatalogReference = z.infer<typeof PluginCatalogReference>
|
|
92
|
+
|
|
93
|
+
/** Read-only capability record. Availability is checked again on every mutation. */
|
|
94
|
+
export const PluginCatalogEntry = z.object({
|
|
95
|
+
reference: PluginCatalogReference,
|
|
96
|
+
label: z.string(),
|
|
97
|
+
kind: PluginCatalogKind,
|
|
98
|
+
source: z.enum(["native", "revit", "project", "asset"]),
|
|
99
|
+
createMethods: z.array(z.string()),
|
|
100
|
+
updateMethods: z.array(z.string()),
|
|
101
|
+
requirements: z.array(z.string()),
|
|
102
|
+
unsupportedReason: z.string().optional(),
|
|
103
|
+
parameters: z.array(PluginFamilyDefinitionParameter).optional(),
|
|
104
|
+
/** Parameter keys owned by native placement geometry, never accepted as values overrides. */
|
|
105
|
+
geometryParameters: z.array(z.string()),
|
|
106
|
+
network: NetworkFamilyContract.optional(),
|
|
107
|
+
/** get() includes the native wall recipe without opening a Family Studio draft.
|
|
108
|
+
* Bare recipe lengths use SU; parameter metadata and public values overrides use mm.
|
|
109
|
+
*/
|
|
110
|
+
construction: PluginFamilyBundleSchema.optional(),
|
|
111
|
+
})
|
|
112
|
+
export type PluginCatalogEntry = z.infer<typeof PluginCatalogEntry>
|
|
113
|
+
export const PluginCatalogListArgs = z.object({
|
|
114
|
+
kind: PluginCatalogKind.optional(),
|
|
115
|
+
})
|
|
116
|
+
export const PluginCatalogGetArgs = z.object({
|
|
117
|
+
reference: PluginCatalogReference,
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
/** Shared read surface over existing libraries. Does not publish, register, or place definitions. */
|
|
121
|
+
export abstract class PluginDesignCatalogApi {
|
|
122
|
+
/** @param kind Optional element filter. @returns Accessible entries and their supported API paths. */
|
|
123
|
+
abstract list(kind?: PluginCatalogKind): PluginApiReturn<PluginCatalogEntry[]>
|
|
124
|
+
/** @param reference Exact reference from list. @returns The current entry, or null when unavailable. */
|
|
125
|
+
abstract get(
|
|
126
|
+
reference: PluginCatalogReference,
|
|
127
|
+
): PluginApiReturn<PluginCatalogEntry | null>
|
|
128
|
+
}
|