@snaptrude/plugin-core 0.9.14 → 0.9.16
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/api-manifest.json +527 -26
- 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/create/bulk-items.d.ts +44 -0
- package/dist/api/design/create/bulk-items.d.ts.map +1 -1
- package/dist/api/design/create/index.d.ts +31 -3
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/selection/index.d.ts +2 -2
- package/dist/api/design/update/index.d.ts +73 -0
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +13 -13
- 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 +3162 -2553
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3077 -2550
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- 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/create/bulk-items.ts +68 -0
- package/src/api/design/create/index.ts +30 -4
- package/src/api/design/update/index.ts +80 -1
- 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
|
@@ -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
|
+
>
|
|
@@ -9,6 +9,72 @@ import { PluginOpeningBaseOptions } from "./opening-fields"
|
|
|
9
9
|
*/
|
|
10
10
|
export const PLUGIN_CREATE_BATCH_LIMIT = 1000
|
|
11
11
|
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// wall top profile (raked / gabled walls)
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* One break point of a wall's top edge — see {@linkcode PluginWallTopProfile}.
|
|
18
|
+
*
|
|
19
|
+
* | Property | Type | Description |
|
|
20
|
+
* |---|---|---|
|
|
21
|
+
* | `along` | `number` | Position along the wall centerline as a fraction: `0` = start of the curve, `1` = end |
|
|
22
|
+
* | `height` | `number` | Top height above the wall base at that point (Snaptrude units, > 0) |
|
|
23
|
+
*/
|
|
24
|
+
export const PluginWallTopProfilePoint = z.object({
|
|
25
|
+
along: z.number().min(0).max(1),
|
|
26
|
+
height: z.number().positive(),
|
|
27
|
+
})
|
|
28
|
+
export type PluginWallTopProfilePoint = z.infer<
|
|
29
|
+
typeof PluginWallTopProfilePoint
|
|
30
|
+
>
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The top edge of ONE wall as a polyline over its centerline: at least two
|
|
34
|
+
* points, `along` strictly increasing from `0` (curve start) to `1` (curve end),
|
|
35
|
+
* straight segments between them. Two points give a single slope (a raked
|
|
36
|
+
* wall), three give a gable, more give any stepped or folded ridge. Heights are
|
|
37
|
+
* measured from the wall base, like `height`. Both long faces follow the same
|
|
38
|
+
* profile, so the top stays a set of flat faces and the wall keeps its thickness
|
|
39
|
+
* end to end.
|
|
40
|
+
*
|
|
41
|
+
* Only straight centerlines take a top profile (an arc curve with one is
|
|
42
|
+
* rejected). A wall built this way is a real Wall — doors and windows host on
|
|
43
|
+
* it, corners mitre, quantities and Revit export read its geometry — but it is
|
|
44
|
+
* **non-parametric**: the parametric wall graph does not rebuild it, so a later
|
|
45
|
+
* move of a neighbour does not re-mitre its corner, exactly like a wall whose
|
|
46
|
+
* top edge was dragged by hand. `design.update.wall({ height })` scales it
|
|
47
|
+
* proportionally.
|
|
48
|
+
*/
|
|
49
|
+
export const PluginWallTopProfile = z
|
|
50
|
+
.array(PluginWallTopProfilePoint)
|
|
51
|
+
.min(2)
|
|
52
|
+
.superRefine((points, ctx) => {
|
|
53
|
+
if (points[0].along !== 0) {
|
|
54
|
+
ctx.addIssue({
|
|
55
|
+
code: "custom",
|
|
56
|
+
message: "topProfile must start at along = 0",
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
if (points[points.length - 1].along !== 1) {
|
|
60
|
+
ctx.addIssue({
|
|
61
|
+
code: "custom",
|
|
62
|
+
message: "topProfile must end at along = 1",
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
for (let i = 1; i < points.length; i++) {
|
|
66
|
+
if (points[i].along <= points[i - 1].along) {
|
|
67
|
+
ctx.addIssue({
|
|
68
|
+
code: "custom",
|
|
69
|
+
message:
|
|
70
|
+
"topProfile points must be in strictly increasing `along` order",
|
|
71
|
+
})
|
|
72
|
+
break
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
export type PluginWallTopProfile = z.infer<typeof PluginWallTopProfile>
|
|
77
|
+
|
|
12
78
|
// ---------------------------------------------------------------------------
|
|
13
79
|
// wallRuns
|
|
14
80
|
// ---------------------------------------------------------------------------
|
|
@@ -24,6 +90,7 @@ export const PLUGIN_CREATE_BATCH_LIMIT = 1000
|
|
|
24
90
|
* | `thickness` | `number`? | Wall thickness (Snaptrude units, > 0; default: `wallType`'s total layer thickness when given, else engine default) |
|
|
25
91
|
* | `wallType` | `string`? | Wall type name from `design.types.list("wall")` — layers/material/thickness defaults (default generic) |
|
|
26
92
|
* | `storey` | `number`? (int) | Target storey (must exist) — the run's walls are assigned + lifted to its base in the same undo entry (default: geometry-derived) |
|
|
93
|
+
* | `topProfiles` | ({@linkcode PluginWallTopProfile} \| `null`)[]? | Top edge per curve of `profile`, same order; a `null` or missing entry keeps that wall flat at `height`. Raked / gabled walls (straight curves only) |
|
|
27
94
|
*/
|
|
28
95
|
export const PluginCreateWallRunItem = z.object({
|
|
29
96
|
profile: ProfileHandle,
|
|
@@ -31,6 +98,7 @@ export const PluginCreateWallRunItem = z.object({
|
|
|
31
98
|
thickness: z.number().optional(),
|
|
32
99
|
wallType: z.string().min(1).optional(),
|
|
33
100
|
storey: z.number().int().optional(),
|
|
101
|
+
topProfiles: z.array(PluginWallTopProfile.nullable()).optional(),
|
|
34
102
|
})
|
|
35
103
|
export type PluginCreateWallRunItem = z.infer<typeof PluginCreateWallRunItem>
|
|
36
104
|
|
|
@@ -28,6 +28,7 @@ import type {
|
|
|
28
28
|
PluginCreateWallRunItem,
|
|
29
29
|
PluginCreateWindowItem,
|
|
30
30
|
} from "./bulk-items"
|
|
31
|
+
import { PluginWallTopProfile } from "./bulk-items"
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* `design.create.*` — author new scene-committed BIM entities.
|
|
@@ -450,9 +451,15 @@ export abstract class PluginDesignCreateApi {
|
|
|
450
451
|
* single undo entry. The storey must already exist
|
|
451
452
|
* (`core.storeys.create` first). Default: geometry-derived — a profile
|
|
452
453
|
* drawn at y = 0 lands on storey 1; the ACTIVE storey is NOT consulted.
|
|
454
|
+
* @param topProfiles - Optional top edge per curve of `profile` (same order):
|
|
455
|
+
* a {@linkcode PluginWallTopProfile} makes that wall raked / gabled; `null`
|
|
456
|
+
* or a missing entry keeps it flat at `height`. Straight curves only. Such
|
|
457
|
+
* walls are non-parametric (see {@linkcode PluginWallTopProfile}).
|
|
453
458
|
* @returns a {@linkcode ComponentHandle}`[]` (one per wall), in profile order
|
|
454
459
|
* @throws if the profile is empty, `wallType` names no wall type in the
|
|
455
|
-
* project, `storey` does not exist,
|
|
460
|
+
* project, `storey` does not exist, `topProfiles` has more entries than the
|
|
461
|
+
* profile has curves or names an arc curve, a top profile drops to the wall
|
|
462
|
+
* base at a mitred corner, or wall creation fails
|
|
456
463
|
*
|
|
457
464
|
* @examplePrompt Draw walls along this centerline
|
|
458
465
|
* @examplePrompt Create 3m high, 200mm thick walls from these points
|
|
@@ -461,6 +468,9 @@ export abstract class PluginDesignCreateApi {
|
|
|
461
468
|
* @examplePrompt Add walls with mitred corners along the path
|
|
462
469
|
* @examplePrompt Draw brick walls with plaster along this outline
|
|
463
470
|
* @examplePrompt Build the perimeter in exposed concrete walls
|
|
471
|
+
* @examplePrompt Create a raked wall that slopes from 3m to 5m
|
|
472
|
+
* @examplePrompt Build a gable end wall with the ridge in the middle
|
|
473
|
+
* @examplePrompt Draw a wall with a sloped top edge
|
|
464
474
|
*
|
|
465
475
|
* # Example
|
|
466
476
|
* ```ts
|
|
@@ -476,6 +486,13 @@ export abstract class PluginDesignCreateApi {
|
|
|
476
486
|
* const brickWalls = await snaptrude.design.create.walls(
|
|
477
487
|
* centerlines, 3, undefined, brick.label,
|
|
478
488
|
* )
|
|
489
|
+
* // …a raked wall (3m at the start, 5m at the end) on a single centerline:
|
|
490
|
+
* const run = await snaptrude.core.geom.create.profileFromCurves([
|
|
491
|
+
* await snaptrude.core.geom.create.line(await v.new(0, 0, 10), await v.new(8, 0, 10)),
|
|
492
|
+
* ])
|
|
493
|
+
* const [raked] = await snaptrude.design.create.walls(run, undefined, 0.2, undefined, undefined, [
|
|
494
|
+
* [{ along: 0, height: 3 }, { along: 1, height: 5 }],
|
|
495
|
+
* ])
|
|
479
496
|
* ```
|
|
480
497
|
*
|
|
481
498
|
* @performance For MORE THAN ONE run, call `design.create.wallRuns(items[])` — one
|
|
@@ -488,6 +505,7 @@ export abstract class PluginDesignCreateApi {
|
|
|
488
505
|
thickness?: number,
|
|
489
506
|
wallType?: string,
|
|
490
507
|
storey?: number,
|
|
508
|
+
topProfiles?: (PluginWallTopProfile | null)[],
|
|
491
509
|
): PluginApiReturn<ComponentHandle[]>
|
|
492
510
|
|
|
493
511
|
/**
|
|
@@ -496,7 +514,9 @@ export abstract class PluginDesignCreateApi {
|
|
|
496
514
|
* item's profile chain, mitred at shared endpoints. Junctions resolve within a
|
|
497
515
|
* run, not between runs. Each item carries its own
|
|
498
516
|
* dimensions, `wallType` and `storey`, so a single call can build a whole
|
|
499
|
-
* floor plate or several storeys at once.
|
|
517
|
+
* floor plate or several storeys at once. Per-curve `topProfiles` make raked
|
|
518
|
+
* or gabled walls (see {@linkcode PluginWallTopProfile}). Validate-all-or-throw;
|
|
519
|
+
* one command.
|
|
500
520
|
*
|
|
501
521
|
* @param items - One {@linkcode PluginCreateWallRunItem} per run to create
|
|
502
522
|
* (≥1, ≤1000)
|
|
@@ -516,6 +536,7 @@ export abstract class PluginDesignCreateApi {
|
|
|
516
536
|
* @examplePrompt Bulk create wall runs from these centerlines
|
|
517
537
|
* @examplePrompt Create the walls for both storeys in a single undo step
|
|
518
538
|
* @examplePrompt Turn these polylines into 200mm brick walls together
|
|
539
|
+
* @examplePrompt Import these raked walls with their top profiles in one go
|
|
519
540
|
*
|
|
520
541
|
* @performance Bulk creator — the whole batch is ONE host round-trip and ONE undo
|
|
521
542
|
* entry. Always prefer this over calling `design.create.walls` in a loop: build the
|
|
@@ -536,6 +557,9 @@ export abstract class PluginDesignCreateApi {
|
|
|
536
557
|
* const [groundWalls, upperWalls] = await snaptrude.design.create.wallRuns([
|
|
537
558
|
* { profile: ground, height: 3, thickness: 0.2 },
|
|
538
559
|
* { profile: upper, height: 3, storey: 2 },
|
|
560
|
+
* // one gable wall: 3m at both ends, 5m ridge in the middle
|
|
561
|
+
* { profile: upper, thickness: 0.2, storey: 3,
|
|
562
|
+
* topProfiles: [[{ along: 0, height: 3 }, { along: 0.5, height: 5 }, { along: 1, height: 3 }]] },
|
|
539
563
|
* ])
|
|
540
564
|
* console.log(groundWalls.length, "walls on the ground floor")
|
|
541
565
|
* ```
|
|
@@ -1638,6 +1662,7 @@ export type PluginDesignCreateBeamArgs = z.infer<
|
|
|
1638
1662
|
* | `thickness` | `number`? | Wall thickness (default: `wallType`'s total layer thickness when given, else engine default) |
|
|
1639
1663
|
* | `wallType` | `string`? | Wall type name from `design.types.list("wall")` — layers/material/thickness defaults (default generic) |
|
|
1640
1664
|
* | `storey` | `number`? | Target storey (integer, must exist) — walls assigned + lifted to its base in the same undo entry (default: geometry-derived) |
|
|
1665
|
+
* | `topProfiles` | ({@linkcode PluginWallTopProfile} \| `null`)[]? | Top edge per curve (same order); `null`/missing = flat at `height`. Straight curves only |
|
|
1641
1666
|
*/
|
|
1642
1667
|
export const PluginDesignCreateWallsArgs = z.object({
|
|
1643
1668
|
profile: ProfileHandle,
|
|
@@ -1645,12 +1670,13 @@ export const PluginDesignCreateWallsArgs = z.object({
|
|
|
1645
1670
|
thickness: z.number().optional(),
|
|
1646
1671
|
wallType: z.string().min(1).optional(),
|
|
1647
1672
|
storey: z.number().int().optional(),
|
|
1673
|
+
topProfiles: z.array(PluginWallTopProfile.nullable()).optional(),
|
|
1648
1674
|
})
|
|
1649
1675
|
export type PluginDesignCreateWallsArgs = z.infer<
|
|
1650
1676
|
typeof PluginDesignCreateWallsArgs
|
|
1651
1677
|
>
|
|
1652
|
-
// TRANSPORT: positional signature shipped — storey is the
|
|
1653
|
-
// walls(profile: ProfileHandle, height?: number, thickness?: number, wallType?: string, storey?: number)
|
|
1678
|
+
// TRANSPORT: positional signature shipped — storey is the 5th arg, topProfiles the trailing 6th:
|
|
1679
|
+
// walls(profile: ProfileHandle, height?: number, thickness?: number, wallType?: string, storey?: number, topProfiles?: (PluginWallTopProfile | null)[])
|
|
1654
1680
|
|
|
1655
1681
|
// ---------------------------------------------------------------------------
|
|
1656
1682
|
// staircase
|