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