@snaptrude/plugin-core 0.9.16 → 0.9.18-voids-20261016.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.
Files changed (107) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/api-manifest.full.json +10406 -0
  3. package/api-manifest.json +827 -51
  4. package/dist/api/analysis/daylight.d.ts +5 -5
  5. package/dist/api/analysis/solar.d.ts +2 -2
  6. package/dist/api/core/camera/index.d.ts +29 -0
  7. package/dist/api/core/camera/index.d.ts.map +1 -1
  8. package/dist/api/core/geom/create/index.d.ts +7 -1
  9. package/dist/api/core/geom/create/index.d.ts.map +1 -1
  10. package/dist/api/core/geom/update/contour.d.ts +8 -2
  11. package/dist/api/core/geom/update/contour.d.ts.map +1 -1
  12. package/dist/api/core/zoom/index.d.ts +13 -0
  13. package/dist/api/core/zoom/index.d.ts.map +1 -1
  14. package/dist/api/design/bim.d.ts +209 -0
  15. package/dist/api/design/bim.d.ts.map +1 -0
  16. package/dist/api/design/boolean/index.d.ts +2 -0
  17. package/dist/api/design/boolean/index.d.ts.map +1 -1
  18. package/dist/api/design/catalog.d.ts +320 -0
  19. package/dist/api/design/catalog.d.ts.map +1 -0
  20. package/dist/api/design/create/bulk-items.d.ts +65 -25
  21. package/dist/api/design/create/bulk-items.d.ts.map +1 -1
  22. package/dist/api/design/create/index.d.ts +272 -99
  23. package/dist/api/design/create/index.d.ts.map +1 -1
  24. package/dist/api/design/create/opening-fields.d.ts +13 -12
  25. package/dist/api/design/create/opening-fields.d.ts.map +1 -1
  26. package/dist/api/design/delete/index.d.ts +1 -0
  27. package/dist/api/design/delete/index.d.ts.map +1 -1
  28. package/dist/api/design/doors/index.d.ts +18 -24
  29. package/dist/api/design/doors/index.d.ts.map +1 -1
  30. package/dist/api/design/family.d.ts +797 -27
  31. package/dist/api/design/family.d.ts.map +1 -1
  32. package/dist/api/design/index.d.ts +16 -0
  33. package/dist/api/design/index.d.ts.map +1 -1
  34. package/dist/api/design/networks.d.ts +1703 -0
  35. package/dist/api/design/networks.d.ts.map +1 -0
  36. package/dist/api/design/query/index.d.ts +42 -32
  37. package/dist/api/design/query/index.d.ts.map +1 -1
  38. package/dist/api/design/selection/index.d.ts +10 -10
  39. package/dist/api/design/types/index.d.ts +40 -24
  40. package/dist/api/design/types/index.d.ts.map +1 -1
  41. package/dist/api/design/update/index.d.ts +43 -3
  42. package/dist/api/design/update/index.d.ts.map +1 -1
  43. package/dist/api/design/windows/index.d.ts +8 -8
  44. package/dist/api/design/windows/index.d.ts.map +1 -1
  45. package/dist/api/presentation/aiInspiration.d.ts +10 -10
  46. package/dist/api/presentation/annotate.d.ts +38 -22
  47. package/dist/api/presentation/annotate.d.ts.map +1 -1
  48. package/dist/api/presentation/drawingContract.d.ts +32 -0
  49. package/dist/api/presentation/drawingContract.d.ts.map +1 -0
  50. package/dist/api/presentation/drawings.d.ts +3523 -0
  51. package/dist/api/presentation/drawings.d.ts.map +1 -0
  52. package/dist/api/presentation/export.d.ts +23 -5
  53. package/dist/api/presentation/export.d.ts.map +1 -1
  54. package/dist/api/presentation/index.d.ts +41 -12
  55. package/dist/api/presentation/index.d.ts.map +1 -1
  56. package/dist/api/presentation/placedViews.d.ts +106 -6
  57. package/dist/api/presentation/placedViews.d.ts.map +1 -1
  58. package/dist/api/presentation/sections.d.ts +461 -0
  59. package/dist/api/presentation/sections.d.ts.map +1 -0
  60. package/dist/api/presentation/shapes.d.ts +2 -2
  61. package/dist/api/presentation/sheets.d.ts +175 -19
  62. package/dist/api/presentation/sheets.d.ts.map +1 -1
  63. package/dist/api/presentation/viewPresets.d.ts +222 -0
  64. package/dist/api/presentation/viewPresets.d.ts.map +1 -0
  65. package/dist/api/presentation/views.d.ts +103 -5
  66. package/dist/api/presentation/views.d.ts.map +1 -1
  67. package/dist/api/presentation/walkthroughs.d.ts +6 -6
  68. package/dist/errors/codes.d.ts +3 -1
  69. package/dist/errors/codes.d.ts.map +1 -1
  70. package/dist/index.cjs +3749 -2328
  71. package/dist/index.cjs.map +1 -1
  72. package/dist/index.js +3616 -2328
  73. package/dist/index.js.map +1 -1
  74. package/package.json +1 -1
  75. package/scripts/generate-manifest.mjs +5 -0
  76. package/src/api/core/camera/index.ts +29 -0
  77. package/src/api/core/geom/create/index.ts +7 -1
  78. package/src/api/core/geom/update/contour.ts +8 -2
  79. package/src/api/core/zoom/index.ts +13 -0
  80. package/src/api/design/bim.ts +121 -0
  81. package/src/api/design/boolean/index.ts +2 -0
  82. package/src/api/design/catalog.ts +203 -0
  83. package/src/api/design/create/bulk-items.ts +57 -17
  84. package/src/api/design/create/index.ts +288 -120
  85. package/src/api/design/create/opening-fields.ts +15 -12
  86. package/src/api/design/delete/index.ts +1 -0
  87. package/src/api/design/doors/index.ts +58 -42
  88. package/src/api/design/family.ts +662 -32
  89. package/src/api/design/index.ts +34 -4
  90. package/src/api/design/networks.ts +607 -0
  91. package/src/api/design/query/index.ts +12 -2
  92. package/src/api/design/types/index.ts +31 -24
  93. package/src/api/design/update/index.ts +44 -3
  94. package/src/api/design/windows/index.ts +40 -22
  95. package/src/api/presentation/annotate.ts +90 -58
  96. package/src/api/presentation/drawingContract.ts +70 -0
  97. package/src/api/presentation/drawings.ts +1179 -0
  98. package/src/api/presentation/export.ts +32 -6
  99. package/src/api/presentation/index.ts +48 -14
  100. package/src/api/presentation/placedViews.ts +119 -28
  101. package/src/api/presentation/sections.ts +420 -0
  102. package/src/api/presentation/sheets.ts +181 -20
  103. package/src/api/presentation/viewPresets.ts +241 -0
  104. package/src/api/presentation/views.ts +46 -6
  105. package/src/errors/codes.ts +7 -0
  106. package/test/drawingContract.test.mjs +288 -0
  107. package/test/errors.test.mjs +1 -0
