@snaptrude/plugin-core 0.9.16 → 0.9.17

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @snaptrude/plugin-core
2
2
 
3
+ ## 0.9.17
4
+
5
+ ### Patch Changes
6
+
7
+ - d63e597: Add a `presentation.sections` namespace for section lines: `list`, `get`, `create` (from two plan points), `update`, `delete`, open or close a section view with `getActive` / `setActive`, and `getCut`, which reports every element a section's cutting plane passes through, with the cut's area, outline length and extent on the plane. Unknown-id reads return `null`; unknown-id writes and `getCut` throw `HANDLE_INVALID`.
8
+
3
9
  ## 0.9.16
4
10
 
5
11
  ### Patch Changes
package/api-manifest.json CHANGED
@@ -7823,6 +7823,99 @@
7823
7823
  "argsType": "string",
7824
7824
  "resultType": "PluginPlacedViewCategoryStyles"
7825
7825
  },
7826
+ {
7827
+ "path": "presentation.sections.create",
7828
+ "namespace": "presentation.sections",
7829
+ "summary": "Draw a section line from `start` to `end` on the plan. The section looks along the line's direction turned a quarter turn — a line drawn toward +x looks toward +z; flip it with `update(id, { isFlipped: true })`. Its slice defaults to the building's full height and its depth to the far side of the model. Write-gated; one undo step.",
7830
+ "examplePrompts": [
7831
+ "Cut a section through the middle of the building, east to west",
7832
+ "Add a section across the stair core",
7833
+ "Draw a longitudinal section and open it\n\n# Example\n```ts\nconst section = await snaptrude.presentation.sections.create(\n{ x: -40, z: 10 },\n{ x: 40, z: 10 },\n{ name: \"Longitudinal\", isActive: true },\n)\n```"
7834
+ ],
7835
+ "argsType": "PluginSectionPoint",
7836
+ "resultType": "PluginSection"
7837
+ },
7838
+ {
7839
+ "path": "presentation.sections.delete",
7840
+ "namespace": "presentation.sections",
7841
+ "summary": "Delete a section. Closes its view first if it is open. Write-gated; one undo step.",
7842
+ "examplePrompts": [
7843
+ "Delete Section B\n\n# Example\n```ts\nawait snaptrude.presentation.sections.delete(sectionId)\n```"
7844
+ ],
7845
+ "argsType": "string",
7846
+ "resultType": "boolean"
7847
+ },
7848
+ {
7849
+ "path": "presentation.sections.get",
7850
+ "namespace": "presentation.sections",
7851
+ "summary": "Get one section by id.",
7852
+ "examplePrompts": [
7853
+ "Where does Section A run?",
7854
+ "How deep is this section?\n\n# Example\n```ts\nconst section = await snaptrude.presentation.sections.get(sectionId)\nconsole.log(section?.start, section?.end)\n```"
7855
+ ],
7856
+ "argsType": "string",
7857
+ "resultType": "PluginSection | null"
7858
+ },
7859
+ {
7860
+ "path": "presentation.sections.getActive",
7861
+ "namespace": "presentation.sections",
7862
+ "summary": "Get the section whose view is open.",
7863
+ "examplePrompts": [
7864
+ "Which section am I looking at?\n\n# Example\n```ts\nconst open = await snaptrude.presentation.sections.getActive()\n```"
7865
+ ],
7866
+ "argsType": null,
7867
+ "resultType": "PluginSection | null"
7868
+ },
7869
+ {
7870
+ "path": "presentation.sections.getCut",
7871
+ "namespace": "presentation.sections",
7872
+ "summary": "What a section cuts: every element its cutting plane passes through within the section's extents, with the cut's area, outline length and extent on the plane, largest first. Computed from the model, not from the drawing, so it needs no open view and works however the section is shown; furniture is left out, as in the drawing. Areas are exact for closed solids. Repeated calls reuse the cuts of elements that have not changed. Read-only.",
7873
+ "examplePrompts": [
7874
+ "Which walls does Section A cut?",
7875
+ "How thick is the slab where the section crosses it?",
7876
+ "Does this section go through the stair?",
7877
+ "What is the floor-to-floor height in this section?\n\n# Example\n```ts\nconst cut = await snaptrude.presentation.sections.getCut(sectionId)\nconst walls = cut.elements.filter((element) => element.type === \"wall\")\nconst thickest = walls[0]\nconsole.log(thickest.extent.uMax - thickest.extent.uMin)\n```"
7878
+ ],
7879
+ "argsType": "string",
7880
+ "resultType": "PluginSectionCut"
7881
+ },
7882
+ {
7883
+ "path": "presentation.sections.list",
7884
+ "namespace": "presentation.sections",
7885
+ "summary": "List the project's sections, in Views panel order.",
7886
+ "examplePrompts": [
7887
+ "Which sections are there?",
7888
+ "List the section lines in this project",
7889
+ "Is there a section through the stair?\n\n# Example\n```ts\nconst sections = await snaptrude.presentation.sections.list()\n```"
7890
+ ],
7891
+ "argsType": null,
7892
+ "resultType": "PluginSection[]"
7893
+ },
7894
+ {
7895
+ "path": "presentation.sections.setActive",
7896
+ "namespace": "presentation.sections",
7897
+ "summary": "Open a section's view, or close the open one with `null`. Opening frames the section's saved camera, or a straight-on view when it has none. Not an edit: nothing is added to the undo history.",
7898
+ "examplePrompts": [
7899
+ "Open Section A",
7900
+ "Show me the section through the atrium",
7901
+ "Close the section view\n\n# Example\n```ts\nawait snaptrude.presentation.sections.setActive(section.sectionId)\nawait snaptrude.presentation.sections.setActive(null)\n```"
7902
+ ],
7903
+ "argsType": "string | null",
7904
+ "resultType": "PluginSection | null"
7905
+ },
7906
+ {
7907
+ "path": "presentation.sections.update",
7908
+ "namespace": "presentation.sections",
7909
+ "summary": "Change a section. Only the given fields change; the whole patch is one undo step. Write-gated.",
7910
+ "examplePrompts": [
7911
+ "Make Section A look the other way",
7912
+ "Only show the ground floor in this section",
7913
+ "Rename the section to \"Through atrium\"",
7914
+ "Move the section line 5 m north\n\n# Example\n```ts\nawait snaptrude.presentation.sections.update(sectionId, {\nisFlipped: true,\ndepth: 60,\n})\n```"
7915
+ ],
7916
+ "argsType": "string",
7917
+ "resultType": "PluginSection"
7918
+ },
7826
7919
  {
7827
7920
  "path": "presentation.shapes.list",
7828
7921
  "namespace": "presentation.shapes",
@@ -11,6 +11,7 @@ import { PluginPresentationTablesApi } from "./tables";
11
11
  import { PluginPresentationSlideshowApi } from "./slideshow";
12
12
  import { PluginPresentationImportApi } from "./import";
13
13
  import { PluginPresentationWalkthroughsApi } from "./walkthroughs";
14
+ import { PluginPresentationSectionsApi } from "./sections";
14
15
  import { PluginPresentationExportResult, type PluginPresentationExportFormat, type PluginPresentationExportResolution } from "./export";
15
16
  /**
16
17
  * Presentation APIs — prepare and assemble presentations.
@@ -32,6 +33,7 @@ import { PluginPresentationExportResult, type PluginPresentationExportFormat, ty
32
33
  * - {@linkcode PluginPresentationApi.import} — Import reference images/PDFs onto the canvas
33
34
  * - {@linkcode PluginPresentationApi.aiInspiration} — Present-mode AI image/video generation
34
35
  * - {@linkcode PluginPresentationApi.walkthroughs} — Camera paths through the model: create, play, capture, export as video
36
+ * - {@linkcode PluginPresentationApi.sections} — Section lines: create, edit, open their views, and read what each cuts
35
37
  *
36
38
  * Accessed via `snaptrude.presentation`.
37
39
  */
@@ -67,6 +69,12 @@ export declare abstract class PluginPresentationApi {
67
69
  * Present canvas. See {@linkcode PluginPresentationWalkthroughsApi}.
68
70
  */
69
71
  abstract walkthroughs: PluginPresentationWalkthroughsApi;
72
+ /**
73
+ * Sections — lines on the plan that cut the model: create, edit and delete
74
+ * them, open their views, and read what each one cuts (`getCut`). See
75
+ * {@linkcode PluginPresentationSectionsApi}.
76
+ */
77
+ abstract sections: PluginPresentationSectionsApi;
70
78
  /**
71
79
  * Export the presentation's layout sheets to a downloadable file (PDF / PNG /
72
80
  * JPG) and return the encoded bytes as base64. Wraps the Present-mode Export
@@ -112,5 +120,6 @@ export * from "./slideshow";
112
120
  export * from "./import";
113
121
  export * from "./aiInspiration";
114
122
  export * from "./walkthroughs";
123
+ export * from "./sections";
115
124
  export * from "./export";
116
125
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/presentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,kCAAkC,EAAE,MAAM,iBAAiB,CAAA;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,EAAE,6BAA6B,EAAE,MAAM,YA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C,8BAA8B,CAAC;;CAGnD;AAED,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA"}
@@ -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,CAAC,OAAO,aAAa,CAAC,CAAA;AAEzD,eAAO,MAAM,mBAAmB;;kBAErB,CAAA;AACX,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAErE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;kBAU5B,CAAA;AACX,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,0BAA0B,CAClC,CAAA;AAED,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;kBAMzB,CAAA;AACX,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE7E;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;kBAYpB,CAAA;AACX,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEnE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;kBA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