@@ -0,0 +1,461 @@
1
+ import * as z from "zod";
2
+ import type { PluginApiReturn } from "../../types";
3
+ /** A point on the plan: world `x` and `z` in babylon units. */
4
+ export declare const PluginSectionPoint: z.ZodObject<{
5
+ x: z.ZodNumber;
6
+ z: z.ZodNumber;
7
+ }, z.core.$strict>;
8
+ export type PluginSectionPoint = z.infer<typeof PluginSectionPoint>;
9
+ /**
10
+ * A section: a line drawn on the plan that cuts the model and looks one way
11
+ * along it.
12
+ *
13
+ * | Property | Type | Description |
14
+ * |---|---|---|
15
+ * | `sectionId` | `string` | The section's id |
16
+ * | `name` | `string` | Its name in the Views panel ("Section 1") |
17
+ * | `tagLabel` | `string` | What its heads are marked with on the plan ("A") |
18
+ * | `buildingId` | `string` | The building it belongs to |
19
+ * | `start` | {@linkcode PluginSectionPoint} | First head on the plan |
20
+ * | `end` | {@linkcode PluginSectionPoint} | Second head on the plan |
21
+ * | `isFlipped` | `boolean` | Looks the other way along the line |
22
+ * | `depth` | `number` | How far behind the line the view keeps, babylon units |
23
+ * | `base` | `number` | Bottom of the slice, world Y |
24
+ * | `top` | `number` | Top of the slice, world Y |
25
+ * | `isHidden` | `boolean` | The line is hidden on the plan |
26
+ * | `isLocked` | `boolean` | Geometry edits are refused |
27
+ * | `isActive` | `boolean` | It is the section view open now |
28
+ */
29
+ export declare const PluginSection: z.ZodObject<{
30
+ sectionId: z.ZodString;
31
+ name: z.ZodString;
32
+ tagLabel: z.ZodString;
33
+ buildingId: z.ZodString;
34
+ start: z.ZodObject<{
35
+ x: z.ZodNumber;
36
+ z: z.ZodNumber;
37
+ }, z.core.$strict>;
38
+ end: z.ZodObject<{
39
+ x: z.ZodNumber;
40
+ z: z.ZodNumber;
41
+ }, z.core.$strict>;
42
+ isFlipped: z.ZodBoolean;
43
+ depth: z.ZodNumber;
44
+ base: z.ZodNumber;
45
+ top: z.ZodNumber;
46
+ isHidden: z.ZodBoolean;
47
+ isLocked: z.ZodBoolean;
48
+ isActive: z.ZodBoolean;
49
+ }, z.core.$strip>;
50
+ export type PluginSection = z.infer<typeof PluginSection>;
51
+ export declare const PluginSectionIdArgs: z.ZodObject<{
52
+ sectionId: z.ZodString;
53
+ }, z.core.$strict>;
54
+ export type PluginSectionIdArgs = z.infer<typeof PluginSectionIdArgs>;
55
+ /**
56
+ * Options for {@linkcode PluginPresentationSectionsApi.create}.
57
+ *
58
+ * | Property | Type | Description |
59
+ * |---|---|---|
60
+ * | `name` | `string \| undefined` | Name in the Views panel (default: the next "Section N") |
61
+ * | `tagLabel` | `string \| undefined` | Head mark on the plan (default: the next free mark) |
62
+ * | `depth` | `number \| undefined` | How far behind the line the view keeps (default: to the far side of the model) |
63
+ * | `base` | `number \| undefined` | Bottom of the slice, world Y (default: the building's base) |
64
+ * | `top` | `number \| undefined` | Top of the slice, world Y (default: the building's top) |
65
+ * | `buildingId` | `string \| undefined` | Building it belongs to (default: the active one) |
66
+ * | `isActive` | `boolean \| undefined` | Open the section view once created (default `false`) |
67
+ */
68
+ export declare const PluginSectionCreateOptions: z.ZodObject<{
69
+ name: z.ZodOptional<z.ZodString>;
70
+ tagLabel: z.ZodOptional<z.ZodString>;
71
+ depth: z.ZodOptional<z.ZodNumber>;
72
+ base: z.ZodOptional<z.ZodNumber>;
73
+ top: z.ZodOptional<z.ZodNumber>;
74
+ buildingId: z.ZodOptional<z.ZodString>;
75
+ isActive: z.ZodOptional<z.ZodBoolean>;
76
+ }, z.core.$strict>;
77
+ export type PluginSectionCreateOptions = z.infer<typeof PluginSectionCreateOptions>;
78
+ export declare const PluginSectionCreateArgs: z.ZodObject<{
79
+ start: z.ZodObject<{
80
+ x: z.ZodNumber;
81
+ z: z.ZodNumber;
82
+ }, z.core.$strict>;
83
+ end: z.ZodObject<{
84
+ x: z.ZodNumber;
85
+ z: z.ZodNumber;
86
+ }, z.core.$strict>;
87
+ options: z.ZodOptional<z.ZodObject<{
88
+ name: z.ZodOptional<z.ZodString>;
89
+ tagLabel: z.ZodOptional<z.ZodString>;
90
+ depth: z.ZodOptional<z.ZodNumber>;
91
+ base: z.ZodOptional<z.ZodNumber>;
92
+ top: z.ZodOptional<z.ZodNumber>;
93
+ buildingId: z.ZodOptional<z.ZodString>;
94
+ isActive: z.ZodOptional<z.ZodBoolean>;
95
+ }, z.core.$strict>>;
96
+ }, z.core.$strict>;
97
+ export type PluginSectionCreateArgs = z.infer<typeof PluginSectionCreateArgs>;
98
+ /**
99
+ * The fields to change in {@linkcode PluginPresentationSectionsApi.update};
100
+ * omitted fields keep their value.
101
+ *
102
+ * | Property | Type | Description |
103
+ * |---|---|---|
104
+ * | `name` | `string \| undefined` | Name in the Views panel |
105
+ * | `tagLabel` | `string \| undefined` | Head mark on the plan |
106
+ * | `start` | {@linkcode PluginSectionPoint} `\| undefined` | First head |
107
+ * | `end` | {@linkcode PluginSectionPoint} `\| undefined` | Second head |
108
+ * | `isFlipped` | `boolean \| undefined` | Look the other way; without `depth`, the depth re-spans the model the new way |
109
+ * | `depth` | `number \| undefined` | View depth behind the line, > 0 |
110
+ * | `base` | `number \| undefined` | Bottom of the slice, world Y |
111
+ * | `top` | `number \| undefined` | Top of the slice, world Y; above `base` |
112
+ * | `isHidden` | `boolean \| undefined` | Hide the line on the plan |
113
+ */
114
+ export declare const PluginSectionPatch: z.ZodObject<{
115
+ name: z.ZodOptional<z.ZodString>;
116
+ tagLabel: z.ZodOptional<z.ZodString>;
117
+ start: z.ZodOptional<z.ZodObject<{
118
+ x: z.ZodNumber;
119
+ z: z.ZodNumber;
120
+ }, z.core.$strict>>;
121
+ end: z.ZodOptional<z.ZodObject<{
122
+ x: z.ZodNumber;
123
+ z: z.ZodNumber;
124
+ }, z.core.$strict>>;
125
+ isFlipped: z.ZodOptional<z.ZodBoolean>;
126
+ depth: z.ZodOptional<z.ZodNumber>;
127
+ base: z.ZodOptional<z.ZodNumber>;
128
+ top: z.ZodOptional<z.ZodNumber>;
129
+ isHidden: z.ZodOptional<z.ZodBoolean>;
130
+ }, z.core.$strict>;
131
+ export type PluginSectionPatch = z.infer<typeof PluginSectionPatch>;
132
+ export declare const PluginSectionUpdateArgs: z.ZodObject<{
133
+ sectionId: z.ZodString;
134
+ patch: z.ZodObject<{
135
+ name: z.ZodOptional<z.ZodString>;
136
+ tagLabel: z.ZodOptional<z.ZodString>;
137
+ start: z.ZodOptional<z.ZodObject<{
138
+ x: z.ZodNumber;
139
+ z: z.ZodNumber;
140
+ }, z.core.$strict>>;
141
+ end: z.ZodOptional<z.ZodObject<{
142
+ x: z.ZodNumber;
143
+ z: z.ZodNumber;
144
+ }, z.core.$strict>>;
145
+ isFlipped: z.ZodOptional<z.ZodBoolean>;
146
+ depth: z.ZodOptional<z.ZodNumber>;
147
+ base: z.ZodOptional<z.ZodNumber>;
148
+ top: z.ZodOptional<z.ZodNumber>;
149
+ isHidden: z.ZodOptional<z.ZodBoolean>;
150
+ }, z.core.$strict>;
151
+ }, z.core.$strict>;
152
+ export type PluginSectionUpdateArgs = z.infer<typeof PluginSectionUpdateArgs>;
153
+ /**
154
+ * Options for {@linkcode PluginPresentationSectionsApi.getCut}.
155
+ *
156
+ * | Property | Type | Description |
157
+ * |---|---|---|
158
+ * | `maxSegmentsPerElement` | `number \| undefined` | Outline segments to return per element, 0 to 2000 (default 0: none) |
159
+ */
160
+ export declare const PluginSectionCutOptions: z.ZodObject<{
161
+ maxSegmentsPerElement: z.ZodOptional<z.ZodNumber>;
162
+ }, z.core.$strict>;
163
+ export type PluginSectionCutOptions = z.infer<typeof PluginSectionCutOptions>;
164
+ export declare const PluginSectionCutArgs: z.ZodObject<{
165
+ sectionId: z.ZodString;
166
+ options: z.ZodOptional<z.ZodObject<{
167
+ maxSegmentsPerElement: z.ZodOptional<z.ZodNumber>;
168
+ }, z.core.$strict>>;
169
+ }, z.core.$strict>;
170
+ export type PluginSectionCutArgs = z.infer<typeof PluginSectionCutArgs>;
171
+ /**
172
+ * A rect on the cutting plane. `u` runs along the line from the first head
173
+ * (0) to the second (the line's length); `v` is world Y.
174
+ */
175
+ export declare const PluginSectionExtent: z.ZodObject<{
176
+ uMin: z.ZodNumber;
177
+ uMax: z.ZodNumber;
178
+ vMin: z.ZodNumber;
179
+ vMax: z.ZodNumber;
180
+ }, z.core.$strip>;
181
+ export type PluginSectionExtent = z.infer<typeof PluginSectionExtent>;
182
+ /**
183
+ * One element a section cuts.
184
+ *
185
+ * | Property | Type | Description |
186
+ * |---|---|---|
187
+ * | `entityId` | `string` | The element's component id (a `ComponentHandle`) |
188
+ * | `type` | `string` | Its component type ("wall", "slab", "mass", …) |
189
+ * | `area` | `number` | Cut area inside the section's extents, square babylon units |
190
+ * | `perimeter` | `number` | Length of the cut outline inside the extents, babylon units |
191
+ * | `extent` | {@linkcode PluginSectionExtent} | Where the cut lies on the plane |
192
+ * | `isHatched` | `boolean` | `false` for masses and voids, which the drawing leaves unfilled |
193
+ * | `isOpening` | `boolean` | Doors and windows, which the drawing fills white |
194
+ * | `segments` | `[u0, v0, u1, v1][]` | Cut outline segments, when asked for |
195
+ * | `droppedSegmentCount` | `number` | Segments not returned because of `maxSegmentsPerElement` |
196
+ */
197
+ export declare const PluginSectionCutElement: z.ZodObject<{
198
+ entityId: z.ZodString;
199
+ type: z.ZodString;
200
+ area: z.ZodNumber;
201
+ perimeter: z.ZodNumber;
202
+ extent: z.ZodObject<{
203
+ uMin: z.ZodNumber;
204
+ uMax: z.ZodNumber;
205
+ vMin: z.ZodNumber;
206
+ vMax: z.ZodNumber;
207
+ }, z.core.$strip>;
208
+ isHatched: z.ZodBoolean;
209
+ isOpening: z.ZodBoolean;
210
+ segments: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
211
+ droppedSegmentCount: z.ZodNumber;
212
+ }, z.core.$strip>;
213
+ export type PluginSectionCutElement = z.infer<typeof PluginSectionCutElement>;
214
+ /**
215
+ * What a section cuts, from {@linkcode PluginPresentationSectionsApi.getCut}.
216
+ *
217
+ * | Property | Type | Description |
218
+ * |---|---|---|
219
+ * | `sectionId` | `string` | The section |
220
+ * | `origin` | `{ x, y, z }` | World point at `u = 0, v = 0`: the first head, at Y 0 |
221
+ * | `uAxis` | `{ x, y, z }` | Unit direction of `u`: from the first head to the second |
222
+ * | `normal` | `{ x, y, z }` | Unit direction the section looks |
223
+ * | `extent` | {@linkcode PluginSectionExtent} | The cut rect: `u` 0 to the line's length, `v` base to top |
224
+ * | `elements` | {@linkcode PluginSectionCutElement}`[]` | What it cuts, largest area first |
225
+ * | `candidateCount` | `number` | Meshes near the plane that were tested |
226
+ * | `durationInMs` | `number` | Time the query took |
227
+ */
228
+ export declare const PluginSectionCut: z.ZodObject<{
229
+ sectionId: z.ZodString;
230
+ origin: z.ZodObject<{
231
+ x: z.ZodNumber;
232
+ y: z.ZodNumber;
233
+ z: z.ZodNumber;
234
+ }, z.core.$strip>;
235
+ uAxis: z.ZodObject<{
236
+ x: z.ZodNumber;
237
+ y: z.ZodNumber;
238
+ z: z.ZodNumber;
239
+ }, z.core.$strip>;
240
+ normal: z.ZodObject<{
241
+ x: z.ZodNumber;
242
+ y: z.ZodNumber;
243
+ z: z.ZodNumber;
244
+ }, z.core.$strip>;
245
+ extent: z.ZodObject<{
246
+ uMin: z.ZodNumber;
247
+ uMax: z.ZodNumber;
248
+ vMin: z.ZodNumber;
249
+ vMax: z.ZodNumber;
250
+ }, z.core.$strip>;
251
+ elements: z.ZodArray<z.ZodObject<{
252
+ entityId: z.ZodString;
253
+ type: z.ZodString;
254
+ area: z.ZodNumber;
255
+ perimeter: z.ZodNumber;
256
+ extent: z.ZodObject<{
257
+ uMin: z.ZodNumber;
258
+ uMax: z.ZodNumber;
259
+ vMin: z.ZodNumber;
260
+ vMax: z.ZodNumber;
261
+ }, z.core.$strip>;
262
+ isHatched: z.ZodBoolean;
263
+ isOpening: z.ZodBoolean;
264
+ segments: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
265
+ droppedSegmentCount: z.ZodNumber;
266
+ }, z.core.$strip>>;
267
+ candidateCount: z.ZodNumber;
268
+ durationInMs: z.ZodNumber;
269
+ }, z.core.$strip>;
270
+ export type PluginSectionCut = z.infer<typeof PluginSectionCut>;
271
+ /**
272
+ * Sections: lines on the plan that cut the model, each with its own section
273
+ * view.
274
+ *
275
+ * A section is a cutting plane through its line, vertical, looking one way
276
+ * along it; its view keeps `depth` behind the line, between `base` and `top`.
277
+ * Create, read, edit and delete sections (`create`, `list`, `get`, `update`,
278
+ * `delete`), open one's view (`setActive`, `getActive`), and ask what it cuts
279
+ * (`getCut`): which elements the plane passes through, with the area, outline
280
+ * and extent of each cut. `getCut` is computed from the model, needs no open
281
+ * view and changes nothing.
282
+ *
283
+ * Writes are write-gated and each call is one undo step. Geometry edits
284
+ * (`start`, `end`, `isFlipped`, `depth`, `base`, `top`) are refused on a locked
285
+ * section; names, marks and hiding are not, and repeating a locked section's
286
+ * geometry unchanged is not a geometry edit. View-only collaborators cannot
287
+ * write.
288
+ *
289
+ * Positions are world coordinates in internal `babylon` units (1 unit =
290
+ * 0.254 m, Y up); a section's heads are plan points `{ x, z }`. Accessed via
291
+ * `snaptrude.presentation.sections`.
292
+ */
293
+ export declare abstract class PluginPresentationSectionsApi {
294
+ constructor();
295
+ /**
296
+ * List the project's sections, in Views panel order.
297
+ *
298
+ * @returns Every {@linkcode PluginSection} (`[]` when there are none).
299
+ *
300
+ * @examplePrompt Which sections are there?
301
+ * @examplePrompt List the section lines in this project
302
+ * @examplePrompt Is there a section through the stair?
303
+ *
304
+ * # Example
305
+ * ```ts
306
+ * const sections = await snaptrude.presentation.sections.list()
307
+ * ```
308
+ */
309
+ abstract list(): PluginApiReturn<PluginSection[]>;
310
+ /**
311
+ * Get one section by id.
312
+ *
313
+ * @param sectionId - The section's id
314
+ * @returns The {@linkcode PluginSection}, or `null` when there is none with that id.
315
+ *
316
+ * @examplePrompt Where does Section A run?
317
+ * @examplePrompt How deep is this section?
318
+ *
319
+ * # Example
320
+ * ```ts
321
+ * const section = await snaptrude.presentation.sections.get(sectionId)
322
+ * console.log(section?.start, section?.end)
323
+ * ```
324
+ */
325
+ abstract get(sectionId: string): PluginApiReturn<PluginSection | null>;
326
+ /**
327
+ * Get the section whose view is open.
328
+ *
329
+ * @returns The open {@linkcode PluginSection}, or `null` when no section view is open.
330
+ *
331
+ * @examplePrompt Which section am I looking at?
332
+ *
333
+ * # Example
334
+ * ```ts
335
+ * const open = await snaptrude.presentation.sections.getActive()
336
+ * ```
337
+ */
338
+ abstract getActive(): PluginApiReturn<PluginSection | null>;
339
+ /**
340
+ * Open a section's view, or close the open one with `null`. Opening frames
341
+ * the section's saved camera, or a straight-on view when it has none.
342
+ * Closing returns to 3D; with no section view open, `null` does nothing. Not
343
+ * an edit: nothing is added to the undo history.
344
+ *
345
+ * @param sectionId - The section to open, or `null` to close the section view
346
+ * @returns The open {@linkcode PluginSection}, or `null` after closing.
347
+ * @throws HANDLE_INVALID when there is no section with that id.
348
+ *
349
+ * @examplePrompt Open Section A
350
+ * @examplePrompt Show me the section through the atrium
351
+ * @examplePrompt Close the section view
352
+ *
353
+ * # Example
354
+ * ```ts
355
+ * await snaptrude.presentation.sections.setActive(section.sectionId)
356
+ * await snaptrude.presentation.sections.setActive(null)
357
+ * ```
358
+ */
359
+ abstract setActive(sectionId: string | null): PluginApiReturn<PluginSection | null>;
360
+ /**
361
+ * Draw a section line from `start` to `end` on the plan. The section looks
362
+ * along the line's direction turned a quarter turn — a line drawn toward +x
363
+ * looks toward +z; flip it with `update(id, { isFlipped: true })`. Its slice
364
+ * defaults to the building's full height and its depth to the far side of
365
+ * the model. Write-gated; one undo step.
366
+ *
367
+ * @param start - First head, a plan point `{ x, z }`
368
+ * @param end - Second head; must differ from `start`
369
+ * @param options - Name, mark, depth, slice, building and whether to open it ({@linkcode PluginSectionCreateOptions})
370
+ * @returns The new {@linkcode PluginSection}.
371
+ * @throws METHOD_NOT_PERMITTED when plugin writes are disabled. VALIDATION when
372
+ * `start` and `end` coincide or `top` is not above `base`. PRECONDITION_FAILED
373
+ * when the project is view-only or has no model to cut.
374
+ *
375
+ * @examplePrompt Cut a section through the middle of the building, east to west
376
+ * @examplePrompt Add a section across the stair core
377
+ * @examplePrompt Draw a longitudinal section and open it
378
+ *
379
+ * # Example
380
+ * ```ts
381
+ * const section = await snaptrude.presentation.sections.create(
382
+ * { x: -40, z: 10 },
383
+ * { x: 40, z: 10 },
384
+ * { name: "Longitudinal", isActive: true },
385
+ * )
386
+ * ```
387
+ */
388
+ abstract create(start: PluginSectionPoint, end: PluginSectionPoint, options?: PluginSectionCreateOptions): PluginApiReturn<PluginSection>;
389
+ /**
390
+ * Change a section. Only the given fields change; the whole patch is one
391
+ * undo step. Flipping without a `depth` carries the depth to the far side of
392
+ * the model in the new direction, as `create` does. Write-gated.
393
+ *
394
+ * @param sectionId - The section's id
395
+ * @param patch - The fields to change ({@linkcode PluginSectionPatch})
396
+ * @returns The updated {@linkcode PluginSection}.
397
+ * @throws METHOD_NOT_PERMITTED when plugin writes are disabled. HANDLE_INVALID when
398
+ * there is no section with that id. VALIDATION when the heads coincide or `top`
399
+ * is not above `base`. PRECONDITION_FAILED when the project is view-only, or the
400
+ * patch changes a locked section's geometry.
401
+ *
402
+ * @examplePrompt Make Section A look the other way
403
+ * @examplePrompt Only show the ground floor in this section
404
+ * @examplePrompt Rename the section to "Through atrium"
405
+ * @examplePrompt Move the section line 5 m north
406
+ *
407
+ * # Example
408
+ * ```ts
409
+ * await snaptrude.presentation.sections.update(sectionId, {
410
+ * isFlipped: true,
411
+ * depth: 60,
412
+ * })
413
+ * ```
414
+ */
415
+ abstract update(sectionId: string, patch: PluginSectionPatch): PluginApiReturn<PluginSection>;
416
+ /**
417
+ * Delete a section. Closes its view first if it is open. Write-gated; one
418
+ * undo step.
419
+ *
420
+ * @param sectionId - The section's id
421
+ * @returns `true` once it has been deleted.
422
+ * @throws METHOD_NOT_PERMITTED when plugin writes are disabled. HANDLE_INVALID when
423
+ * there is no section with that id. PRECONDITION_FAILED when the project is view-only.
424
+ *
425
+ * @examplePrompt Delete Section B
426
+ *
427
+ * # Example
428
+ * ```ts
429
+ * await snaptrude.presentation.sections.delete(sectionId)
430
+ * ```
431
+ */
432
+ abstract delete(sectionId: string): PluginApiReturn<boolean>;
433
+ /**
434
+ * What a section cuts: every element its cutting plane passes through within
435
+ * the section's extents, with the cut's area, outline length and extent on
436
+ * the plane, largest first. Computed from the model, not from the drawing, so
437
+ * it needs no open view and works however the section is shown; furniture is
438
+ * left out, as in the drawing, and so is anything hidden in the model. Areas are exact for closed solids. Repeated
439
+ * calls reuse the cuts of elements that have not changed. Read-only.
440
+ *
441
+ * @param sectionId - The section's id
442
+ * @param options - Whether to return outline segments ({@linkcode PluginSectionCutOptions})
443
+ * @returns The {@linkcode PluginSectionCut}.
444
+ * @throws HANDLE_INVALID when there is no section with that id.
445
+ *
446
+ * @examplePrompt Which walls does Section A cut?
447
+ * @examplePrompt How thick is the slab where the section crosses it?
448
+ * @examplePrompt Does this section go through the stair?
449
+ * @examplePrompt What is the floor-to-floor height in this section?
450
+ *
451
+ * # Example
452
+ * ```ts
453
+ * const cut = await snaptrude.presentation.sections.getCut(sectionId)
454
+ * const walls = cut.elements.filter((element) => element.type === "wall")
455
+ * const thickest = walls[0]
456
+ * console.log(thickest.extent.uMax - thickest.extent.uMin)
457
+ * ```
458
+ */
459
+ abstract getCut(sectionId: string, options?: PluginSectionCutOptions): PluginApiReturn<PluginSectionCut>;
460
+ }
461
+ //# sourceMappingURL=sections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sections.d.ts","sourceRoot":"","sources":["../../../src/api/presentation/sections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAGlD,+DAA+D;AAC/D,eAAO,MAAM,kBAAkB;;;kBAEpB,CAAA;AACX,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;iBAcxB,CAAA;AACF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK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,EACjB,OAAO,CAAC,EAAE,uBAAuB,GAChC,eAAe,CAAC,gBAAgB,CAAC;CACrC"}
@@ -231,11 +231,11 @@ export declare const PluginPresentationShapeSpec: z.ZodDiscriminatedUnion<[z.Zod
231
231
  }, z.core.$strip>, z.ZodObject<{
232
232
  type: z.ZodLiteral<"geo">;
233
233
  kind: z.ZodEnum<{
234
+ hexagon: "hexagon";
234
235
  rectangle: "rectangle";
235
236
  ellipse: "ellipse";
236
237
  triangle: "triangle";
237
238
  diamond: "diamond";
238
- hexagon: "hexagon";
239
239
  oval: "oval";
240
240
  rhombus: "rhombus";
241
241
  star: "star";
@@ -386,11 +386,11 @@ export declare const PluginPresentationShapesUpsertArgs: z.ZodObject<{
386
386
  }, z.core.$strip>, z.ZodObject<{
387
387
  type: z.ZodLiteral<"geo">;
388
388
  kind: z.ZodEnum<{
389
+ hexagon: "hexagon";
389
390
  rectangle: "rectangle";
390
391
  ellipse: "ellipse";
391
392
  triangle: "triangle";
392
393
  diamond: "diamond";
393
- hexagon: "hexagon";
394
394
  oval: "oval";
395
395
  rhombus: "rhombus";
396
396
  star: "star";