@snaptrude/plugin-core 0.9.16 → 0.9.18-networks-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 (215) hide show
  1. package/AGENTS.md +231 -231
  2. package/CHANGELOG.md +408 -402
  3. package/CLAUDE.md +11 -11
  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 +1763 -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 +3788 -2328
  71. package/dist/index.cjs.map +1 -1
  72. package/dist/index.js +3650 -2328
  73. package/dist/index.js.map +1 -1
  74. package/package.json +42 -42
  75. package/scripts/check-dist-fresh.mjs +22 -22
  76. package/scripts/generate-manifest.mjs +243 -238
  77. package/scripts/generate-manifest.test.mjs +303 -303
  78. package/src/api/analysis/daylight.ts +470 -470
  79. package/src/api/analysis/heatmaps.ts +683 -683
  80. package/src/api/analysis/illuminance.ts +155 -155
  81. package/src/api/analysis/index.ts +61 -61
  82. package/src/api/analysis/shadows.ts +183 -183
  83. package/src/api/analysis/solar.ts +237 -237
  84. package/src/api/analysis/sunlightHours.ts +211 -211
  85. package/src/api/analysis/sunpath.ts +83 -83
  86. package/src/api/analysis/weather.ts +179 -179
  87. package/src/api/core/buildings.ts +485 -485
  88. package/src/api/core/camera/index.ts +696 -667
  89. package/src/api/core/comment/index.ts +376 -376
  90. package/src/api/core/geom/create/index.ts +2139 -2133
  91. package/src/api/core/geom/delete/index.ts +84 -84
  92. package/src/api/core/geom/index.ts +35 -35
  93. package/src/api/core/geom/query/arc.ts +169 -169
  94. package/src/api/core/geom/query/brep.ts +621 -621
  95. package/src/api/core/geom/query/circle.ts +404 -404
  96. package/src/api/core/geom/query/contour.ts +540 -540
  97. package/src/api/core/geom/query/curve.ts +1102 -1102
  98. package/src/api/core/geom/query/edge.ts +130 -130
  99. package/src/api/core/geom/query/face.ts +508 -508
  100. package/src/api/core/geom/query/halfedge.ts +210 -210
  101. package/src/api/core/geom/query/index.ts +63 -63
  102. package/src/api/core/geom/query/profile.ts +473 -473
  103. package/src/api/core/geom/query/vertex.ts +205 -205
  104. package/src/api/core/geom/update/contour.ts +323 -317
  105. package/src/api/core/geom/update/curve.ts +209 -209
  106. package/src/api/core/geom/update/index.ts +29 -29
  107. package/src/api/core/geom/update/profile.ts +379 -379
  108. package/src/api/core/groups.ts +521 -521
  109. package/src/api/core/handles/index.ts +234 -234
  110. package/src/api/core/history/index.ts +84 -84
  111. package/src/api/core/index.ts +99 -99
  112. package/src/api/core/io/export/index.ts +126 -126
  113. package/src/api/core/io/import/index.ts +504 -504
  114. package/src/api/core/io/index.ts +42 -42
  115. package/src/api/core/io/job/index.ts +140 -140
  116. package/src/api/core/io/query/index.ts +71 -71
  117. package/src/api/core/io/terrain/index.ts +360 -360
  118. package/src/api/core/io/underlay/index.ts +705 -705
  119. package/src/api/core/layers.ts +540 -540
  120. package/src/api/core/math/index.ts +20 -20
  121. package/src/api/core/math/quat.ts +172 -172
  122. package/src/api/core/math/vec3.ts +179 -179
  123. package/src/api/core/mode/index.ts +108 -108
  124. package/src/api/core/project/index.ts +479 -479
  125. package/src/api/core/proposals/index.ts +570 -570
  126. package/src/api/core/storeys/index.ts +308 -308
  127. package/src/api/core/storeys/layers.ts +339 -339
  128. package/src/api/core/tags.ts +911 -911
  129. package/src/api/core/units/index.ts +164 -164
  130. package/src/api/core/user.ts +46 -46
  131. package/src/api/core/zoom/index.ts +64 -51
  132. package/src/api/design/bim.ts +121 -0
  133. package/src/api/design/boolean/index.ts +181 -179
  134. package/src/api/design/catalog.ts +203 -0
  135. package/src/api/design/create/bulk-items.ts +294 -254
  136. package/src/api/design/create/grids.ts +137 -137
  137. package/src/api/design/create/index.ts +2148 -1980
  138. package/src/api/design/create/opening-fields.ts +40 -37
  139. package/src/api/design/delete/index.ts +75 -74
  140. package/src/api/design/dimensions.ts +453 -453
  141. package/src/api/design/doors/index.ts +516 -500
  142. package/src/api/design/edit/index.ts +54 -54
  143. package/src/api/design/erase/index.ts +151 -151
  144. package/src/api/design/family.ts +1334 -704
  145. package/src/api/design/furniture/index.ts +319 -319
  146. package/src/api/design/grids.ts +237 -237
  147. package/src/api/design/index.ts +304 -274
  148. package/src/api/design/lock.ts +69 -69
  149. package/src/api/design/materials/index.ts +608 -608
  150. package/src/api/design/networks.ts +667 -0
  151. package/src/api/design/query/geometry/index.ts +319 -319
  152. package/src/api/design/query/grids.ts +197 -197
  153. package/src/api/design/query/index.ts +1236 -1226
  154. package/src/api/design/query/referenceLines.ts +52 -52
  155. package/src/api/design/query/spaces.ts +275 -275
  156. package/src/api/design/selection/index.ts +273 -273
  157. package/src/api/design/shared.ts +40 -40
  158. package/src/api/design/transform/index.ts +254 -254
  159. package/src/api/design/types/index.ts +163 -156
  160. package/src/api/design/update/index.ts +1024 -983
  161. package/src/api/design/visibility.ts +143 -143
  162. package/src/api/design/windows/index.ts +351 -333
  163. package/src/api/entity/buildableEnvelope.ts +322 -322
  164. package/src/api/entity/index.ts +30 -30
  165. package/src/api/entity/referenceLine.ts +235 -235
  166. package/src/api/entity/space.ts +612 -612
  167. package/src/api/entity/story.ts +517 -517
  168. package/src/api/index.ts +47 -47
  169. package/src/api/presentation/aiInspiration.ts +1116 -1116
  170. package/src/api/presentation/annotate.ts +417 -385
  171. package/src/api/presentation/camera.ts +289 -289
  172. package/src/api/presentation/diagrams.ts +194 -194
  173. package/src/api/presentation/drawingContract.ts +70 -0
  174. package/src/api/presentation/drawings.ts +1179 -0
  175. package/src/api/presentation/export.ts +134 -108
  176. package/src/api/presentation/import.ts +159 -159
  177. package/src/api/presentation/index.ts +160 -126
  178. package/src/api/presentation/placedViews.ts +1211 -1120
  179. package/src/api/presentation/sections.ts +420 -0
  180. package/src/api/presentation/shapes.ts +274 -274
  181. package/src/api/presentation/sheets.ts +746 -585
  182. package/src/api/presentation/slideshow.ts +134 -134
  183. package/src/api/presentation/tables.ts +84 -84
  184. package/src/api/presentation/viewPresets.ts +241 -0
  185. package/src/api/presentation/views.ts +713 -673
  186. package/src/api/presentation/walkthroughs.ts +1201 -1201
  187. package/src/api/program/adjacency.ts +164 -164
  188. package/src/api/program/areas.ts +408 -408
  189. package/src/api/program/classification.ts +138 -138
  190. package/src/api/program/cores.ts +83 -83
  191. package/src/api/program/departments.ts +517 -517
  192. package/src/api/program/index.ts +73 -73
  193. package/src/api/program/labels.ts +332 -332
  194. package/src/api/program/layout.ts +422 -422
  195. package/src/api/program/metadata.ts +364 -364
  196. package/src/api/program/metrics.ts +120 -120
  197. package/src/api/program/site.ts +748 -748
  198. package/src/api/program/spreadsheet.ts +2698 -2698
  199. package/src/api/workspace/index.ts +612 -612
  200. package/src/errors/codes.ts +143 -136
  201. package/src/errors/envelope.ts +75 -75
  202. package/src/errors/index.ts +21 -21
  203. package/src/errors/plugin-error.ts +134 -134
  204. package/src/handles.ts +297 -297
  205. package/src/host-utils.ts +67 -67
  206. package/src/index.ts +7 -7
  207. package/src/massParameters.ops.ts +246 -246
  208. package/src/massParameters.ts +427 -427
  209. package/src/types.ts +16 -16
  210. package/test/drawingContract.test.mjs +288 -0
  211. package/test/errors.test.mjs +185 -184
  212. package/test/massParameters.test.mjs +952 -952
  213. package/tsconfig.json +22 -22
  214. package/tsup.config.ts +12 -12
  215. package/api-manifest.json +0 -9618
@@ -1,1980 +1,2148 @@
1
- import * as z from "zod"
2
- import { PluginApiReturn } from "../../../types"
3
- import {
4
- BrepHandle,
5
- ComponentHandle,
6
- ContourHandle,
7
- CurveHandle,
8
- ProfileHandle,
9
- Vec3Handle,
10
- } from "../../../handles"
11
- import { PluginGridStyleOptions } from "./grids"
12
- import {
13
- PluginSpaceType,
14
- PluginMassType,
15
- PluginDepartmentId,
16
- } from "../../entity/space"
17
- import {
18
- PluginBuildableEnvelopePolygonVertex,
19
- PluginBuildableEnvelopeSetbackTier,
20
- PluginBuildableEnvelopeVerticalCap,
21
- PluginBuildableEnvelopeCreateResult,
22
- } from "../../entity/buildableEnvelope"
23
- import { PluginOpeningBaseOptions } from "./opening-fields"
24
- import type {
25
- PluginCreateDoorItem,
26
- PluginCreateFloorItem,
27
- PluginCreateFurnitureItem,
28
- PluginCreateWallRunItem,
29
- PluginCreateWindowItem,
30
- } from "./bulk-items"
31
- import { PluginWallTopProfile } from "./bulk-items"
32
-
33
- /**
34
- * `design.create.*` — author new scene-committed BIM entities.
35
- *
36
- * Every creator takes geometry handles + scalars and returns a
37
- * {@linkcode ComponentHandle} (or `ComponentHandle[]` for plural creators;
38
- * `wallRuns` returns one `ComponentHandle[]` per run) — the
39
- * `Component.id` of the created entity, resolvable across the rest of the
40
- * `design.*` surface. Creation is an undoable host call; it **throws** on failure
41
- * (no `Result` wrapper — consistent with `core.geom.create.*`).
42
- *
43
- * Footprint objects take a {@linkcode ContourHandle} (outer profile + holes);
44
- * build one with `snaptrude.core.geom.create.contourFromProfile(s)`.
45
- *
46
- * `door`/`window` place a catalog item into a host wall (the world point is
47
- * projected onto the wall face to locate the opening; the wall is re-cut in one
48
- * undo entry) and throw if the point projects outside the wall. `smartLayout` is
49
- * the one creator returning a grouped {@linkcode PluginSmartLayoutResult} rather
50
- * than a handle — it clones an in-scene template into one or more target spaces,
51
- * merging every target into a single undo batch (see its JSDoc).
52
- *
53
- * Accessed via `snaptrude.design.create`.
54
- */
55
- export abstract class PluginDesignCreateApi {
56
- constructor() {}
57
-
58
- /**
59
- * Create a **space** (a room / mass) by extruding a footprint contour upward.
60
- *
61
- * The `contour` is the bottom footprint (outer profile + optional holes); it
62
- * is extruded by `height` along +Y. The space is placed on the active story
63
- * and assigned a default department unless overridden.
64
- *
65
- * @param contour - Bottom footprint (outer + holes)
66
- * @param height - Extrusion height (Snaptrude units, > 0)
67
- * @param label - Room label (maps to the space's `room_type`)
68
- * @param position - Offset from origin (default origin)
69
- * @param spaceType - Space-type classification (default `Room`)
70
- * @param massType - Mass-type classification (default `Room`)
71
- * @param departmentId - Department assignment (default department)
72
- * @param storey - Target storey number to place the space on — the same integer
73
- * `entity.story` uses (`1` ground, `2` first floor, `-1` basement). Default:
74
- * the active storey. Folds a `core.storeys.setActive` call into the create,
75
- * placing the space at that storey's floor elevation (any `position` offset is
76
- * applied on top). Throws if no storey has that value.
77
- * @returns the {@linkcode ComponentHandle} of the created space
78
- * @throws if the contour is invalid, the height is not positive, or the target
79
- * storey does not exist
80
- *
81
- * @examplePrompt Create a room called Living Room that's 3m tall from this outline
82
- * @examplePrompt Add a new space on the current storey using this footprint
83
- * @examplePrompt Make a bedroom here and assign it to the Residential department
84
- * @examplePrompt Extrude this closed outline into a 10 foot high room
85
- * @examplePrompt Can you create a Kitchen space from the sketch I just drew?
86
- * @examplePrompt Create a bedroom on the second floor from this outline
87
- *
88
- * @performance For MORE THAN ONE space, call `design.create.spaces(items[])` — the whole
89
- * batch is one host round-trip. Looping this single-space creator is N round-trips (slow,
90
- * and a large loop can trip the plugin rate limit).
91
- *
92
- * # Example
93
- * ```ts
94
- * const v = snaptrude.core.math.vec3
95
- * const outer = await snaptrude.core.geom.create.profileFromLinePoints([
96
- * await v.new(0, 0, 0),
97
- * await v.new(10, 0, 0),
98
- * await v.new(10, 0, 8),
99
- * await v.new(0, 0, 8),
100
- * ])
101
- * const contour = await snaptrude.core.geom.create.contourFromProfile(outer)
102
- * const space = await snaptrude.design.create.space(contour, 3, "Living")
103
- * // …place one directly on the second floor (no setActive dance):
104
- * const upstairs = await snaptrude.design.create.space(
105
- * contour, 3, "Bedroom", undefined, undefined, undefined, undefined, 2,
106
- * )
107
- * ```
108
- */
109
- public abstract space(
110
- contour: ContourHandle,
111
- height: number,
112
- label?: string,
113
- position?: Vec3Handle,
114
- spaceType?: PluginSpaceType,
115
- massType?: PluginMassType,
116
- departmentId?: PluginDepartmentId,
117
- storey?: number,
118
- ): PluginApiReturn<ComponentHandle>
119
-
120
- /**
121
- * Create a **mass** — a generic extruded prism (default `massType` "Generic mass").
122
- * Same footprint-extrude path as {@linkcode PluginDesignCreateApi.space}.
123
- *
124
- * @param contour - Footprint (outer + holes)
125
- * @param height - Extrusion height (> 0)
126
- * @param label - Label (maps to `room_type`)
127
- * @param position - Offset from origin
128
- * @param massType - Mass type (default `Generic mass`)
129
- * @returns the {@linkcode ComponentHandle} of the created mass
130
- * @throws if the contour is invalid or the height is not positive
131
- *
132
- * @examplePrompt Create a generic mass 30m tall from this footprint
133
- * @examplePrompt Block out a conceptual massing volume for the site
134
- * @examplePrompt Extrude this shape into a building mass
135
- * @examplePrompt Add a simple study-model volume at the origin
136
- *
137
- * # Example
138
- * ```ts
139
- * const rect = await snaptrude.core.geom.create.profileRect(20, 15)
140
- * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
141
- * const tower = await snaptrude.design.create.mass(contour, 30, "Tower A", undefined, "Building")
142
- * ```
143
- */
144
- public abstract mass(
145
- contour: ContourHandle,
146
- height: number,
147
- label?: string,
148
- position?: Vec3Handle,
149
- massType?: PluginMassType,
150
- ): PluginApiReturn<ComponentHandle>
151
-
152
- /**
153
- * Create a **mass** from a custom solid built with a `core.geom.create` brep
154
- * constructor (`brepFromFaces`, `brepFromExtrusion`, `brepFromLoft`,
155
- * `brepFromMesh`, or a brep boolean) — the free-form counterpart of
156
- * {@linkcode PluginDesignCreateApi.mass}, for solids that are not simple
157
- * footprint extrusions (pyramids, wedges, faceted volumes).
158
- *
159
- * Only accepts breps **minted by a `core.geom.create` brep constructor** —
160
- * scene-derived breps from `design.query.geometry.getBrep` are read-only and
161
- * throw. The mass is created as a generic mass (`massType` "Generic mass") at
162
- * the exact coordinates the solid was authored in, committed as a single
163
- * undo step, and synced to collaborators like any other creator.
164
- *
165
- * @param brep - A solid from a `core.geom.create` brep constructor
166
- * @param label - Label (maps to `room_type`)
167
- * @returns the {@linkcode ComponentHandle} of the created mass
168
- * @throws if the brep handle is invalid, or the brep was not created by a
169
- * `core.geom.create` brep constructor
170
- *
171
- * @examplePrompt Create a mass from these faces
172
- * @examplePrompt Turn this custom brep into a scene mass
173
- * @examplePrompt Add a pyramid-shaped mass to the model
174
- *
175
- * # Example
176
- * ```ts
177
- * const apex = { x: 0, y: 4, z: 0 }
178
- * const a = { x: -2, y: 0, z: -2 }
179
- * const b = { x: 2, y: 0, z: -2 }
180
- * const c = { x: 2, y: 0, z: 2 }
181
- * const d = { x: -2, y: 0, z: 2 }
182
- * const brep = await snaptrude.core.geom.create.brepFromFaces([
183
- * [a, d, c, b],
184
- * [a, b, apex],
185
- * [b, c, apex],
186
- * [c, d, apex],
187
- * [d, a, apex],
188
- * ])
189
- * const pyramid = await snaptrude.design.create.massFromBrep(brep, "Pavilion")
190
- * ```
191
- */
192
- public abstract massFromBrep(
193
- brep: BrepHandle,
194
- label?: string,
195
- ): PluginApiReturn<ComponentHandle>
196
-
197
- /**
198
- * Create a **slab** by extruding a footprint contour by `thickness`
199
- * (default direction: down).
200
- *
201
- * @param contour - Footprint (outer + holes)
202
- * @param thickness - Slab thickness (> 0)
203
- * @param direction - Extrusion direction (default `"down"`)
204
- * @param slabType - Slab-type classification
205
- * @returns the {@linkcode ComponentHandle} of the created slab
206
- * @throws if the contour is invalid or the thickness is not positive
207
- *
208
- * @examplePrompt Add a 150mm thick slab under this footprint
209
- * @examplePrompt Create a floor slab from this outline
210
- * @examplePrompt Pour a plinth slab over the building footprint
211
- * @examplePrompt Make a basement slab that extrudes downward
212
- * @examplePrompt Give this room outline a 6 inch slab
213
- *
214
- * # Example
215
- * ```ts
216
- * const rect = await snaptrude.core.geom.create.profileRect(12, 10)
217
- * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
218
- * const slab = await snaptrude.design.create.slab(contour, 0.15, "down", "Plinth")
219
- * ```
220
- */
221
- public abstract slab(
222
- contour: ContourHandle,
223
- thickness: number,
224
- direction?: "up" | "down",
225
- slabType?: PluginSlabType,
226
- ): PluginApiReturn<ComponentHandle>
227
-
228
- /**
229
- * Create a **floor** by extruding a footprint contour by `thickness`
230
- * (extruded upward).
231
- *
232
- * @param contour - Footprint (outer + holes)
233
- * @param thickness - Floor thickness (> 0)
234
- * @param position - Offset from origin
235
- * @returns the {@linkcode ComponentHandle} of the created floor
236
- * @throws if the contour is invalid or the thickness is not positive
237
- *
238
- * @examplePrompt Create a floor from this room outline
239
- * @examplePrompt Add a 100mm thick floor over the footprint
240
- * @examplePrompt Lay flooring across the selected outline
241
- * @examplePrompt Put a floor at this position with 150mm thickness
242
- *
243
- * # Example
244
- * ```ts
245
- * const rect = await snaptrude.core.geom.create.profileRect(5, 4)
246
- * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
247
- * const floor = await snaptrude.design.create.floor(contour, 0.1)
248
- * ```
249
- *
250
- * @performance For MORE THAN ONE floor, call `design.create.floors(items[])` — one
251
- * host round-trip and ONE undo entry for the whole batch. Looping this single-floor
252
- * creator is N round-trips and N undo entries.
253
- */
254
- public abstract floor(
255
- contour: ContourHandle,
256
- thickness: number,
257
- position?: Vec3Handle,
258
- ): PluginApiReturn<ComponentHandle>
259
-
260
- /**
261
- * Create **many floors** in one undoable operation (bulk plural of
262
- * {@linkcode floor}). Each item extrudes its own footprint contour (outer
263
- * profile + holes) upward by its own `thickness`, at its own optional
264
- * position offset. Validate-all-or-throw; one command.
265
- *
266
- * @param items - One {@linkcode PluginCreateFloorItem} per floor to create
267
- * (≥1, ≤1000)
268
- * @returns the created floors as {@linkcode ComponentHandle}`[]`, in input order
269
- * @throws `VALIDATION` if the items fail the schema (empty array, more than
270
- * 1000 items, a non-positive thickness) or a contour is degenerate;
271
- * `HANDLE_INVALID` if a `contour` or `position` handle is unknown or
272
- * released; `OPERATION_FAILED` if extrusion fails (nothing is created —
273
- * `details.itemIndex` is the failing item); `METHOD_NOT_PERMITTED` if the
274
- * plugin may not write.
275
- *
276
- * @examplePrompt Create floors for all these room outlines at once
277
- * @examplePrompt Add a floor to every space in one operation
278
- * @examplePrompt Bulk create the floor plates for this building
279
- * @examplePrompt Lay 100mm floors across these five footprints in one undo step
280
- * @examplePrompt Create the ground and first floor slabs together
281
- *
282
- * @performance Bulk creator — the whole batch is ONE host round-trip and ONE undo
283
- * entry. Always prefer this over calling `design.create.floor` in a loop: build the
284
- * full `items[]` array first (all contours and offsets up front), then make one call.
285
- *
286
- * # Example
287
- * ```ts
288
- * const rect = await snaptrude.core.geom.create.profileRect(5, 4)
289
- * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
290
- * const [ground, upper] = await snaptrude.design.create.floors([
291
- * { contour, thickness: 0.1 },
292
- * { contour, thickness: 0.1, position: await snaptrude.core.math.vec3.new(0, 3, 0) },
293
- * ])
294
- * ```
295
- */
296
- public abstract floors(
297
- items: PluginCreateFloorItem[],
298
- ): PluginApiReturn<ComponentHandle[]>
299
-
300
- /**
301
- * Create a **roof** by extruding a footprint contour by `thickness`. Created
302
- * flat (extruded downward); pitch/slope is a separate post-creation edit.
303
- *
304
- * @param contour - Footprint (outer + holes)
305
- * @param thickness - Roof-slab thickness (> 0)
306
- * @returns the {@linkcode ComponentHandle} of the created roof
307
- * @throws if the contour is invalid or the thickness is not positive
308
- *
309
- * @examplePrompt Add a flat roof over the building footprint
310
- * @examplePrompt Create a roof 200mm thick from this outline
311
- * @examplePrompt Cover the top storey with a roof slab
312
- * @examplePrompt Put a roof on this building
313
- *
314
- * # Example
315
- * ```ts
316
- * const rect = await snaptrude.core.geom.create.profileRect(12, 10)
317
- * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
318
- * const roof = await snaptrude.design.create.roof(contour, 0.2)
319
- * ```
320
- */
321
- public abstract roof(
322
- contour: ContourHandle,
323
- thickness: number,
324
- ): PluginApiReturn<ComponentHandle>
325
-
326
- /**
327
- * Create a **ceiling** by extruding a footprint contour by `thickness`, lifted
328
- * `heightFromFloor` above the floor.
329
- *
330
- * @param contour - Footprint (outer + holes)
331
- * @param thickness - Ceiling thickness (> 0)
332
- * @param heightFromFloor - Lift above the floor (default 0)
333
- * @returns the {@linkcode ComponentHandle} of the created ceiling
334
- * @throws if the contour is invalid or the thickness is not positive
335
- *
336
- * @examplePrompt Add a false ceiling 2.7m above the floor
337
- * @examplePrompt Create a ceiling over this room footprint
338
- * @examplePrompt Put a dropped ceiling in the living room at 3 metres
339
- * @examplePrompt Add a 50mm thick ceiling lifted 2800mm from floor level
340
- *
341
- * # Example
342
- * ```ts
343
- * const rect = await snaptrude.core.geom.create.profileRect(5, 4)
344
- * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
345
- * const ceiling = await snaptrude.design.create.ceiling(contour, 0.05, 2.8)
346
- * ```
347
- */
348
- public abstract ceiling(
349
- contour: ContourHandle,
350
- thickness: number,
351
- heightFromFloor?: number,
352
- ): PluginApiReturn<ComponentHandle>
353
-
354
- /**
355
- * Create a **column** by extruding a cross-section contour upward by `height`
356
- * from a base `position`. The column is built to EXACTLY `height` — unlike
357
- * the interactive draw tool, no slab-thickness deduction is applied.
358
- *
359
- * @param position - Base point
360
- * @param crossSection - Column cross-section footprint
361
- * @param height - Column height (> 0), built exactly
362
- * @param directionUp - Up axis (default world up); normalized by the host, so
363
- * magnitude does not scale the height
364
- * @returns the {@linkcode ComponentHandle} of the created column
365
- * @throws if the cross-section is invalid, the height is not positive, or the
366
- * direction is zero / lies in the cross-section plane (degenerate extrusion)
367
- *
368
- * @examplePrompt Add a 3m tall column at this point
369
- * @examplePrompt Place a column at the grid intersection
370
- * @examplePrompt Create a 450mm square concrete column 4 metres high
371
- * @examplePrompt Stand a column up from this base point
372
- *
373
- * # Example
374
- * ```ts
375
- * const rect = await snaptrude.core.geom.create.profileRect(0.45, 0.45)
376
- * const crossSection = await snaptrude.core.geom.create.contourFromProfile(rect)
377
- * const base = await snaptrude.core.math.vec3.new(4, 0, 4)
378
- * const column = await snaptrude.design.create.column(base, crossSection, 3)
379
- * ```
380
- */
381
- public abstract column(
382
- position: Vec3Handle,
383
- crossSection: ContourHandle,
384
- height: number,
385
- directionUp?: Vec3Handle,
386
- ): PluginApiReturn<ComponentHandle>
387
-
388
- /**
389
- * Create a **beam** by extruding a cross-section contour along `direction` by
390
- * `length`. Matches the Snaptrude beam tool's semantics: the beam body hangs
391
- * BELOW the plane the section is authored on.
392
- *
393
- * For a **horizontal** `direction` (the common spanning beam), author the
394
- * section as an axis-aligned plan rectangle: its X extent is the beam's
395
- * width, its Z extent is the beam's depth (the vertical drop). The beam runs
396
- * `length` along `direction` starting at the section's centre, hanging below
397
- * the authoring plane by its depth — exactly like an interactively drawn
398
- * beam. Only axis-aligned rectangular sections are supported horizontally.
399
- *
400
- * For a **vertical** `direction` (the default), the section itself is
401
- * extruded by `length`, again hanging below the authoring plane. Diagonal
402
- * directions are rejected.
403
- *
404
- * @param section - Beam cross-section, an axis-aligned rectangle in plan
405
- * (X extent = width, Z extent = depth)
406
- * @param length - Beam length along `direction` (> 0); direction is
407
- * normalized by the host, so magnitude does not scale the length
408
- * @param direction - Beam axis: horizontal for a spanning beam, or vertical
409
- * (default world up). Diagonal directions throw.
410
- * @returns the {@linkcode ComponentHandle} of the created beam
411
- * @throws if the section is invalid (horizontal beams: not an axis-aligned
412
- * plan rectangle), the length is not positive, or the direction is zero or
413
- * diagonal
414
- *
415
- * @examplePrompt Add a beam spanning 6 metres between the columns
416
- * @examplePrompt Create a horizontal beam along the X axis
417
- * @examplePrompt Run a 300x600 beam across the room
418
- * @examplePrompt Extrude this cross-section into a 5m long beam
419
- *
420
- * # Example
421
- * ```ts
422
- * const rect = await snaptrude.core.geom.create.profileRect(0.3, 0.6)
423
- * const section = await snaptrude.core.geom.create.contourFromProfile(rect)
424
- * const alongX = await snaptrude.core.math.vec3.new(1, 0, 0)
425
- * const beam = await snaptrude.design.create.beam(section, 6, alongX)
426
- * ```
427
- */
428
- public abstract beam(
429
- section: ContourHandle,
430
- length: number,
431
- direction?: Vec3Handle,
432
- ): PluginApiReturn<ComponentHandle>
433
-
434
- /**
435
- * Create a connected run of **walls** from a profile — one wall per curve in
436
- * the profile's chain, with mitred corners at shared endpoints.
437
- *
438
- * @param profile - Ordered curve chain (wall centerlines)
439
- * @param height - Wall height (default engine default)
440
- * @param thickness - Wall thickness (default: the `wallType`'s total layer
441
- * thickness when `wallType` is given, else the engine default)
442
- * @param wallType - Wall type to build with — the same searchable list the
443
- * Draw tab's Wall Type dropdown offers. Pass a name from
444
- * `design.types.list("wall")` (the summary's `label`, or its `"wall:…"` id).
445
- * Drives the wall's construction layers and default material, and — when
446
- * `thickness` is omitted — its total layer thickness. Default: the engine's
447
- * generic wall.
448
- * @param storey - Target storey (integer: `1` ground, `2` first floor, `-1`
449
- * basement — same convention as `design.create.space`). The walls are
450
- * assigned to it and lifted to its base elevation, all inside the same
451
- * single undo entry. The storey must already exist
452
- * (`core.storeys.create` first). Default: geometry-derived — a profile
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}).
458
- * @returns a {@linkcode ComponentHandle}`[]` (one per wall), in profile order
459
- * @throws if the profile is empty, `wallType` names no wall type in the
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
463
- *
464
- * @examplePrompt Draw walls along this centerline
465
- * @examplePrompt Create 3m high, 200mm thick walls from these points
466
- * @examplePrompt Build a wall run around the room outline
467
- * @examplePrompt Turn this polyline sketch into walls
468
- * @examplePrompt Add walls with mitred corners along the path
469
- * @examplePrompt Draw brick walls with plaster along this outline
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
474
- *
475
- * # Example
476
- * ```ts
477
- * const v = snaptrude.core.math.vec3
478
- * const centerlines = await snaptrude.core.geom.create.profileFromLinePoints([
479
- * await v.new(0, 0, 0),
480
- * await v.new(8, 0, 0),
481
- * await v.new(8, 0, 6),
482
- * ])
483
- * const walls = await snaptrude.design.create.walls(centerlines, 3, 0.2)
484
- * // …built as a specific wall type (layers/material/thickness from the type):
485
- * const [brick] = await snaptrude.design.types.list("wall")
486
- * const brickWalls = await snaptrude.design.create.walls(
487
- * centerlines, 3, undefined, brick.label,
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
- * ])
496
- * ```
497
- *
498
- * @performance For MORE THAN ONE run, call `design.create.wallRuns(items[])` — one
499
- * host round-trip and ONE undo entry for every run in the batch. Looping this
500
- * single-run creator is N round-trips and N undo entries.
501
- */
502
- public abstract walls(
503
- profile: ProfileHandle,
504
- height?: number,
505
- thickness?: number,
506
- wallType?: string,
507
- storey?: number,
508
- topProfiles?: (PluginWallTopProfile | null)[],
509
- ): PluginApiReturn<ComponentHandle[]>
510
-
511
- /**
512
- * Create **many wall runs** in one undoable operation (bulk plural of
513
- * {@linkcode walls}). Each item is one full run — a wall per curve in that
514
- * item's profile chain, mitred at shared endpoints. Junctions resolve within a
515
- * run, not between runs. Each item carries its own
516
- * dimensions, `wallType` and `storey`, so a single call can build a whole
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.
520
- *
521
- * @param items - One {@linkcode PluginCreateWallRunItem} per run to create
522
- * (≥1, ≤1000)
523
- * @returns one {@linkcode ComponentHandle}`[]` per item, in input order —
524
- * each inner array holding that run's walls in profile-curve order
525
- * @throws `VALIDATION` if the items fail the schema (empty array, more than
526
- * 1000 items, a non-positive height or thickness, a zero-length curve);
527
- * `HANDLE_INVALID` if a `profile` handle is unknown or released;
528
- * `PRECONDITION_FAILED` if a profile has no curves, `wallType` names no
529
- * wall type in the project, or `storey` does not exist;
530
- * `OPERATION_FAILED` if wall creation fails (nothing is created —
531
- * `details.itemIndex` is the failing item); `METHOD_NOT_PERMITTED` if the
532
- * plugin may not write.
533
- *
534
- * @examplePrompt Draw all the walls of this floor plan at once
535
- * @examplePrompt Build every room's perimeter in one operation
536
- * @examplePrompt Bulk create wall runs from these centerlines
537
- * @examplePrompt Create the walls for both storeys in a single undo step
538
- * @examplePrompt Turn these polylines into 200mm brick walls together
539
- * @examplePrompt Import these raked walls with their top profiles in one go
540
- *
541
- * @performance Bulk creator — the whole batch is ONE host round-trip and ONE undo
542
- * entry. Always prefer this over calling `design.create.walls` in a loop: build the
543
- * full `items[]` array first (all profiles up front), then make one call.
544
- *
545
- * # Example
546
- * ```ts
547
- * const v = snaptrude.core.math.vec3
548
- * const ground = await snaptrude.core.geom.create.profileFromLinePoints([
549
- * await v.new(0, 0, 0),
550
- * await v.new(8, 0, 0),
551
- * await v.new(8, 0, 6),
552
- * ])
553
- * const upper = await snaptrude.core.geom.create.profileFromLinePoints([
554
- * await v.new(0, 0, 0),
555
- * await v.new(8, 0, 0),
556
- * ])
557
- * const [groundWalls, upperWalls] = await snaptrude.design.create.wallRuns([
558
- * { profile: ground, height: 3, thickness: 0.2 },
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 }]] },
563
- * ])
564
- * console.log(groundWalls.length, "walls on the ground floor")
565
- * ```
566
- */
567
- public abstract wallRuns(
568
- items: PluginCreateWallRunItem[],
569
- ): PluginApiReturn<ComponentHandle[][]>
570
-
571
- /**
572
- * Create a **staircase** from a parametric preset, placed at a point.
573
- *
574
- * Geometry is procedurally generated from the chosen `preset`; there is no
575
- * footprint input. Placed on the active structure/story unless overridden.
576
- * The promise resolves only after the staircase's asynchronous geometry union
577
- * and creation-command capture settle; a union failure rejects the call.
578
- *
579
- * @param preset - The parametric preset to generate
580
- * @param position - Placement point
581
- * @param label - Optional label
582
- * @param structureId - Target structure (default active)
583
- * @param level - Target level name (default active/`"01"`)
584
- * @param dimensions - Optional positive dimension overrides in Snaptrude engine
585
- * units, plus a placement angle in 90-degree increments. Overrides are
586
- * applied to the staircase parameters before the creation command runs.
587
- * @returns the {@linkcode ComponentHandle} of the created staircase
588
- * @throws if the preset is unknown or placement fails
589
- *
590
- * @examplePrompt Add a dog-legged staircase at this location
591
- * @examplePrompt Place a straight stair on level 01
592
- * @examplePrompt Create an L-shaped staircase in the lobby
593
- * @examplePrompt Insert a staircase near the entrance
594
- * @examplePrompt Put amphitheatre steps at these coordinates
595
- *
596
- * # Example
597
- * ```ts
598
- * const stair = await snaptrude.design.create.staircase(
599
- * "dogLegged",
600
- * await snaptrude.core.math.vec3.new(5, 0, 5),
601
- * )
602
- * ```
603
- */
604
- public abstract staircase(
605
- preset: PluginStaircasePreset,
606
- position: Vec3Handle,
607
- label?: string,
608
- structureId?: string,
609
- level?: string,
610
- dimensions?: PluginStaircaseDimensions,
611
- ): PluginApiReturn<ComponentHandle>
612
-
613
- /**
614
- * Create **reference lines** from a profile — one reference line per curve in
615
- * the profile's ordered chain. Returns a handle per created line.
616
- *
617
- * Optional style (`color`, `thickness`, `style`, `gridTag`) applies to
618
- * every created line.
619
- *
620
- * @param profile - Ordered curve chain (centerlines)
621
- * @param color - Hex color `"#RRGGBB"` (default white)
622
- * @param thickness - Line thickness (default 1)
623
- * @param style - Line style (default `SOLID`)
624
- * @param gridTag - Grid tag label (default `"A"`)
625
- * @returns a {@linkcode ComponentHandle}`[]` (one per curve), in profile order
626
- * @throws if the profile is empty or creation fails
627
- *
628
- * @examplePrompt Draw a reference line between these two points
629
- * @examplePrompt Add dashed guide lines along this path
630
- * @examplePrompt Create grid lines tagged A through the plan
631
- * @examplePrompt Set up construction lines for the column grid
632
- * @examplePrompt Mark a red reference line across the site
633
- *
634
- * # Example
635
- * ```ts
636
- * const v = snaptrude.core.math.vec3
637
- * const profile = await snaptrude.core.geom.create.profileFromLinePoints([
638
- * await v.new(0, 0, 0),
639
- * await v.new(10, 0, 0),
640
- * ])
641
- * const lines = await snaptrude.design.create.referenceLines(
642
- * profile,
643
- * undefined,
644
- * undefined,
645
- * "DASHED",
646
- * )
647
- * ```
648
- */
649
- public abstract referenceLines(
650
- profile: ProfileHandle,
651
- color?: string,
652
- thickness?: number,
653
- style?: PluginReferenceLineStyle,
654
- gridTag?: string,
655
- ): PluginApiReturn<ComponentHandle[]>
656
-
657
- /**
658
- * Create a free rectangular **structural grid** — one grid group with two
659
- * perpendicular line families (`linesX` lines spaced `spacingX` apart, and
660
- * `linesY` lines spaced `spacingY` apart) on the active storey. One undoable
661
- * creation.
662
- *
663
- * Units: spacings in Snaptrude units; `angle` in degrees (CCW about +Y,
664
- * default 0). Without `center` the grid is centred on the current viewport
665
- * (the native tool's behavior) — pass `center` for deterministic placement.
666
- *
667
- * @param linesX - Line count of the first family (integer ≥ 1)
668
- * @param linesY - Line count of the second family (integer ≥ 1)
669
- * @param spacingX - First-family spacing (Snaptrude units, > 0)
670
- * @param spacingY - Second-family spacing (Snaptrude units, > 0)
671
- * @param options - `angle`, `center`, and {@linkcode PluginGridStyleOptions}
672
- * @returns the created grid group's {@linkcode ComponentHandle}
673
- *
674
- * @examplePrompt Create a 5 by 8 structural grid with 6 metre spacing
675
- * @examplePrompt Add a column grid rotated 30 degrees
676
- * @examplePrompt Set up a structural grid at the site origin
677
- *
678
- * # Example
679
- * ```ts
680
- * const centre = await snaptrude.core.math.vec3.new(0, 0, 0)
681
- * const grid = await snaptrude.design.create.grid(5, 8, 6, 6, { center: centre })
682
- * ```
683
- */
684
- public abstract grid(
685
- linesX: number,
686
- linesY: number,
687
- spacingX: number,
688
- spacingY: number,
689
- options?: {
690
- angle?: number
691
- center?: Vec3Handle
692
- } & PluginGridStyleOptions,
693
- ): PluginApiReturn<ComponentHandle>
694
-
695
- /**
696
- * Create a **structural grid from a single curve** — one grid group holding
697
- * one wing with one line (the draw tool's output). The curve may be a line
698
- * or an arc; circles are rejected with `VALIDATION`. Undoable.
699
- *
700
- * @param curve - The grid line's geometry ({@linkcode CurveHandle}, world space)
701
- * @param options - `tag` (defaults to the draw tool's next tag) and
702
- * {@linkcode PluginGridStyleOptions}
703
- * @returns the created grid group's {@linkcode ComponentHandle}
704
- *
705
- * @examplePrompt Draw a grid line from A to B
706
- * @examplePrompt Add a curved grid line through these points
707
- * @examplePrompt Create grid line "C" along this wall
708
- *
709
- * # Example
710
- * ```ts
711
- * const { vec3 } = snaptrude.core.math
712
- * const from = await vec3.new(0, 0, 0)
713
- * const to = await vec3.new(30, 0, 0)
714
- * const curve = await snaptrude.core.geom.create.line(from, to)
715
- * const grid = await snaptrude.design.create.gridFromCurve(curve, { tag: "A" })
716
- * ```
717
- */
718
- public abstract gridFromCurve(
719
- curve: CurveHandle,
720
- options?: {
721
- tag?: string
722
- } & PluginGridStyleOptions,
723
- ): PluginApiReturn<ComponentHandle>
724
-
725
- /**
726
- * Generate **structural grids fitted to mass footprints** — one grid group
727
- * per footprint cluster, with counts and orientation derived from each
728
- * footprint's geometry and the given spacings. All created groups commit as
729
- * ONE undoable unit.
730
- *
731
- * Lenient like the native tool: masses without an extractable footprint
732
- * (no B-rep, degenerate top face) are skipped; throws `VALIDATION` only when
733
- * NONE of the given masses yields a footprint.
734
- *
735
- * @param masses - Masses whose footprints seat the grids
736
- * @param spacingX - First-family spacing (Snaptrude units, > 0)
737
- * @param spacingY - Second-family spacing (Snaptrude units, > 0)
738
- * @param options - {@linkcode PluginGridStyleOptions}
739
- * @returns the created grid groups' {@linkcode ComponentHandle}`[]`
740
- *
741
- * @examplePrompt Generate grids for the selected masses
742
- * @examplePrompt Auto-generate a 6m structural grid on this building
743
- * @examplePrompt Fit column grids to every mass on this storey
744
- *
745
- * # Example
746
- * ```ts
747
- * const masses = await snaptrude.design.query.listMasses({ storeys: [1] })
748
- * const grids = await snaptrude.design.create.gridsFromMasses(masses, 6, 6)
749
- * ```
750
- */
751
- public abstract gridsFromMasses(
752
- masses: ComponentHandle[],
753
- spacingX: number,
754
- spacingY: number,
755
- options?: PluginGridStyleOptions,
756
- ): PluginApiReturn<ComponentHandle[]>
757
-
758
- /**
759
- * Create **columns at every grid-line intersection** of the given grid
760
- * groups, sized `width` × `depth` and oriented to the grid axes, on the
761
- * grids' storey. All columns commit as ONE undoable unit.
762
- *
763
- * @param grids - Grid groups whose intersections seat the columns
764
- * @param width - Column width (Snaptrude units, > 0)
765
- * @param depth - Column depth (Snaptrude units, > 0)
766
- * @returns the created columns' {@linkcode ComponentHandle}`[]`
767
- * @throws `VALIDATION` when an id does not resolve to a grid group;
768
- * `OPERATION_FAILED` when the grids have no line intersections
769
- *
770
- * @examplePrompt Generate columns on this grid
771
- * @examplePrompt Place 450mm square columns at every grid intersection
772
- *
773
- * # Example
774
- * ```ts
775
- * const grids = await snaptrude.design.query.listGrids()
776
- * const columns = await snaptrude.design.create.columnsFromGrids(grids, 0.45, 0.45)
777
- * ```
778
- */
779
- public abstract columnsFromGrids(
780
- grids: ComponentHandle[],
781
- width: number,
782
- depth: number,
783
- ): PluginApiReturn<ComponentHandle[]>
784
-
785
- /**
786
- * Place a **furniture** item from the project library at a world position.
787
- *
788
- * Identified by a **catalog (library) id** — the team object's stable `_id` for
789
- * project uploads, or the item's `fullName` for the general library. Discover ids
790
- * with {@linkcode PluginDesignFurnitureApi.listCatalog}. Placement is asynchronous
791
- * (the source mesh is fetched if not cached) and creates one undo entry.
792
- *
793
- * Placed at the item's default rotation unless `angleInDegrees` is given, which
794
- * rotates it about the vertical axis at creation time (baked into the same undo
795
- * entry). To rotate an existing instance instead, use `design.transform.rotate`.
796
- *
797
- * @param catalogId - Library id: team `_id` or general `fullName`
798
- * @param position - Absolute world placement point. `position.y` is the REST
799
- * elevation: the item is grounded so its bounding-box base sits exactly at
800
- * `position.y` (the same surface-flush contract as interactive drag-drop) —
801
- * pass the floor/storey elevation to stand furniture on it; never add half
802
- * the item's height yourself.
803
- * @param options - Optional placement options: `label` — instance name and
804
- * readable label (`design.query.getLabel`; default auto `${name}Ins${n}`);
805
- * `createNewSourceMesh` — legacy flag, kept for compatibility. The host owns
806
- * source-mesh persistence: a catalog source is recorded exactly once, by the
807
- * first placement that brings it in, and this flag cannot skip that record.
808
- * @param angleInDegrees - Optional signed rotation about the vertical axis, in
809
- * degrees (same convention as {@linkcode PluginDesignTransformApi.rotate}).
810
- * Applied at creation time so it is part of the placement's single undo entry.
811
- * Default: the item's own (unrotated) orientation.
812
- * @returns the {@linkcode ComponentHandle} of the placed furniture instance
813
- * @throws if the catalog id is unknown, the source mesh fails to load, or placement fails;
814
- * `PRECONDITION_FAILED` (`details.engineCode: "TOOL_ACTIVE"`) while the interactive
815
- * furniture tool is active — finish or cancel it first
816
- *
817
- * @examplePrompt Place a chair from the library at this spot
818
- * @examplePrompt Add a sofa from the furniture catalog to the living room
819
- * @examplePrompt Drop a desk into the scene at 3, 0, 5
820
- * @examplePrompt Insert the uploaded bed model in the bedroom
821
- * @examplePrompt Put a table from my project library here and name it Table-01
822
- * @examplePrompt Place a chair here rotated 90 degrees
823
- *
824
- * # Example
825
- * ```ts
826
- * const chair = await snaptrude.design.create.furniture(
827
- * "6620f1a…", // from design.furniture.listCatalog()
828
- * await snaptrude.core.math.vec3.new(3, 0, 5),
829
- * { label: "Chair-01" },
830
- * )
831
- * // …placed already turned 90° about the vertical axis:
832
- * const turned = await snaptrude.design.create.furniture(
833
- * "6620f1a…",
834
- * await snaptrude.core.math.vec3.new(3, 0, 5),
835
- * undefined,
836
- * 90,
837
- * )
838
- * ```
839
- *
840
- * @performance For MORE THAN ONE item, call `design.create.furnitureItems(items[])` —
841
- * one host round-trip and ONE undo entry, and a catalog source shared by several
842
- * items is fetched once. Looping this single-item creator is N round-trips.
843
- */
844
- public abstract furniture(
845
- catalogId: string,
846
- position: Vec3Handle,
847
- options?: { label?: string; createNewSourceMesh?: boolean },
848
- angleInDegrees?: number,
849
- ): PluginApiReturn<ComponentHandle>
850
-
851
- /**
852
- * Place **many furniture items** in one undoable operation (bulk plural of
853
- * {@linkcode furniture}). Each item names a catalog id and an absolute world
854
- * position (`position.y` is the REST elevation — the same grounding contract
855
- * as the singular creator), with optional label and rotation. A catalog
856
- * source shared by several items is fetched and recorded once for the whole
857
- * batch, so the host — not the caller — owns source persistence (there is no
858
- * per-item `createNewSourceMesh`). Validate-all-or-throw; one command.
859
- *
860
- * @param items - One {@linkcode PluginCreateFurnitureItem} per instance to
861
- * place (≥1, ≤1000)
862
- * @returns the placed instances as {@linkcode ComponentHandle}`[]`, in input order
863
- * @throws `VALIDATION` if the items fail the schema (empty array, more than
864
- * 1000 items); `HANDLE_INVALID` if a `position` handle is unknown or
865
- * released; `PRECONDITION_FAILED` if a catalog id is unknown, a furniture
866
- * tool is active, or a parametric group is active (exit it first, or place
867
- * items one at a time with `furniture`); `OPERATION_FAILED` if a source
868
- * mesh fails to load or placement fails (nothing is created —
869
- * `details.itemIndex` is the failing item); `METHOD_NOT_PERMITTED` if the plugin may not write.
870
- *
871
- * @examplePrompt Place all the desks for this office at once
872
- * @examplePrompt Furnish every bedroom in one operation
873
- * @examplePrompt Bulk place these chairs around the table
874
- * @examplePrompt Add the whole furniture layout in a single undo step
875
- * @examplePrompt Drop twenty copies of this chair at these positions
876
- *
877
- * @performance Bulk creator — the whole batch is ONE host round-trip and ONE undo
878
- * entry, and each distinct catalog source loads once. Always prefer this over
879
- * calling `design.create.furniture` in a loop: build the full `items[]` array
880
- * first (all positions and angles up front), then make one call.
881
- *
882
- * # Example
883
- * ```ts
884
- * const v = snaptrude.core.math.vec3
885
- * const [chair] = await snaptrude.design.furniture.listCatalog()
886
- * const placed = await snaptrude.design.create.furnitureItems([
887
- * { catalogId: chair.id, position: await v.new(3, 0, 5), label: "Chair-01" },
888
- * { catalogId: chair.id, position: await v.new(4, 0, 5), angleInDegrees: 90 },
889
- * { catalogId: chair.id, position: await v.new(5, 0, 5), angleInDegrees: 180 },
890
- * ])
891
- * ```
892
- */
893
- public abstract furnitureItems(
894
- items: PluginCreateFurnitureItem[],
895
- ): PluginApiReturn<ComponentHandle[]>
896
-
897
- /**
898
- * Place a **door** from the catalog into a host wall.
899
- *
900
- * Identified by a **catalog (library) id** — the team object's stable `_id`
901
- * or the general library's `fullName`. Discover ids with
902
- * {@linkcode PluginDesignDoorsApi.listCatalog}. The world `position` is
903
- * projected onto the host wall's face to locate the opening; the wall is
904
- * re-cut and the door hosted in a single undo entry. Placement is
905
- * asynchronous (the source mesh is fetched if not cached).
906
- *
907
- * @param catalogId - Library id: team `_id` or general `fullName`
908
- * @param hostWall - The wall to host the door
909
- * @param position - World point projected onto the wall to locate the opening
910
- * @param options - Optional placement options: `label` — instance name;
911
- * `hinge` — world point near the jamb the door is hinged on (the door is
912
- * reflected along the wall so its hinged jamb is the one nearer this
913
- * point; default the catalog item's authored hinge side)
914
- * @param facing - World point on the side of the wall the door swings open
915
- * to (the room it opens into — where the plan symbol draws the swing arc).
916
- * Any point clearly on that side works (e.g. the room's center). Default:
917
- * the engine picks a side (nondeterministic when `position` sits on the
918
- * wall centerline).
919
- * @returns the {@linkcode ComponentHandle} of the placed door
920
- * @throws if the catalog id is unknown, the host is not a wall, the source
921
- * mesh fails to load, or the projected point falls **outside** the host wall
922
- *
923
- * @examplePrompt Add a door to this wall here
924
- * @examplePrompt Place a sliding door on the selected wall
925
- * @examplePrompt Put a door from the catalog at this point on the wall
926
- * @examplePrompt Insert the entrance door into this wall
927
- * @examplePrompt Add a door to the wall and call it Entry-01
928
- * @examplePrompt Add a door that opens into the living room
929
- * @examplePrompt Put a door here hinged on the north jamb
930
- *
931
- * # Example
932
- * ```ts
933
- * const [wall] = await snaptrude.design.query.listWalls({ isSelected: true })
934
- * const [entry] = await snaptrude.design.doors.listCatalog()
935
- * const door = await snaptrude.design.create.door(
936
- * entry.id,
937
- * wall,
938
- * await snaptrude.core.math.vec3.new(3, 0, 5),
939
- * { label: "Entry-01" },
940
- * )
941
- * // …facing a specific side of the wall (pass a point inside that room):
942
- * const intoKitchen = await snaptrude.design.create.door(
943
- * entry.id,
944
- * wall,
945
- * await snaptrude.core.math.vec3.new(3, 0, 5),
946
- * undefined,
947
- * await snaptrude.core.math.vec3.new(3, 0, 9),
948
- * )
949
- * // …and hinged on the jamb nearest a point (here the +x end of the opening):
950
- * const hingedRight = await snaptrude.design.create.door(
951
- * entry.id,
952
- * wall,
953
- * await snaptrude.core.math.vec3.new(3, 0, 5),
954
- * { hinge: await snaptrude.core.math.vec3.new(3.5, 0, 5) },
955
- * await snaptrude.core.math.vec3.new(3, 0, 9),
956
- * )
957
- * ```
958
- *
959
- * @performance For MORE THAN ONE door, call `design.create.doors(items[])` — one host
960
- * round-trip and ONE undo entry, with each host wall re-cut once per opening inside
961
- * that single call. Looping this single-door creator is N round-trips.
962
- */
963
- public abstract door(
964
- catalogId: string,
965
- hostWall: ComponentHandle,
966
- position: Vec3Handle,
967
- options?: { label?: string; hinge?: Vec3Handle },
968
- facing?: Vec3Handle,
969
- ): PluginApiReturn<ComponentHandle>
970
-
971
- /**
972
- * Place **many doors** into host walls in one undoable operation (bulk plural
973
- * of {@linkcode door}). Each item carries its own catalog id, host wall,
974
- * world position, and optional `facing`, `label`, `width` and `height` — the
975
- * same fields as a `"door"` {@linkcode PluginDesignCreateOpeningOptions}.
976
- * Validate-all-or-throw; one command.
977
- *
978
- * As with the singular creator, placing an opening **re-cuts its host wall**:
979
- * the wall you passed as `hostWall` stops resolving once the call returns.
980
- * Several items MAY name the same original wall handle in one call — the host
981
- * chains the re-cuts internally — but after the call recover the surviving
982
- * wall with `design.query.getHost(opening)`, never by reusing the handle you
983
- * passed in.
984
- *
985
- * @param items - One {@linkcode PluginCreateDoorItem} per door to place
986
- * (≥1, ≤1000)
987
- * @returns the placed doors as {@linkcode ComponentHandle}`[]`, in input order
988
- * @throws `VALIDATION` if the items fail the schema (empty array, more than
989
- * 1000 items, unknown fields, a non-positive `width`/`height`);
990
- * `HANDLE_INVALID` if a `position`, `facing` or `hinge` handle is unknown
991
- * or released; `PRECONDITION_FAILED` if a catalog id is unknown, a `hostWall`
992
- * is not a wall / is locked / is not in the active proposal, the projected
993
- * point falls outside its host wall, or a door tool is active;
994
- * `OPERATION_FAILED` if a source mesh fails to load or placement fails
995
- * (nothing is created — `details.itemIndex` is the failing item);
996
- * `METHOD_NOT_PERMITTED` if the plugin may not write.
997
- *
998
- * @examplePrompt Add doors to all of these walls at once
999
- * @examplePrompt Place a door in every room in one operation
1000
- * @examplePrompt Bulk add the entrance doors from this schedule
1001
- * @examplePrompt Put three doors on this wall in a single undo step
1002
- * @examplePrompt Add all the doors for this floor plan together
1003
- *
1004
- * @performance Bulk creator — the whole batch is ONE host round-trip and ONE undo
1005
- * entry, and each distinct catalog source loads once. Always prefer this over
1006
- * calling `design.create.door` in a loop: build the full `items[]` array first
1007
- * (all host walls and points up front), then make one call.
1008
- *
1009
- * # Example
1010
- * ```ts
1011
- * const v = snaptrude.core.math.vec3
1012
- * const [wall] = await snaptrude.design.query.listWalls({ isSelected: true })
1013
- * const [entry] = await snaptrude.design.doors.listCatalog()
1014
- * const [front, side] = await snaptrude.design.create.doors([
1015
- * { catalogId: entry.id, hostWall: wall, position: await v.new(2, 0, 5), label: "D-01" },
1016
- * { catalogId: entry.id, hostWall: wall, position: await v.new(6, 0, 5), width: 1.2 },
1017
- * ])
1018
- * // `wall` was re-cut twice and no longer resolves — ask the opening for its host:
1019
- * const currentWall = await snaptrude.design.query.getHost(front)
1020
- * ```
1021
- */
1022
- public abstract doors(
1023
- items: PluginCreateDoorItem[],
1024
- ): PluginApiReturn<ComponentHandle[]>
1025
-
1026
- /**
1027
- * Place a **window** from the catalog into a host wall.
1028
- *
1029
- * Identified by a **catalog (library) id** — the team object's stable `_id`
1030
- * or the general library's `fullName`. Discover ids with
1031
- * {@linkcode PluginDesignWindowsApi.listCatalog}. The world `position` is
1032
- * projected onto the host wall's face to locate the opening; the wall is
1033
- * re-cut and the window hosted in a single undo entry. Placement is
1034
- * asynchronous (the source mesh is fetched if not cached).
1035
- *
1036
- * @param catalogId - Library id: team `_id` or general `fullName`
1037
- * @param hostWall - The wall to host the window
1038
- * @param position - World point projected onto the wall to locate the opening
1039
- * @param options - Optional placement options: `label` — instance name;
1040
- * `hinge` — world point near the jamb the window is hinged on (same rule
1041
- * as {@linkcode PluginDesignCreateApi.door}; default the catalog item's
1042
- * authored side)
1043
- * @param facing - World point on the side of the wall the window opens to
1044
- * (matters for asymmetric windows, e.g. casement swing) — same convention
1045
- * as {@linkcode PluginDesignCreateApi.door}. Default: the engine picks a
1046
- * side (nondeterministic when `position` sits on the centerline).
1047
- * @returns the {@linkcode ComponentHandle} of the placed window
1048
- * @throws if the catalog id is unknown, the host is not a wall, the source
1049
- * mesh fails to load, or the projected point falls **outside** the host wall
1050
- *
1051
- * @examplePrompt Add a window to this wall here
1052
- * @examplePrompt Place a casement window on the selected wall
1053
- * @examplePrompt Put a window from the catalog at this point on the wall
1054
- * @examplePrompt Insert a window into the living room wall
1055
- * @examplePrompt Add a window to the wall and name it Win-01
1056
- * @examplePrompt Add a casement window opening toward the garden side
1057
- *
1058
- * # Example
1059
- * ```ts
1060
- * const [wall] = await snaptrude.design.query.listWalls({ isSelected: true })
1061
- * const [entry] = await snaptrude.design.windows.listCatalog()
1062
- * const window = await snaptrude.design.create.window(
1063
- * entry.id,
1064
- * wall,
1065
- * await snaptrude.core.math.vec3.new(3, 0, 5),
1066
- * { label: "Win-01" },
1067
- * )
1068
- * ```
1069
- *
1070
- * @performance For MORE THAN ONE window, call `design.create.windows(items[])` — one
1071
- * host round-trip and ONE undo entry, with each host wall re-cut once per opening
1072
- * inside that single call. Looping this single-window creator is N round-trips.
1073
- */
1074
- public abstract window(
1075
- catalogId: string,
1076
- hostWall: ComponentHandle,
1077
- position: Vec3Handle,
1078
- options?: { label?: string; hinge?: Vec3Handle },
1079
- facing?: Vec3Handle,
1080
- ): PluginApiReturn<ComponentHandle>
1081
-
1082
- /**
1083
- * Place **many windows** into host walls in one undoable operation (bulk
1084
- * plural of {@linkcode window}). Each item carries its own catalog id, host
1085
- * wall, world position, and optional `facing`, `label`, `width`, `height` and
1086
- * `sillHeight` — the same fields as a `"window"`
1087
- * {@linkcode PluginDesignCreateOpeningOptions}. `sillHeight` is measured from
1088
- * the host wall base to the BOTTOM of the window. Validate-all-or-throw; one
1089
- * command.
1090
- *
1091
- * As with the singular creator, placing an opening **re-cuts its host wall**:
1092
- * the wall you passed as `hostWall` stops resolving once the call returns.
1093
- * Several items MAY name the same original wall handle in one call — the host
1094
- * chains the re-cuts internally — but after the call recover the surviving
1095
- * wall with `design.query.getHost(opening)`, never by reusing the handle you
1096
- * passed in.
1097
- *
1098
- * @param items - One {@linkcode PluginCreateWindowItem} per window to place
1099
- * (≥1, ≤1000)
1100
- * @returns the placed windows as {@linkcode ComponentHandle}`[]`, in input order
1101
- * @throws `VALIDATION` if the items fail the schema (empty array, more than
1102
- * 1000 items, unknown fields, a non-positive `width`/`height`, a negative
1103
- * `sillHeight`); `HANDLE_INVALID` if a `position`, `facing` or `hinge`
1104
- * handle is unknown or released; `PRECONDITION_FAILED` if a catalog id is unknown, a
1105
- * `hostWall` is not a wall / is locked / is not in the active proposal, the
1106
- * projected point falls outside its host wall, or a window tool is active;
1107
- * `OPERATION_FAILED` if a source mesh fails to load or placement fails
1108
- * (nothing is created — `details.itemIndex` is the failing item);
1109
- * `METHOD_NOT_PERMITTED` if the plugin may not write.
1110
- *
1111
- * @examplePrompt Add windows along this whole facade at once
1112
- * @examplePrompt Place a window in every bedroom in one operation
1113
- * @examplePrompt Bulk add the windows from this schedule
1114
- * @examplePrompt Put four windows on this wall in a single undo step
1115
- * @examplePrompt Add all the windows with a 0.9m sill height together
1116
- *
1117
- * @performance Bulk creator — the whole batch is ONE host round-trip and ONE undo
1118
- * entry, and each distinct catalog source loads once. Always prefer this over
1119
- * calling `design.create.window` in a loop: build the full `items[]` array first
1120
- * (all host walls and points up front), then make one call.
1121
- *
1122
- * # Example
1123
- * ```ts
1124
- * const v = snaptrude.core.math.vec3
1125
- * const [wall] = await snaptrude.design.query.listWalls({ isSelected: true })
1126
- * const [casement] = await snaptrude.design.windows.listCatalog()
1127
- * const placed = await snaptrude.design.create.windows([
1128
- * { catalogId: casement.id, hostWall: wall, position: await v.new(2, 0, 5), sillHeight: 0.9 },
1129
- * { catalogId: casement.id, hostWall: wall, position: await v.new(5, 0, 5), sillHeight: 0.9 },
1130
- * ])
1131
- * const currentWall = await snaptrude.design.query.getHost(placed[0])
1132
- * ```
1133
- */
1134
- public abstract windows(
1135
- items: PluginCreateWindowItem[],
1136
- ): PluginApiReturn<ComponentHandle[]>
1137
-
1138
- /**
1139
- * Place a catalog **door or window** into a host wall with optional size overrides.
1140
- *
1141
- * The world `position` is projected onto the host wall to locate the opening.
1142
- * All supplied dimensions use Snaptrude engine units. Window `sillHeight` is
1143
- * measured from the host wall base to the bottom of the window, not to
1144
- * its center. Placement is asynchronous and committed as one undoable creation.
1145
- *
1146
- * @param options - Opening kind, catalog and host references, placement, and
1147
- * optional facing (swing side), hinge (hinged jamb), label, and dimensions
1148
- * @returns the {@linkcode ComponentHandle} of the placed door or window
1149
- * @throws if the options are invalid, the catalog id is unknown, the host is
1150
- * not a wall, loading fails, or the opening cannot be placed on the host
1151
- *
1152
- * @examplePrompt Add a 1m wide door to this wall here
1153
- * @examplePrompt Place a window with a 0.9m sill height on the selected wall
1154
- *
1155
- * @performance Single-opening creator — use it for one hosted opening. For MORE
1156
- * THAN ONE, call `design.create.doors(items[])` / `design.create.windows(items[])`:
1157
- * the same per-item fields, one host round-trip, ONE undo entry.
1158
- *
1159
- * # Example
1160
- * ```ts
1161
- * const opening = await snaptrude.design.create.opening({
1162
- * kind: "window",
1163
- * catalogId: windowType.id,
1164
- * hostWall: wall,
1165
- * position: await snaptrude.core.math.vec3.new(3, 0, 5),
1166
- * width: 1.2,
1167
- * height: 1.5,
1168
- * sillHeight: 0.9,
1169
- * })
1170
- * ```
1171
- */
1172
- public abstract opening(
1173
- options: PluginDesignCreateOpeningOptions,
1174
- ): PluginApiReturn<ComponentHandle>
1175
-
1176
- /**
1177
- * Place a **smart layout** — clone an in-scene template cluster (walls,
1178
- * furniture, doors, windows, floors) into one or more target ROOM/DEPARTMENT
1179
- * spaces, adapting orientation and fit to each target.
1180
- *
1181
- * Supply the template as **exactly one** of `templateGroup` (a group **id**
1182
- * from `snaptrude.core.groups.list` — groups are string-id entities, not
1183
- * component handles) or
1184
- * `templateComponents` (an explicit component set); every target in `targets`
1185
- * (≥1) receives its own placement. By default the target spaces are hidden
1186
- * after placement (`hideTargets`, mirroring the product) — pass `false` to keep
1187
- * them visible.
1188
- *
1189
- * The whole operation — every wall/opening/furniture/floor across every target,
1190
- * plus the target-hide — is committed as a **single undo step**. Because all
1191
- * targets merge into one creation batch, the created entities are returned
1192
- * **flat, grouped by kind** ({@linkcode PluginSmartLayoutResult}), NOT attributed
1193
- * per target (per-target attribution would break the single-undo guarantee).
1194
- * `skippedWalls` is the interior-optimizer's best-candidate count of walls it
1195
- * could not place. Synchronous and heavy — many targets can jank the main thread.
1196
- *
1197
- * @param options - {@linkcode PluginSmartLayoutArgs}: template source, targets, and `hideTargets`
1198
- * @returns a {@linkcode PluginSmartLayoutResult} — created entities grouped by kind + `skippedWalls`
1199
- * @throws if smart layout is not enabled, the template group is invalid, there
1200
- * is no template / no targets / no valid mappings, or component creation fails
1201
- *
1202
- * @examplePrompt Copy this room's layout into the selected rooms
1203
- * @examplePrompt Apply this furniture arrangement to the other offices
1204
- * @examplePrompt Replicate this template into these two spaces
1205
- * @examplePrompt Place this desk cluster into every meeting room
1206
- * @examplePrompt Use this room as a template for the rooms I selected but keep them visible
1207
- *
1208
- * # Example
1209
- * ```ts
1210
- * const [templateRoom, ...targets] = await snaptrude.design.query.listSpaces({ isSelected: true })
1211
- * const result = await snaptrude.design.create.smartLayout({
1212
- * templateComponents: [templateRoom],
1213
- * targets,
1214
- * })
1215
- * console.log("placed walls:", result.created.walls.length, "skipped:", result.skippedWalls)
1216
- *
1217
- * // …or clone a saved group by its id (from core.groups.list)
1218
- * const { groups } = await snaptrude.core.groups.list()
1219
- * await snaptrude.design.create.smartLayout({ templateGroup: groups[0].id, targets })
1220
- * ```
1221
- */
1222
- public abstract smartLayout(
1223
- options: PluginSmartLayoutArgs,
1224
- ): PluginApiReturn<PluginSmartLayoutResult>
1225
-
1226
- /**
1227
- * **Copy** existing entities, offsetting each copy by `displacement * i` (i = 1…count),
1228
- * source positions preserved. Migrated from the removed `tools.copy`. In `"instance"`
1229
- * mode copies stay in the source's instance family where possible; `"unique"` makes
1230
- * independent geometry. The created copies become the active selection. Undoable.
1231
- *
1232
- * Runs on the engine's array-copy tool, so its semantics carry over: an
1233
- * `"instance"` copy of a source that is not yet an instance **replaces that
1234
- * source** with a fresh instance component — the handle you passed in stops
1235
- * resolving after the call. Re-query (e.g. `design.query.listSpaces`) to pick
1236
- * up the replacement before operating on that entity again; copying the stale
1237
- * handle throws. `"unique"` mode never replaces sources.
1238
- *
1239
- * @param components - Entities to copy (≥1)
1240
- * @param displacement - Per-copy offset as a {@linkcode Vec3Handle} (copy `i` at `displacement * i`)
1241
- * @param options - `count` (copies per component, default 1), `mode` (`"instance"` | `"unique"`, default `"instance"`)
1242
- * @returns the created copies as {@linkcode ComponentHandle}`[]`
1243
- * @throws if a component handle is unknown or stale (replaced by an earlier
1244
- * `"instance"` copy), `count` is not a positive integer, or the engine fails
1245
- *
1246
- * @examplePrompt Copy this room 3 times spaced 6m apart
1247
- * @examplePrompt Duplicate the selected furniture along the X axis
1248
- * @examplePrompt Make 5 copies of this column at 4 metre intervals
1249
- * @examplePrompt Array these walls with a 3m offset
1250
- * @examplePrompt Clone the desk as a unique copy, not an instance
1251
- *
1252
- * @performance To place N repeats of the same geometry, bulk-create the seed(s) once then
1253
- * call this ONCE with `{ count: N - 1 }` — one host round-trip for all copies. Never
1254
- * reproduce geometry by looping `design.create.*` N times. Copy only after the create
1255
- * that mints the seed ids.
1256
- *
1257
- * # Example
1258
- * ```ts
1259
- * const { vec3 } = snaptrude.core.math
1260
- * const copies = await snaptrude.design.create.copy(["space-id"], vec3.new(6, 0, 0), { count: 3 })
1261
- * ```
1262
- */
1263
- public abstract copy(
1264
- components: ComponentHandle[],
1265
- displacement: Vec3Handle,
1266
- options?: { count?: number; mode?: PluginCopyMode },
1267
- ): PluginApiReturn<ComponentHandle[]>
1268
-
1269
- /**
1270
- * Create **many spaces** in one undoable operation (bulk plural of {@linkcode space}).
1271
- * Migrated from the removed `entity.space.bulkCreate`. Each item extrudes a contour
1272
- * footprint up `height`. Validate-all-or-throw; one command. For a rectangular
1273
- * (box) space, build the footprint with `core.geom.create.profileRect` →
1274
- * `contourFromProfile`, then pass it as an item. Each item may carry its own
1275
- * `storey` (see {@linkcode PluginCreateSpaceItem}) so a single call can populate
1276
- * several floors at once.
1277
- *
1278
- * @param items - One {@linkcode PluginCreateSpaceItem} per space to create (≥1)
1279
- * @returns the created spaces as {@linkcode ComponentHandle}`[]`, in input order
1280
- * @throws if any item's contour is invalid, its height is not positive, or its
1281
- * target `storey` does not exist (all-or-nothing — nothing is created)
1282
- *
1283
- * @examplePrompt Create several rooms at once from these footprints
1284
- * @examplePrompt Generate all the bedrooms in one operation
1285
- * @examplePrompt Bulk create the spaces for this floor plan
1286
- * @examplePrompt Add three rooms with different heights in a single undo step
1287
- * @examplePrompt Create one room on the ground floor and one on the first floor
1288
- *
1289
- * @performance Bulk creator — the whole batch is ONE host round-trip. Always prefer this
1290
- * over calling `design.create.space` in a loop: build the full `items[]` array first
1291
- * (all per-item math and geometry up front), then make one call.
1292
- *
1293
- * # Example
1294
- * ```ts
1295
- * const rect = await snaptrude.core.geom.create.profileRect(4, 3)
1296
- * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
1297
- * const [a, b] = await snaptrude.design.create.spaces([
1298
- * { contour, height: 3, label: "R1" },
1299
- * { contour, height: 4, label: "R2", position: await vec3.new(10, 0, 0) },
1300
- * ])
1301
- * ```
1302
- */
1303
- public abstract spaces(
1304
- items: PluginCreateSpaceItem[],
1305
- ): PluginApiReturn<ComponentHandle[]>
1306
-
1307
- /**
1308
- * Create a new parametric buildable envelope — the zoning-regulated volume a
1309
- * building may occupy — generated from a site polygon, tiered setbacks, a
1310
- * height or floor-count cap, and optional FAR and lot-coverage limits. The host
1311
- * mints the envelope id and returns it. Canonical home of the create formerly
1312
- * at `entity.buildableEnvelope.create` (now deprecated).
1313
- *
1314
- * @param sitePolygon - Site polygon vertices in `lengthUnit`; minimum 3 vertices.
1315
- * @param lengthUnit - Unit used by all length fields (`"ft" | "m"`).
1316
- * @param setbacks - Setback profile, ground tier first; minimum 1 tier.
1317
- * @param verticalCap - Maximum height or floor count.
1318
- * @param floorToFloor - Required floor-to-floor height in `lengthUnit`.
1319
- * @param farRatio - Optional FAR value, positive when provided.
1320
- * @param lotCoverageMaxPct - Optional lot coverage cap, `0..100`.
1321
- * @returns A {@linkcode PluginBuildableEnvelopeCreateResult} with the
1322
- * `buildableEnvelopeId` of the created envelope.
1323
- * @throws If validation fails or generation produces no renderable geometry.
1324
- *
1325
- * @examplePrompt Create a buildable envelope for my site
1326
- * @examplePrompt Generate the zoning envelope with 10ft front setbacks
1327
- * @examplePrompt Show the maximum buildable volume with a 150ft height limit
1328
- * @examplePrompt Create a zoning envelope capped at 12 floors with FAR 3
1329
- *
1330
- * # Example
1331
- * ```ts
1332
- * const { buildableEnvelopeId } = await snaptrude.design.create.buildableEnvelope(
1333
- * [
1334
- * { x: 0, z: 0 },
1335
- * { x: 100, z: 0 },
1336
- * { x: 100, z: 80 },
1337
- * { x: 0, z: 80 },
1338
- * ],
1339
- * "ft",
1340
- * [
1341
- * { aboveHeight: 0, front: 10, side: 5, rear: 10 },
1342
- * { aboveHeight: 100, front: 20, side: 10, rear: 20 },
1343
- * ],
1344
- * { kind: "max_height", maxHeight: 150 },
1345
- * 12,
1346
- * )
1347
- * ```
1348
- */
1349
- public abstract buildableEnvelope(
1350
- sitePolygon: PluginBuildableEnvelopePolygonVertex[],
1351
- lengthUnit: "ft" | "m",
1352
- setbacks: PluginBuildableEnvelopeSetbackTier[],
1353
- verticalCap: PluginBuildableEnvelopeVerticalCap,
1354
- floorToFloor: number,
1355
- farRatio?: number,
1356
- lotCoverageMaxPct?: number,
1357
- ): PluginApiReturn<PluginBuildableEnvelopeCreateResult>
1358
- }
1359
-
1360
- // ---------------------------------------------------------------------------
1361
- // Enums
1362
- // ---------------------------------------------------------------------------
1363
-
1364
- /**
1365
- * Line style of a reference line (mirrors the engine `ReferenceLineMode` verbatim).
1366
- *
1367
- * | Value | Description |
1368
- * |---|---|
1369
- * | `"SOLID"` | Solid line (default) |
1370
- * | `"DASHED"` | Dashed line |
1371
- * | `"DOT_DASH"` | Dot-dash line |
1372
- */
1373
- export const PluginReferenceLineStyle = z.enum(["SOLID", "DASHED", "DOT_DASH"])
1374
- export type PluginReferenceLineStyle = z.infer<typeof PluginReferenceLineStyle>
1375
-
1376
- /**
1377
- * Slab type (mirrors the engine `SLAB_TYPES` values verbatim).
1378
- *
1379
- * | Value | Description |
1380
- * |---|---|
1381
- * | `"Intermediate Slab"` | Intermediate floor slab (default) |
1382
- * | `"Basement Slab"` | Basement slab |
1383
- * | `"Plinth"` | Plinth slab |
1384
- * | `"Roof"` | Roof slab |
1385
- */
1386
- export const PluginSlabType = z.enum([
1387
- "Intermediate Slab",
1388
- "Basement Slab",
1389
- "Plinth",
1390
- "Roof",
1391
- ])
1392
- export type PluginSlabType = z.infer<typeof PluginSlabType>
1393
-
1394
- /**
1395
- * A staircase preset — a base type or a named parametric preset. Mirrors the
1396
- * engine `STAIRCASE_PRESETS` / `StaircaseType`. Use the value that matches the
1397
- * shape you want (e.g. `"straight"`, `"dogLegged"`, `"lShaped"`).
1398
- */
1399
- export const PluginStaircasePreset = z.enum([
1400
- "straight",
1401
- "straightWoLanding",
1402
- "straightFlightWoMidLanding",
1403
- "dogLegged",
1404
- "openWell",
1405
- "lShaped",
1406
- "3StepLShaped",
1407
- "square",
1408
- "singleStep",
1409
- "plinthLevel",
1410
- "amphitheatre",
1411
- "connectingStepsToAmphitheatre",
1412
- "mezzanineFloorStraight",
1413
- "mezzanineFloorDogLegged",
1414
- "mezzanineFloorLShaped",
1415
- "custom",
1416
- ])
1417
- export type PluginStaircasePreset = z.infer<typeof PluginStaircasePreset>
1418
-
1419
- /**
1420
- * Optional staircase dimension overrides. Lengths use Snaptrude engine units
1421
- * and must be positive. `angleInDegrees` controls placement about the vertical
1422
- * axis and must be a multiple of 90 degrees.
1423
- */
1424
- export const PluginStaircaseDimensions = z
1425
- .object({
1426
- width: z.number().finite().positive().optional(),
1427
- tread: z.number().finite().positive().optional(),
1428
- riser: z.number().finite().positive().optional(),
1429
- landingWidth: z.number().finite().positive().optional(),
1430
- angleInDegrees: z.number().finite().multipleOf(90).optional(),
1431
- })
1432
- .strict()
1433
- export type PluginStaircaseDimensions = z.infer<
1434
- typeof PluginStaircaseDimensions
1435
- >
1436
-
1437
- // ---------------------------------------------------------------------------
1438
- // space
1439
- // ---------------------------------------------------------------------------
1440
-
1441
- /**
1442
- * Arguments for {@linkcode PluginDesignCreateApi.space}.
1443
- *
1444
- * | Property | Type | Description |
1445
- * |---|---|---|
1446
- * | `contour` | {@linkcode ContourHandle} | Bottom footprint (outer + holes) |
1447
- * | `height` | `number` | Extrusion height (Snaptrude units, > 0) |
1448
- * | `label` | `string`? | Room label (maps to the space's `room_type`) |
1449
- * | `position` | {@linkcode Vec3Handle}? | Offset from origin (default origin) |
1450
- * | `spaceType` | {@linkcode PluginSpaceType}? | Space-type classification (default `Room`) |
1451
- * | `massType` | {@linkcode PluginMassType}? | Mass-type classification (default `Room`) |
1452
- * | `departmentId` | {@linkcode PluginDepartmentId}? | Department assignment (default department) |
1453
- * | `storey` | `number`? (int) | Target storey number (default active storey) |
1454
- */
1455
- export const PluginDesignCreateSpaceArgs = z.object({
1456
- contour: ContourHandle,
1457
- height: z.number(),
1458
- label: z.string().optional(),
1459
- position: Vec3Handle.optional(),
1460
- spaceType: PluginSpaceType.optional(),
1461
- massType: PluginMassType.optional(),
1462
- departmentId: PluginDepartmentId.optional(),
1463
- storey: z.number().int().optional(),
1464
- })
1465
- export type PluginDesignCreateSpaceArgs = z.infer<
1466
- typeof PluginDesignCreateSpaceArgs
1467
- >
1468
- // TRANSPORT: positional signature shipped — storey is the trailing 8th arg:
1469
- // space(contour, height, label?, position?, spaceType?, massType?, departmentId?, storey?)
1470
-
1471
- // ---------------------------------------------------------------------------
1472
- // mass
1473
- // ---------------------------------------------------------------------------
1474
-
1475
- /**
1476
- * Arguments for {@linkcode PluginDesignCreateApi.mass}.
1477
- *
1478
- * | Property | Type | Description |
1479
- * |---|---|---|
1480
- * | `contour` | {@linkcode ContourHandle} | Footprint (outer + holes) |
1481
- * | `height` | `number` | Extrusion height (> 0) |
1482
- * | `label` | `string`? | Label (maps to `room_type`) |
1483
- * | `position` | {@linkcode Vec3Handle}? | Offset from origin |
1484
- * | `massType` | {@linkcode PluginMassType}? | Mass type (default `Generic mass`) |
1485
- */
1486
- export const PluginDesignCreateMassArgs = z.object({
1487
- contour: ContourHandle,
1488
- height: z.number(),
1489
- label: z.string().optional(),
1490
- position: Vec3Handle.optional(),
1491
- massType: PluginMassType.optional(),
1492
- })
1493
- export type PluginDesignCreateMassArgs = z.infer<
1494
- typeof PluginDesignCreateMassArgs
1495
- >
1496
-
1497
- // ---------------------------------------------------------------------------
1498
- // massFromBrep
1499
- // ---------------------------------------------------------------------------
1500
-
1501
- /**
1502
- * Arguments for {@linkcode PluginDesignCreateApi.massFromBrep}.
1503
- *
1504
- * | Property | Type | Description |
1505
- * |---|---|---|
1506
- * | `brep` | {@linkcode BrepHandle} | A solid from a `core.geom.create` brep constructor |
1507
- * | `label` | `string`? | Label (maps to `room_type`) |
1508
- */
1509
- export const PluginDesignCreateMassFromBrepArgs = z.object({
1510
- brep: BrepHandle,
1511
- label: z.string().optional(),
1512
- })
1513
- export type PluginDesignCreateMassFromBrepArgs = z.infer<
1514
- typeof PluginDesignCreateMassFromBrepArgs
1515
- >
1516
-
1517
- // ---------------------------------------------------------------------------
1518
- // slab
1519
- // ---------------------------------------------------------------------------
1520
-
1521
- /**
1522
- * Arguments for {@linkcode PluginDesignCreateApi.slab}.
1523
- *
1524
- * | Property | Type | Description |
1525
- * |---|---|---|
1526
- * | `contour` | {@linkcode ContourHandle} | Footprint (outer + holes) |
1527
- * | `thickness` | `number` | Slab thickness (> 0) |
1528
- * | `direction` | `"up" \| "down"`? | Extrusion direction (default `"down"`) |
1529
- * | `slabType` | {@linkcode PluginSlabType}? | Slab-type classification |
1530
- */
1531
- export const PluginDesignCreateSlabArgs = z.object({
1532
- contour: ContourHandle,
1533
- thickness: z.number(),
1534
- direction: z.enum(["up", "down"]).optional(),
1535
- slabType: PluginSlabType.optional(),
1536
- })
1537
- export type PluginDesignCreateSlabArgs = z.infer<
1538
- typeof PluginDesignCreateSlabArgs
1539
- >
1540
-
1541
- // ---------------------------------------------------------------------------
1542
- // floor
1543
- // ---------------------------------------------------------------------------
1544
-
1545
- /**
1546
- * Arguments for {@linkcode PluginDesignCreateApi.floor}.
1547
- *
1548
- * | Property | Type | Description |
1549
- * |---|---|---|
1550
- * | `contour` | {@linkcode ContourHandle} | Footprint (outer + holes) |
1551
- * | `thickness` | `number` | Floor thickness (> 0) |
1552
- * | `position` | {@linkcode Vec3Handle}? | Offset from origin |
1553
- */
1554
- export const PluginDesignCreateFloorArgs = z.object({
1555
- contour: ContourHandle,
1556
- thickness: z.number(),
1557
- position: Vec3Handle.optional(),
1558
- })
1559
- export type PluginDesignCreateFloorArgs = z.infer<
1560
- typeof PluginDesignCreateFloorArgs
1561
- >
1562
-
1563
- // ---------------------------------------------------------------------------
1564
- // roof
1565
- // ---------------------------------------------------------------------------
1566
-
1567
- /**
1568
- * Arguments for {@linkcode PluginDesignCreateApi.roof}.
1569
- *
1570
- * | Property | Type | Description |
1571
- * |---|---|---|
1572
- * | `contour` | {@linkcode ContourHandle} | Footprint (outer + holes) |
1573
- * | `thickness` | `number` | Roof-slab thickness (> 0) |
1574
- */
1575
- export const PluginDesignCreateRoofArgs = z.object({
1576
- contour: ContourHandle,
1577
- thickness: z.number(),
1578
- })
1579
- export type PluginDesignCreateRoofArgs = z.infer<
1580
- typeof PluginDesignCreateRoofArgs
1581
- >
1582
-
1583
- // ---------------------------------------------------------------------------
1584
- // ceiling
1585
- // ---------------------------------------------------------------------------
1586
-
1587
- /**
1588
- * Arguments for {@linkcode PluginDesignCreateApi.ceiling}.
1589
- *
1590
- * | Property | Type | Description |
1591
- * |---|---|---|
1592
- * | `contour` | {@linkcode ContourHandle} | Footprint (outer + holes) |
1593
- * | `thickness` | `number` | Ceiling thickness (> 0) |
1594
- * | `heightFromFloor` | `number`? | Lift above the floor (default 0) |
1595
- */
1596
- export const PluginDesignCreateCeilingArgs = z.object({
1597
- contour: ContourHandle,
1598
- thickness: z.number(),
1599
- heightFromFloor: z.number().optional(),
1600
- })
1601
- export type PluginDesignCreateCeilingArgs = z.infer<
1602
- typeof PluginDesignCreateCeilingArgs
1603
- >
1604
-
1605
- // ---------------------------------------------------------------------------
1606
- // column
1607
- // ---------------------------------------------------------------------------
1608
-
1609
- /**
1610
- * Arguments for {@linkcode PluginDesignCreateApi.column}.
1611
- *
1612
- * | Property | Type | Description |
1613
- * |---|---|---|
1614
- * | `position` | {@linkcode Vec3Handle} | Base point |
1615
- * | `crossSection` | {@linkcode ContourHandle} | Column cross-section footprint |
1616
- * | `height` | `number` | Column height (> 0) |
1617
- * | `directionUp` | {@linkcode Vec3Handle}? | Up axis (default world up) |
1618
- */
1619
- export const PluginDesignCreateColumnArgs = z.object({
1620
- position: Vec3Handle,
1621
- crossSection: ContourHandle,
1622
- height: z.number(),
1623
- directionUp: Vec3Handle.optional(),
1624
- })
1625
- export type PluginDesignCreateColumnArgs = z.infer<
1626
- typeof PluginDesignCreateColumnArgs
1627
- >
1628
-
1629
- // ---------------------------------------------------------------------------
1630
- // beam
1631
- // ---------------------------------------------------------------------------
1632
-
1633
- /**
1634
- * Arguments for {@linkcode PluginDesignCreateApi.beam}.
1635
- *
1636
- * | Property | Type | Description |
1637
- * |---|---|---|
1638
- * | `section` | {@linkcode ContourHandle} | Beam cross-section footprint |
1639
- * | `length` | `number` | Beam length along `direction` (> 0) |
1640
- * | `direction` | {@linkcode Vec3Handle}? | Extrusion axis (default world up) |
1641
- */
1642
- export const PluginDesignCreateBeamArgs = z.object({
1643
- section: ContourHandle,
1644
- length: z.number(),
1645
- direction: Vec3Handle.optional(),
1646
- })
1647
- export type PluginDesignCreateBeamArgs = z.infer<
1648
- typeof PluginDesignCreateBeamArgs
1649
- >
1650
-
1651
- // ---------------------------------------------------------------------------
1652
- // walls
1653
- // ---------------------------------------------------------------------------
1654
-
1655
- /**
1656
- * Arguments for {@linkcode PluginDesignCreateApi.walls}.
1657
- *
1658
- * | Property | Type | Description |
1659
- * |---|---|---|
1660
- * | `profile` | {@linkcode ProfileHandle} | Ordered curve chain (wall centerlines) |
1661
- * | `height` | `number`? | Wall height (default engine default) |
1662
- * | `thickness` | `number`? | Wall thickness (default: `wallType`'s total layer thickness when given, else engine default) |
1663
- * | `wallType` | `string`? | Wall type name from `design.types.list("wall")` — layers/material/thickness defaults (default generic) |
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 |
1666
- */
1667
- export const PluginDesignCreateWallsArgs = z.object({
1668
- profile: ProfileHandle,
1669
- height: z.number().optional(),
1670
- thickness: z.number().optional(),
1671
- wallType: z.string().min(1).optional(),
1672
- storey: z.number().int().optional(),
1673
- topProfiles: z.array(PluginWallTopProfile.nullable()).optional(),
1674
- })
1675
- export type PluginDesignCreateWallsArgs = z.infer<
1676
- typeof PluginDesignCreateWallsArgs
1677
- >
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)[])
1680
-
1681
- // ---------------------------------------------------------------------------
1682
- // staircase
1683
- // ---------------------------------------------------------------------------
1684
-
1685
- /**
1686
- * Arguments for {@linkcode PluginDesignCreateApi.staircase}.
1687
- *
1688
- * | Property | Type | Description |
1689
- * |---|---|---|
1690
- * | `preset` | {@linkcode PluginStaircasePreset} | The parametric preset to generate |
1691
- * | `position` | {@linkcode Vec3Handle} | Placement point |
1692
- * | `label` | `string`? | Optional label |
1693
- * | `structureId` | `string`? | Target structure (default active) |
1694
- * | `level` | `string`? | Target level name (default active/`"01"`) |
1695
- * | `dimensions` | {@linkcode PluginStaircaseDimensions}? | Positive dimension overrides in engine units, applied before creation |
1696
- */
1697
- export const PluginDesignCreateStaircaseArgs = z.object({
1698
- preset: PluginStaircasePreset,
1699
- position: Vec3Handle,
1700
- label: z.string().optional(),
1701
- structureId: z.string().optional(),
1702
- level: z.string().optional(),
1703
- dimensions: PluginStaircaseDimensions.optional(),
1704
- })
1705
- export type PluginDesignCreateStaircaseArgs = z.infer<
1706
- typeof PluginDesignCreateStaircaseArgs
1707
- >
1708
-
1709
- // ---------------------------------------------------------------------------
1710
- // furniture
1711
- // ---------------------------------------------------------------------------
1712
-
1713
- /**
1714
- * Arguments for {@linkcode PluginDesignCreateApi.furniture}.
1715
- *
1716
- * | Property | Type | Description |
1717
- * |---|---|---|
1718
- * | `catalogId` | `string` | Library id: team `_id` or general `fullName` |
1719
- * | `position` | {@linkcode Vec3Handle} | Absolute world placement point |
1720
- * | `label` | `string`? | Instance name (default auto `${name}Ins${n}`) |
1721
- * | `createNewSourceMesh` | `boolean`? | Legacy, kept for compatibility; the host records a catalog source exactly once and this flag cannot skip it |
1722
- * | `angleInDegrees` | `number`? | Rotation about the vertical axis, in degrees (default unrotated) |
1723
- */
1724
- export const PluginDesignCreateFurnitureArgs = z.object({
1725
- catalogId: z.string().min(1),
1726
- position: Vec3Handle,
1727
- label: z.string().optional(),
1728
- createNewSourceMesh: z.boolean().optional(),
1729
- angleInDegrees: z.number().optional(),
1730
- })
1731
- export type PluginDesignCreateFurnitureArgs = z.infer<
1732
- typeof PluginDesignCreateFurnitureArgs
1733
- >
1734
- // TRANSPORT: positional signature shipped — angleInDegrees is the trailing 4th arg:
1735
- // furniture(catalogId: string, position: Vec3Handle, options?: { label?, createNewSourceMesh? }, angleInDegrees?: number)
1736
-
1737
- // ---------------------------------------------------------------------------
1738
- // door
1739
- // ---------------------------------------------------------------------------
1740
-
1741
- /**
1742
- * Arguments for {@linkcode PluginDesignCreateApi.door}.
1743
- *
1744
- * | Property | Type | Description |
1745
- * |---|---|---|
1746
- * | `catalogId` | `string` | Library id: team `_id` or general `fullName` |
1747
- * | `hostWall` | {@linkcode ComponentHandle} | The wall to host the door |
1748
- * | `position` | {@linkcode Vec3Handle} | World point projected onto the wall |
1749
- * | `label` | `string`? | Instance name (optional) |
1750
- * | `facing` | {@linkcode Vec3Handle}? | World point on the side of the wall the door swings open to (default engine-chosen) |
1751
- * | `hinge` | {@linkcode Vec3Handle}? | World point near the jamb the door is hinged on (default the catalog item's authored side) |
1752
- */
1753
- export const PluginDesignCreateDoorArgs = z.object({
1754
- catalogId: z.string().min(1),
1755
- hostWall: ComponentHandle,
1756
- position: Vec3Handle,
1757
- label: z.string().optional(),
1758
- facing: Vec3Handle.optional(),
1759
- hinge: Vec3Handle.optional(),
1760
- })
1761
- export type PluginDesignCreateDoorArgs = z.infer<
1762
- typeof PluginDesignCreateDoorArgs
1763
- >
1764
- // TRANSPORT: positional signature shipped — facing is the trailing 5th arg, hinge rides in options:
1765
- // door(catalogId: string, hostWall: ComponentHandle, position: Vec3Handle, options?: { label?, hinge? }, facing?: Vec3Handle)
1766
-
1767
- // ---------------------------------------------------------------------------
1768
- // window
1769
- // ---------------------------------------------------------------------------
1770
-
1771
- /**
1772
- * Arguments for {@linkcode PluginDesignCreateApi.window}.
1773
- *
1774
- * | Property | Type | Description |
1775
- * |---|---|---|
1776
- * | `catalogId` | `string` | Library id: team `_id` or general `fullName` |
1777
- * | `hostWall` | {@linkcode ComponentHandle} | The wall to host the window |
1778
- * | `position` | {@linkcode Vec3Handle} | World point projected onto the wall |
1779
- * | `label` | `string`? | Instance name (optional) |
1780
- * | `facing` | {@linkcode Vec3Handle}? | World point on the side of the wall the window opens to (default engine-chosen) |
1781
- * | `hinge` | {@linkcode Vec3Handle}? | World point near the jamb the window is hinged on (default the catalog item's authored side) |
1782
- */
1783
- export const PluginDesignCreateWindowArgs = z.object({
1784
- catalogId: z.string().min(1),
1785
- hostWall: ComponentHandle,
1786
- position: Vec3Handle,
1787
- label: z.string().optional(),
1788
- facing: Vec3Handle.optional(),
1789
- hinge: Vec3Handle.optional(),
1790
- })
1791
- export type PluginDesignCreateWindowArgs = z.infer<
1792
- typeof PluginDesignCreateWindowArgs
1793
- >
1794
- // TRANSPORT: positional signature shipped — facing is the trailing 5th arg, hinge rides in options:
1795
- // window(catalogId: string, hostWall: ComponentHandle, position: Vec3Handle, options?: { label?, hinge? }, facing?: Vec3Handle)
1796
-
1797
- // ---------------------------------------------------------------------------
1798
- // opening
1799
- // ---------------------------------------------------------------------------
1800
-
1801
- /**
1802
- * Options for {@linkcode PluginDesignCreateApi.opening}, discriminated by
1803
- * `kind`. Width and height are positive Snaptrude engine-unit values.
1804
- * `sillHeight` is available only for windows, is nonnegative, and is precisely
1805
- * the distance from the host wall base to the bottom of the window.
1806
- */
1807
- export const PluginDesignCreateOpeningOptions = z.discriminatedUnion("kind", [
1808
- z
1809
- .object({
1810
- kind: z.literal("door"),
1811
- ...PluginOpeningBaseOptions,
1812
- })
1813
- .strict(),
1814
- z
1815
- .object({
1816
- kind: z.literal("window"),
1817
- ...PluginOpeningBaseOptions,
1818
- sillHeight: z.number().finite().nonnegative().optional(),
1819
- })
1820
- .strict(),
1821
- ])
1822
- export type PluginDesignCreateOpeningOptions = z.infer<
1823
- typeof PluginDesignCreateOpeningOptions
1824
- >
1825
-
1826
- // ---------------------------------------------------------------------------
1827
- // smartLayout
1828
- // ---------------------------------------------------------------------------
1829
-
1830
- /**
1831
- * Arguments for {@linkcode PluginDesignCreateApi.smartLayout}. Provide **exactly
1832
- * one** template source: `templateGroup` or a non-empty `templateComponents`.
1833
- *
1834
- * | Property | Type | Description |
1835
- * |---|---|---|
1836
- * | `templateGroup` | `string`? | Id of the group to clone as the template (a group id from `snaptrude.core.groups.list`, NOT a component handle) |
1837
- * | `templateComponents` | {@linkcode ComponentHandle}`[]`? | Explicit component set to clone as the template |
1838
- * | `targets` | {@linkcode ComponentHandle}`[]` | ROOM/DEPARTMENT spaces to place into (≥1) |
1839
- * | `hideTargets` | `boolean`? | Hide the target spaces after placement (default `true`) |
1840
- */
1841
- export const PluginSmartLayoutArgs = z
1842
- .object({
1843
- templateGroup: z.string().min(1).optional(),
1844
- templateComponents: z.array(ComponentHandle).optional(),
1845
- targets: z.array(ComponentHandle).min(1),
1846
- hideTargets: z.boolean().optional(),
1847
- })
1848
- .refine(
1849
- (v) =>
1850
- (v.templateGroup != null) !== (v.templateComponents?.length ?? 0) > 0,
1851
- {
1852
- message:
1853
- "Provide exactly one template source: templateGroup or a non-empty templateComponents",
1854
- },
1855
- )
1856
- export type PluginSmartLayoutArgs = z.infer<typeof PluginSmartLayoutArgs>
1857
-
1858
- /**
1859
- * Result of {@linkcode PluginDesignCreateApi.smartLayout} — the entities the run
1860
- * created, grouped by kind (flat across all targets; see the method JSDoc for why
1861
- * this is not attributed per target).
1862
- *
1863
- * | Property | Type | Description |
1864
- * |---|---|---|
1865
- * | `created.walls` | {@linkcode ComponentHandle}`[]` | Created walls |
1866
- * | `created.furniture` | {@linkcode ComponentHandle}`[]` | Created furniture |
1867
- * | `created.doors` | {@linkcode ComponentHandle}`[]` | Created doors |
1868
- * | `created.windows` | {@linkcode ComponentHandle}`[]` | Created windows |
1869
- * | `created.floors` | {@linkcode ComponentHandle}`[]` | Created floors |
1870
- * | `skippedWalls` | `number` | Walls the interior optimizer could not place |
1871
- */
1872
- export const PluginSmartLayoutResult = z.object({
1873
- created: z.object({
1874
- walls: z.array(ComponentHandle),
1875
- furniture: z.array(ComponentHandle),
1876
- doors: z.array(ComponentHandle),
1877
- windows: z.array(ComponentHandle),
1878
- floors: z.array(ComponentHandle),
1879
- }),
1880
- skippedWalls: z.number(),
1881
- })
1882
- export type PluginSmartLayoutResult = z.infer<typeof PluginSmartLayoutResult>
1883
-
1884
- // ---------------------------------------------------------------------------
1885
- // referenceLines
1886
- // ---------------------------------------------------------------------------
1887
-
1888
- /**
1889
- * Arguments for {@linkcode PluginDesignCreateApi.referenceLines}.
1890
- *
1891
- * | Property | Type | Description |
1892
- * |---|---|---|
1893
- * | `profile` | {@linkcode ProfileHandle} | Ordered curve chain (centerlines) |
1894
- * | `color` | `string`? | Hex color `"#RRGGBB"` (default white) |
1895
- * | `thickness` | `number`? | Line thickness (default 1) |
1896
- * | `style` | {@linkcode PluginReferenceLineStyle}? | Line style (default `SOLID`) |
1897
- * | `gridTag` | `string`? | Grid tag label (default `"A"`) |
1898
- */
1899
- export const PluginDesignCreateReferenceLinesArgs = z.object({
1900
- profile: ProfileHandle,
1901
- color: z.string().optional(),
1902
- thickness: z.number().optional(),
1903
- style: PluginReferenceLineStyle.optional(),
1904
- gridTag: z.string().optional(),
1905
- })
1906
- export type PluginDesignCreateReferenceLinesArgs = z.infer<
1907
- typeof PluginDesignCreateReferenceLinesArgs
1908
- >
1909
-
1910
- // ---------------------------------------------------------------------------
1911
- // copy
1912
- // ---------------------------------------------------------------------------
1913
-
1914
- /**
1915
- * Copy mode for {@linkcode PluginDesignCreateApi.copy}.
1916
- *
1917
- * | Value | Description |
1918
- * |---|---|
1919
- * | `"instance"` | Keep copies in the source's instance family where possible |
1920
- * | `"unique"` | Independent geometry copies |
1921
- */
1922
- export const PluginCopyMode = z.enum(["instance", "unique"])
1923
- export type PluginCopyMode = z.infer<typeof PluginCopyMode>
1924
-
1925
- /**
1926
- * Arguments for {@linkcode PluginDesignCreateApi.copy} (options flattened).
1927
- *
1928
- * | Property | Type | Description |
1929
- * |---|---|---|
1930
- * | `components` | {@linkcode ComponentHandle}`[]` | Entities to copy (≥1) |
1931
- * | `displacement` | {@linkcode Vec3Handle} | Per-copy offset (copy `i` at `displacement * i`) |
1932
- * | `count` | `number`? | Copies per component (default 1) |
1933
- * | `mode` | {@linkcode PluginCopyMode}? | `"instance"` (default) or `"unique"` |
1934
- */
1935
- export const PluginDesignCreateCopyArgs = z.object({
1936
- components: z.array(ComponentHandle).min(1),
1937
- displacement: Vec3Handle,
1938
- count: z.number().int().positive().optional(),
1939
- mode: PluginCopyMode.optional(),
1940
- })
1941
- export type PluginDesignCreateCopyArgs = z.infer<
1942
- typeof PluginDesignCreateCopyArgs
1943
- >
1944
- // TRANSPORT: positional signature shipped —
1945
- // copy(components: ComponentHandle[], displacement: Vec3Handle, options?: { count?, mode? })
1946
-
1947
- // ---------------------------------------------------------------------------
1948
- // spaces (bulk)
1949
- // ---------------------------------------------------------------------------
1950
-
1951
- /**
1952
- * One space to create via {@linkcode PluginDesignCreateApi.spaces} — the same
1953
- * footprint-extrude inputs as {@linkcode PluginDesignCreateApi.space}.
1954
- *
1955
- * | Property | Type | Description |
1956
- * |---|---|---|
1957
- * | `contour` | {@linkcode ContourHandle} | Footprint (outer profile + holes) |
1958
- * | `height` | `number` | Extrude height |
1959
- * | `label` | `string`? | Room label |
1960
- * | `position` | {@linkcode Vec3Handle}? | Placement offset |
1961
- * | `spaceType` | `PluginSpaceType`? | Space type |
1962
- * | `massType` | `PluginMassType`? | Mass type |
1963
- * | `departmentId` | `PluginDepartmentId`? | Department |
1964
- * | `storey` | `number`? (int) | Target storey number (default active storey) |
1965
- */
1966
- export const PluginCreateSpaceItem = z.object({
1967
- contour: ContourHandle,
1968
- height: z.number(),
1969
- label: z.string().optional(),
1970
- position: Vec3Handle.optional(),
1971
- spaceType: PluginSpaceType.optional(),
1972
- massType: PluginMassType.optional(),
1973
- departmentId: PluginDepartmentId.optional(),
1974
- storey: z.number().int().optional(),
1975
- })
1976
- export type PluginCreateSpaceItem = z.infer<typeof PluginCreateSpaceItem>
1977
-
1978
- export * from "./opening-fields"
1979
- export * from "./bulk-items"
1980
- export * from "./grids"
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+ import {
4
+ BrepHandle,
5
+ ComponentHandle,
6
+ ContourHandle,
7
+ LineHandle,
8
+ CurveHandle,
9
+ ProfileHandle,
10
+ Vec3Handle,
11
+ } from "../../../handles"
12
+ import { PluginGridStyleOptions } from "./grids"
13
+ import {
14
+ PluginSpaceType,
15
+ PluginMassType,
16
+ PluginDepartmentId,
17
+ } from "../../entity/space"
18
+ import {
19
+ PluginBuildableEnvelopePolygonVertex,
20
+ PluginBuildableEnvelopeSetbackTier,
21
+ PluginBuildableEnvelopeVerticalCap,
22
+ PluginBuildableEnvelopeCreateResult,
23
+ } from "../../entity/buildableEnvelope"
24
+ import { PluginOpeningBaseOptions } from "./opening-fields"
25
+ import type {
26
+ PluginCreateDoorItem,
27
+ PluginCreateFloorItem,
28
+ PluginCreateFurnitureItem,
29
+ PluginCreateVoidItem,
30
+ PluginCreateWallRunItem,
31
+ PluginCreateWindowItem,
32
+ } from "./bulk-items"
33
+ import { PluginWallTopProfile } from "./bulk-items"
34
+ import { PluginWallType } from "../types"
35
+ import {
36
+ PluginFamilyPlacement,
37
+ PluginFamilyFloorOptions,
38
+ PluginFamilySlabOptions,
39
+ PluginFamilyCeilingOptions,
40
+ PluginFamilyValues,
41
+ } from "../catalog"
42
+
43
+ /**
44
+ * `design.create.*` — author new scene-committed BIM entities.
45
+ *
46
+ * Every creator takes geometry handles + scalars and returns a
47
+ * {@linkcode ComponentHandle} (or `ComponentHandle[]` for plural creators;
48
+ * `wallRuns` returns one `ComponentHandle[]` per run) — the
49
+ * `Component.id` of the created entity, resolvable across the rest of the
50
+ * `design.*` surface. Creation is an undoable host call; it **throws** on failure
51
+ * (no `Result` wrapper — consistent with `core.geom.create.*`).
52
+ *
53
+ * Footprint objects take a {@linkcode ContourHandle} (outer profile + holes);
54
+ * build one with `snaptrude.core.geom.create.contourFromProfile(s)`.
55
+ *
56
+ * Family overloads take `{ type, values? }` from `design.catalog`. The family supplies
57
+ * construction; the contour or axis supplies instance geometry. Geometry uses SU,
58
+ * while family length overrides use mm and angles use degrees. Omitted parameters
59
+ * retain family defaults; shared/type, formula and geometry-bound overrides are refused.
60
+ * Placement never publishes a definition. Unsupported references or geometry fail before mutation.
61
+ *
62
+ * `door`/`window` place a parametric family into a host wall (the world point is
63
+ * projected onto the wall face to locate the opening; the wall is re-cut in one
64
+ * undo entry) and throw if the point projects outside the wall. Voids
65
+ * (`void`/`voids`) are the third hosted child: holes through slabs, floors,
66
+ * roofs and ceilings. `smartLayout` is
67
+ * the one creator returning a grouped {@linkcode PluginSmartLayoutResult} rather
68
+ * than a handle — it clones an in-scene template into one or more target spaces,
69
+ * merging every target into a single undo batch (see its JSDoc).
70
+ *
71
+ * Accessed via `snaptrude.design.create`.
72
+ */
73
+ export abstract class PluginDesignCreateApi {
74
+ constructor() {}
75
+
76
+ /**
77
+ * Create a **space** (a room / mass) by extruding a footprint contour upward.
78
+ *
79
+ * The `contour` is the bottom footprint (outer profile + optional holes); it
80
+ * is extruded by `height` along +Y. The space is placed on the active story
81
+ * and assigned a default department unless overridden.
82
+ *
83
+ * @param contour - Bottom footprint (outer + holes)
84
+ * @param height - Extrusion height (Snaptrude units, > 0)
85
+ * @param label - Room label (maps to the space's `room_type`)
86
+ * @param position - Offset from origin (default origin)
87
+ * @param spaceType - Space-type classification (default `Room`)
88
+ * @param massType - Mass-type classification (default `Room`)
89
+ * @param departmentId - Department assignment (default department)
90
+ * @param storey - Target storey number to place the space on — the same integer
91
+ * `entity.story` uses (`1` ground, `2` first floor, `-1` basement). Default:
92
+ * the active storey. Folds a `core.storeys.setActive` call into the create,
93
+ * placing the space at that storey's floor elevation (any `position` offset is
94
+ * applied on top). Throws if no storey has that value.
95
+ * @returns the {@linkcode ComponentHandle} of the created space
96
+ * @throws if the contour is invalid, the height is not positive, or the target
97
+ * storey does not exist
98
+ *
99
+ * @examplePrompt Create a room called Living Room that's 3m tall from this outline
100
+ * @examplePrompt Add a new space on the current storey using this footprint
101
+ * @examplePrompt Make a bedroom here and assign it to the Residential department
102
+ * @examplePrompt Extrude this closed outline into a 10 foot high room
103
+ * @examplePrompt Can you create a Kitchen space from the sketch I just drew?
104
+ * @examplePrompt Create a bedroom on the second floor from this outline
105
+ *
106
+ * @performance For MORE THAN ONE space, call `design.create.spaces(items[])` — the whole
107
+ * batch is one host round-trip. Looping this single-space creator is N round-trips (slow,
108
+ * and a large loop can trip the plugin rate limit).
109
+ *
110
+ * # Example
111
+ * ```ts
112
+ * const v = snaptrude.core.math.vec3
113
+ * const outer = await snaptrude.core.geom.create.profileFromLinePoints([
114
+ * await v.new(0, 0, 0),
115
+ * await v.new(10, 0, 0),
116
+ * await v.new(10, 0, 8),
117
+ * await v.new(0, 0, 8),
118
+ * ])
119
+ * const contour = await snaptrude.core.geom.create.contourFromProfile(outer)
120
+ * const space = await snaptrude.design.create.space(contour, 3, "Living")
121
+ * // …place one directly on the second floor (no setActive dance):
122
+ * const upstairs = await snaptrude.design.create.space(
123
+ * contour, 3, "Bedroom", undefined, undefined, undefined, undefined, 2,
124
+ * )
125
+ * ```
126
+ */
127
+ public abstract space(
128
+ contour: ContourHandle,
129
+ height: number,
130
+ label?: string,
131
+ position?: Vec3Handle,
132
+ spaceType?: PluginSpaceType,
133
+ massType?: PluginMassType,
134
+ departmentId?: PluginDepartmentId,
135
+ storey?: number,
136
+ ): PluginApiReturn<ComponentHandle>
137
+
138
+ /**
139
+ * Create a **mass** — a generic extruded prism (default `massType` "Generic mass").
140
+ * Same footprint-extrude path as {@linkcode PluginDesignCreateApi.space}.
141
+ *
142
+ * @param contour - Footprint (outer + holes)
143
+ * @param height - Extrusion height (> 0)
144
+ * @param label - Label (maps to `room_type`)
145
+ * @param position - Offset from origin
146
+ * @param massType - Mass type (default `Generic mass`)
147
+ * @returns the {@linkcode ComponentHandle} of the created mass
148
+ * @throws if the contour is invalid or the height is not positive
149
+ *
150
+ * @examplePrompt Create a generic mass 30m tall from this footprint
151
+ * @examplePrompt Block out a conceptual massing volume for the site
152
+ * @examplePrompt Extrude this shape into a building mass
153
+ * @examplePrompt Add a simple study-model volume at the origin
154
+ *
155
+ * # Example
156
+ * ```ts
157
+ * const rect = await snaptrude.core.geom.create.profileRect(20, 15)
158
+ * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
159
+ * const tower = await snaptrude.design.create.mass(contour, 30, "Tower A", undefined, "Building")
160
+ * ```
161
+ */
162
+ public abstract mass(
163
+ contour: ContourHandle,
164
+ height: number,
165
+ label?: string,
166
+ position?: Vec3Handle,
167
+ massType?: PluginMassType,
168
+ ): PluginApiReturn<ComponentHandle>
169
+
170
+ /**
171
+ * Create a **mass** from a custom solid built with a `core.geom.create` brep
172
+ * constructor (`brepFromFaces`, `brepFromExtrusion`, `brepFromLoft`,
173
+ * `brepFromMesh`, or a brep boolean) — the free-form counterpart of
174
+ * {@linkcode PluginDesignCreateApi.mass}, for solids that are not simple
175
+ * footprint extrusions (pyramids, wedges, faceted volumes).
176
+ *
177
+ * Only accepts breps **minted by a `core.geom.create` brep constructor** —
178
+ * scene-derived breps from `design.query.geometry.getBrep` are read-only and
179
+ * throw. The mass is created as a generic mass (`massType` "Generic mass") at
180
+ * the exact coordinates the solid was authored in, committed as a single
181
+ * undo step, and synced to collaborators like any other creator.
182
+ *
183
+ * @param brep - A solid from a `core.geom.create` brep constructor
184
+ * @param label - Label (maps to `room_type`)
185
+ * @returns the {@linkcode ComponentHandle} of the created mass
186
+ * @throws if the brep handle is invalid, or the brep was not created by a
187
+ * `core.geom.create` brep constructor
188
+ *
189
+ * @examplePrompt Create a mass from these faces
190
+ * @examplePrompt Turn this custom brep into a scene mass
191
+ * @examplePrompt Add a pyramid-shaped mass to the model
192
+ *
193
+ * # Example
194
+ * ```ts
195
+ * const apex = { x: 0, y: 4, z: 0 }
196
+ * const a = { x: -2, y: 0, z: -2 }
197
+ * const b = { x: 2, y: 0, z: -2 }
198
+ * const c = { x: 2, y: 0, z: 2 }
199
+ * const d = { x: -2, y: 0, z: 2 }
200
+ * const brep = await snaptrude.core.geom.create.brepFromFaces([
201
+ * [a, d, c, b],
202
+ * [a, b, apex],
203
+ * [b, c, apex],
204
+ * [c, d, apex],
205
+ * [d, a, apex],
206
+ * ])
207
+ * const pyramid = await snaptrude.design.create.massFromBrep(brep, "Pavilion")
208
+ * ```
209
+ */
210
+ public abstract massFromBrep(
211
+ brep: BrepHandle,
212
+ label?: string,
213
+ ): PluginApiReturn<ComponentHandle>
214
+
215
+ /**
216
+ * Create a **slab** by extruding a footprint contour by `thickness`
217
+ * (default direction: down).
218
+ *
219
+ * To cut a hole in an EXISTING one, use `design.create.void`; a contour hole
220
+ * here is baked into the footprint.
221
+ *
222
+ * @param contour - Footprint (outer + holes)
223
+ * @param thickness - Slab thickness (> 0)
224
+ * @param direction - Extrusion direction (default `"down"`)
225
+ * @param slabType - Slab-type classification
226
+ * @returns the {@linkcode ComponentHandle} of the created slab
227
+ * @throws if the contour is invalid or the thickness is not positive
228
+ *
229
+ * @examplePrompt Add a 150mm thick slab under this footprint
230
+ * @examplePrompt Create a floor slab from this outline
231
+ * @examplePrompt Pour a plinth slab over the building footprint
232
+ * @examplePrompt Make a basement slab that extrudes downward
233
+ * @examplePrompt Give this room outline a 6 inch slab
234
+ *
235
+ * # Example
236
+ * ```ts
237
+ * const rect = await snaptrude.core.geom.create.profileRect(12, 10)
238
+ * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
239
+ * const slab = await snaptrude.design.create.slab(contour, 0.15, "down", "Plinth")
240
+ * ```
241
+ */
242
+ public abstract slab(
243
+ ...args:
244
+ | [
245
+ contour: ContourHandle,
246
+ thickness: number,
247
+ direction?: "up" | "down",
248
+ slabType?: PluginSlabType,
249
+ ]
250
+ | [contour: ContourHandle, options: PluginFamilySlabOptions]
251
+ ): PluginApiReturn<ComponentHandle>
252
+
253
+ /**
254
+ * Create a **floor** by extruding a footprint contour by `thickness`
255
+ * (extruded upward).
256
+ *
257
+ * The native family overload takes `{ type, values?, position? }`. Contour
258
+ * geometry uses SU; family values use mm. The family supplies layer thickness.
259
+ * PG2 can split or merge the footprint, so both overloads return an array.
260
+ * A merge into an existing floor can return no newly created handles.
261
+ *
262
+ * To cut a hole in an EXISTING one, use `design.create.void`; a contour hole
263
+ * here is baked into the footprint.
264
+ *
265
+ * @param contour - Footprint (outer + holes)
266
+ * @param thickness - Floor thickness (> 0)
267
+ * @param position - Offset from origin
268
+ * @returns Newly created {@linkcode ComponentHandle}s; an empty array after a merge
269
+ * @throws if the contour is invalid or the thickness is not positive
270
+ *
271
+ * @examplePrompt Create a floor from this room outline
272
+ * @examplePrompt Add a 100mm thick floor over the footprint
273
+ * @examplePrompt Lay flooring across the selected outline
274
+ * @examplePrompt Put a floor at this position with 150mm thickness
275
+ *
276
+ * # Example
277
+ * ```ts
278
+ * const rect = await snaptrude.core.geom.create.profileRect(5, 4)
279
+ * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
280
+ * const floor = await snaptrude.design.create.floor(contour, 0.1)
281
+ * ```
282
+ *
283
+ * @performance For dimensional floors, `design.create.floors(items[])` uses one
284
+ * host round-trip and one undo entry. That bulk method does not accept native
285
+ * family options; use this method for a family-backed floor.
286
+ */
287
+ public abstract floor(
288
+ ...args:
289
+ | [contour: ContourHandle, thickness: number, position?: Vec3Handle]
290
+ | [contour: ContourHandle, options: PluginFamilyFloorOptions]
291
+ ): PluginApiReturn<ComponentHandle[]>
292
+
293
+ /**
294
+ * Create **many floors** in one undoable operation (bulk plural of
295
+ * {@linkcode floor}). Each item extrudes its own footprint contour (outer
296
+ * profile + holes) upward by its own `thickness`, at its own optional
297
+ * position offset. Validate-all-or-throw; one command.
298
+ *
299
+ * @param items - One {@linkcode PluginCreateFloorItem} per floor to create
300
+ * (≥1, ≤1000)
301
+ * @returns the created floors as {@linkcode ComponentHandle}`[]`, in input order
302
+ * @throws `VALIDATION` if the items fail the schema (empty array, more than
303
+ * 1000 items, a non-positive thickness) or a contour is degenerate;
304
+ * `HANDLE_INVALID` if a `contour` or `position` handle is unknown or
305
+ * released; `OPERATION_FAILED` if extrusion fails (nothing is created —
306
+ * `details.itemIndex` is the failing item); `METHOD_NOT_PERMITTED` if the
307
+ * plugin may not write.
308
+ *
309
+ * @examplePrompt Create floors for all these room outlines at once
310
+ * @examplePrompt Add a floor to every space in one operation
311
+ * @examplePrompt Bulk create the floor plates for this building
312
+ * @examplePrompt Lay 100mm floors across these five footprints in one undo step
313
+ * @examplePrompt Create the ground and first floor slabs together
314
+ *
315
+ * @performance Bulk creator — the whole batch is ONE host round-trip and ONE undo
316
+ * entry. Always prefer this over calling `design.create.floor` in a loop: build the
317
+ * full `items[]` array first (all contours and offsets up front), then make one call.
318
+ *
319
+ * # Example
320
+ * ```ts
321
+ * const rect = await snaptrude.core.geom.create.profileRect(5, 4)
322
+ * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
323
+ * const [ground, upper] = await snaptrude.design.create.floors([
324
+ * { contour, thickness: 0.1 },
325
+ * { contour, thickness: 0.1, position: await snaptrude.core.math.vec3.new(0, 3, 0) },
326
+ * ])
327
+ * ```
328
+ */
329
+ public abstract floors(
330
+ items: PluginCreateFloorItem[],
331
+ ): PluginApiReturn<ComponentHandle[]>
332
+
333
+ /**
334
+ * Create a **roof** by extruding a footprint contour by `thickness`. Created
335
+ * flat (extruded downward); pitch/slope is a separate post-creation edit.
336
+ *
337
+ * To cut a hole in an EXISTING one, use `design.create.void`; a contour hole
338
+ * here is baked into the footprint.
339
+ *
340
+ * @param contour - Footprint (outer + holes)
341
+ * @param thickness - Roof-slab thickness (> 0)
342
+ * @returns the {@linkcode ComponentHandle} of the created roof
343
+ * @throws if the contour is invalid or the thickness is not positive
344
+ *
345
+ * @examplePrompt Add a flat roof over the building footprint
346
+ * @examplePrompt Create a roof 200mm thick from this outline
347
+ * @examplePrompt Cover the top storey with a roof slab
348
+ * @examplePrompt Put a roof on this building
349
+ *
350
+ * # Example
351
+ * ```ts
352
+ * const rect = await snaptrude.core.geom.create.profileRect(12, 10)
353
+ * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
354
+ * const roof = await snaptrude.design.create.roof(contour, 0.2)
355
+ * ```
356
+ */
357
+ public abstract roof(
358
+ contour: ContourHandle,
359
+ thickness: number | PluginFamilyPlacement,
360
+ ): PluginApiReturn<ComponentHandle>
361
+
362
+ /**
363
+ * Create a **ceiling** by extruding a footprint contour by `thickness`, lifted
364
+ * `heightFromFloor` above the floor.
365
+ *
366
+ * To cut a hole in an EXISTING one, use `design.create.void`; a contour hole
367
+ * here is baked into the footprint.
368
+ *
369
+ * @param contour - Footprint (outer + holes)
370
+ * @param thickness - Ceiling thickness (> 0)
371
+ * @param heightFromFloor - Lift above the floor (default 0)
372
+ * @returns the {@linkcode ComponentHandle} of the created ceiling
373
+ * @throws if the contour is invalid or the thickness is not positive
374
+ *
375
+ * @examplePrompt Add a false ceiling 2.7m above the floor
376
+ * @examplePrompt Create a ceiling over this room footprint
377
+ * @examplePrompt Put a dropped ceiling in the living room at 3 metres
378
+ * @examplePrompt Add a 50mm thick ceiling lifted 2800mm from floor level
379
+ *
380
+ * # Example
381
+ * ```ts
382
+ * const rect = await snaptrude.core.geom.create.profileRect(5, 4)
383
+ * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
384
+ * const ceiling = await snaptrude.design.create.ceiling(contour, 0.05, 2.8)
385
+ * ```
386
+ */
387
+ public abstract ceiling(
388
+ ...args:
389
+ | [contour: ContourHandle, thickness: number, heightFromFloor?: number]
390
+ | [contour: ContourHandle, options: PluginFamilyCeilingOptions]
391
+ ): PluginApiReturn<ComponentHandle>
392
+
393
+ /**
394
+ * Create a **column** by extruding a cross-section contour upward by `height`
395
+ * from a base `position`. The column is built to EXACTLY `height` — unlike
396
+ * the interactive draw tool, no slab-thickness deduction is applied.
397
+ *
398
+ * @param position - Base point
399
+ * @param crossSection - Column cross-section footprint
400
+ * @param height - Column height (> 0), built exactly
401
+ * @param directionUp - Up axis (default world up); normalized by the host, so
402
+ * magnitude does not scale the height
403
+ * @returns the {@linkcode ComponentHandle} of the created column
404
+ * @throws if the cross-section is invalid, the height is not positive, or the
405
+ * direction is zero / lies in the cross-section plane (degenerate extrusion)
406
+ *
407
+ * @examplePrompt Add a 3m tall column at this point
408
+ * @examplePrompt Place a column at the grid intersection
409
+ * @examplePrompt Create a 450mm square concrete column 4 metres high
410
+ * @examplePrompt Stand a column up from this base point
411
+ *
412
+ * # Example
413
+ * ```ts
414
+ * const rect = await snaptrude.core.geom.create.profileRect(0.45, 0.45)
415
+ * const crossSection = await snaptrude.core.geom.create.contourFromProfile(rect)
416
+ * const base = await snaptrude.core.math.vec3.new(4, 0, 4)
417
+ * const column = await snaptrude.design.create.column(base, crossSection, 3)
418
+ * ```
419
+ */
420
+ public abstract column(
421
+ ...args:
422
+ | [
423
+ position: Vec3Handle,
424
+ crossSection: ContourHandle,
425
+ height: number,
426
+ directionUp?: Vec3Handle,
427
+ ]
428
+ | [axis: LineHandle, options: PluginFamilyPlacement]
429
+ ): PluginApiReturn<ComponentHandle>
430
+
431
+ /**
432
+ * Create a **beam** by extruding a cross-section contour along `direction` by
433
+ * `length`. Matches the Snaptrude beam tool's semantics: the beam body hangs
434
+ * BELOW the plane the section is authored on.
435
+ *
436
+ * For a **horizontal** `direction` (the common spanning beam), author the
437
+ * section as an axis-aligned plan rectangle: its X extent is the beam's
438
+ * width, its Z extent is the beam's depth (the vertical drop). The beam runs
439
+ * `length` along `direction` starting at the section's centre, hanging below
440
+ * the authoring plane by its depth — exactly like an interactively drawn
441
+ * beam. Only axis-aligned rectangular sections are supported horizontally.
442
+ *
443
+ * For a **vertical** `direction` (the default), the section itself is
444
+ * extruded by `length`, again hanging below the authoring plane. Diagonal
445
+ * directions are rejected.
446
+ *
447
+ * @param section - Beam cross-section, an axis-aligned rectangle in plan
448
+ * (X extent = width, Z extent = depth)
449
+ * @param length - Beam length along `direction` (> 0); direction is
450
+ * normalized by the host, so magnitude does not scale the length
451
+ * @param direction - Beam axis: horizontal for a spanning beam, or vertical
452
+ * (default world up). Diagonal directions throw.
453
+ * @returns the {@linkcode ComponentHandle} of the created beam
454
+ * @throws if the section is invalid (horizontal beams: not an axis-aligned
455
+ * plan rectangle), the length is not positive, or the direction is zero or
456
+ * diagonal
457
+ *
458
+ * @examplePrompt Add a beam spanning 6 metres between the columns
459
+ * @examplePrompt Create a horizontal beam along the X axis
460
+ * @examplePrompt Run a 300x600 beam across the room
461
+ * @examplePrompt Extrude this cross-section into a 5m long beam
462
+ *
463
+ * # Example
464
+ * ```ts
465
+ * const rect = await snaptrude.core.geom.create.profileRect(0.3, 0.6)
466
+ * const section = await snaptrude.core.geom.create.contourFromProfile(rect)
467
+ * const alongX = await snaptrude.core.math.vec3.new(1, 0, 0)
468
+ * const beam = await snaptrude.design.create.beam(section, 6, alongX)
469
+ * ```
470
+ */
471
+ public abstract beam(
472
+ ...args:
473
+ | [section: ContourHandle, length: number, direction?: Vec3Handle]
474
+ | [axis: LineHandle, options: PluginFamilyPlacement]
475
+ ): PluginApiReturn<ComponentHandle>
476
+
477
+ /**
478
+ * Create a connected run of **walls** from a profile — one wall per curve in
479
+ * the profile's chain, with mitred corners at shared endpoints.
480
+ *
481
+ * @param profile - Ordered curve chain (wall centerlines)
482
+ * @param height - Wall height (default engine default)
483
+ * @param thickness - Wall thickness (default: the `wallType`'s total layer
484
+ * thickness when `wallType` is given, else the engine default)
485
+ * @param wallType - Legacy label/`wall:` id, or the exact `nativeFamily`
486
+ * `{ id, version }` pin from `design.types.list("wall")`. Native pins are
487
+ * authorized on every use; selecting a family in Draw is not registration.
488
+ * Native pins support straight horizontal centerlines and flat tops only.
489
+ * Omit thickness for native pins; a conflicting explicit thickness rejects.
490
+ * Default: the engine's generic wall.
491
+ * @param storey - Target storey (integer: `1` ground, `2` first floor, `-1`
492
+ * basement — same convention as `design.create.space`). The walls are
493
+ * assigned to it and lifted to its base elevation, all inside the same
494
+ * single undo entry. The storey must already exist
495
+ * (`core.storeys.create` first). Default: geometry-derived — a profile
496
+ * drawn at y = 0 lands on storey 1; the ACTIVE storey is NOT consulted.
497
+ * @param topProfiles - Optional top edge per curve of `profile` (same order):
498
+ * a {@linkcode PluginWallTopProfile} makes that wall raked / gabled; `null`
499
+ * or a missing entry keeps it flat at `height`. Straight curves only. Such
500
+ * walls are non-parametric (see {@linkcode PluginWallTopProfile}).
501
+ * @returns a {@linkcode ComponentHandle}`[]` (one per wall), in profile order
502
+ * @throws if the profile is empty, `wallType` names no wall type in the
503
+ * project, `storey` does not exist, `topProfiles` has more entries than the
504
+ * profile has curves or names an arc curve, a top profile drops to the wall
505
+ * base at a mitred corner, or wall creation fails
506
+ *
507
+ * @examplePrompt Draw walls along this centerline
508
+ * @examplePrompt Create 3m high, 200mm thick walls from these points
509
+ * @examplePrompt Build a wall run around the room outline
510
+ * @examplePrompt Turn this polyline sketch into walls
511
+ * @examplePrompt Add walls with mitred corners along the path
512
+ * @examplePrompt Draw brick walls with plaster along this outline
513
+ * @examplePrompt Build the perimeter in exposed concrete walls
514
+ * @examplePrompt Create a raked wall that slopes from 3m to 5m
515
+ * @examplePrompt Build a gable end wall with the ridge in the middle
516
+ * @examplePrompt Draw a wall with a sloped top edge
517
+ *
518
+ * # Example
519
+ * ```ts
520
+ * const v = snaptrude.core.math.vec3
521
+ * const centerlines = await snaptrude.core.geom.create.profileFromLinePoints([
522
+ * await v.new(0, 0, 0),
523
+ * await v.new(8, 0, 0),
524
+ * await v.new(8, 0, 6),
525
+ * ])
526
+ * const walls = await snaptrude.design.create.walls(centerlines, 3, 0.2)
527
+ * // …built as a specific wall type (layers/material/thickness from the type):
528
+ * const [brick] = await snaptrude.design.types.list("wall")
529
+ * const brickWalls = await snaptrude.design.create.walls(
530
+ * centerlines, 3, undefined, brick.label,
531
+ * )
532
+ * // …a raked wall (3m at the start, 5m at the end) on a single centerline:
533
+ * const run = await snaptrude.core.geom.create.profileFromCurves([
534
+ * await snaptrude.core.geom.create.line(await v.new(0, 0, 10), await v.new(8, 0, 10)),
535
+ * ])
536
+ * const [raked] = await snaptrude.design.create.walls(run, undefined, 0.2, undefined, undefined, [
537
+ * [{ along: 0, height: 3 }, { along: 1, height: 5 }],
538
+ * ])
539
+ * ```
540
+ *
541
+ * @performance For MORE THAN ONE run, call `design.create.wallRuns(items[])` — one
542
+ * host round-trip and ONE undo entry for every run in the batch. Looping this
543
+ * single-run creator is N round-trips and N undo entries.
544
+ */
545
+ public abstract walls(
546
+ profile: ProfileHandle,
547
+ height?: number,
548
+ thickness?: number,
549
+ wallType?: PluginWallType,
550
+ storey?: number,
551
+ topProfiles?: (PluginWallTopProfile | null)[],
552
+ values?: PluginFamilyValues,
553
+ ): PluginApiReturn<ComponentHandle[]>
554
+
555
+ /**
556
+ * Create **many wall runs** in one undoable operation (bulk plural of
557
+ * {@linkcode walls}). Each item is one full run — a wall per curve in that
558
+ * item's profile chain, mitred at shared endpoints. Junctions resolve within a
559
+ * run, not between runs. Each item carries its own
560
+ * dimensions, `wallType` and `storey`, so a single call can build a whole
561
+ * floor plate or several storeys at once. Per-curve `topProfiles` make raked
562
+ * or gabled walls (see {@linkcode PluginWallTopProfile}). Validate-all-or-throw;
563
+ * one command.
564
+ *
565
+ * @param items - One {@linkcode PluginCreateWallRunItem} per run to create
566
+ * (≥1, ≤1000)
567
+ * @returns one {@linkcode ComponentHandle}`[]` per item, in input order —
568
+ * each inner array holding that run's walls in profile-curve order
569
+ * @throws `VALIDATION` if the items fail the schema (empty array, more than
570
+ * 1000 items, a non-positive height or thickness, a zero-length curve);
571
+ * `HANDLE_INVALID` if a `profile` handle is unknown or released;
572
+ * `PRECONDITION_FAILED` if a profile has no curves, `wallType` names no
573
+ * wall type in the project, or `storey` does not exist;
574
+ * `OPERATION_FAILED` if wall creation fails (nothing is created —
575
+ * `details.itemIndex` is the failing item); `METHOD_NOT_PERMITTED` if the
576
+ * plugin may not write.
577
+ *
578
+ * @examplePrompt Draw all the walls of this floor plan at once
579
+ * @examplePrompt Build every room's perimeter in one operation
580
+ * @examplePrompt Bulk create wall runs from these centerlines
581
+ * @examplePrompt Create the walls for both storeys in a single undo step
582
+ * @examplePrompt Turn these polylines into 200mm brick walls together
583
+ * @examplePrompt Import these raked walls with their top profiles in one go
584
+ *
585
+ * @performance Bulk creator — the whole batch is ONE host round-trip and ONE undo
586
+ * entry. Always prefer this over calling `design.create.walls` in a loop: build the
587
+ * full `items[]` array first (all profiles up front), then make one call.
588
+ *
589
+ * # Example
590
+ * ```ts
591
+ * const v = snaptrude.core.math.vec3
592
+ * const ground = await snaptrude.core.geom.create.profileFromLinePoints([
593
+ * await v.new(0, 0, 0),
594
+ * await v.new(8, 0, 0),
595
+ * await v.new(8, 0, 6),
596
+ * ])
597
+ * const upper = await snaptrude.core.geom.create.profileFromLinePoints([
598
+ * await v.new(0, 0, 0),
599
+ * await v.new(8, 0, 0),
600
+ * ])
601
+ * const [groundWalls, upperWalls] = await snaptrude.design.create.wallRuns([
602
+ * { profile: ground, height: 3, thickness: 0.2 },
603
+ * { profile: upper, height: 3, storey: 2 },
604
+ * // one gable wall: 3m at both ends, 5m ridge in the middle
605
+ * { profile: upper, thickness: 0.2, storey: 3,
606
+ * topProfiles: [[{ along: 0, height: 3 }, { along: 0.5, height: 5 }, { along: 1, height: 3 }]] },
607
+ * ])
608
+ * console.log(groundWalls.length, "walls on the ground floor")
609
+ * ```
610
+ */
611
+ public abstract wallRuns(
612
+ items: PluginCreateWallRunItem[],
613
+ ): PluginApiReturn<ComponentHandle[][]>
614
+
615
+ /**
616
+ * Create a **staircase** from a parametric preset, placed at a point.
617
+ *
618
+ * Geometry is procedurally generated from the chosen `preset`; there is no
619
+ * footprint input. Placed on the active structure/story unless overridden.
620
+ * The promise resolves only after the staircase's asynchronous geometry union
621
+ * and creation-command capture settle; a union failure rejects the call.
622
+ *
623
+ * @param preset - The parametric preset to generate
624
+ * @param position - Placement point
625
+ * @param label - Optional label
626
+ * @param structureId - Target structure (default active)
627
+ * @param level - Target level name (default active/`"01"`)
628
+ * @param dimensions - Optional positive dimension overrides in Snaptrude engine
629
+ * units, plus a placement angle in 90-degree increments. Overrides are
630
+ * applied to the staircase parameters before the creation command runs.
631
+ * @returns the {@linkcode ComponentHandle} of the created staircase
632
+ * @throws if the preset is unknown or placement fails
633
+ *
634
+ * @examplePrompt Add a dog-legged staircase at this location
635
+ * @examplePrompt Place a straight stair on level 01
636
+ * @examplePrompt Create an L-shaped staircase in the lobby
637
+ * @examplePrompt Insert a staircase near the entrance
638
+ * @examplePrompt Put amphitheatre steps at these coordinates
639
+ *
640
+ * # Example
641
+ * ```ts
642
+ * const stair = await snaptrude.design.create.staircase(
643
+ * "dogLegged",
644
+ * await snaptrude.core.math.vec3.new(5, 0, 5),
645
+ * )
646
+ * ```
647
+ */
648
+ public abstract staircase(
649
+ preset: PluginStaircasePreset,
650
+ position: Vec3Handle,
651
+ label?: string,
652
+ structureId?: string,
653
+ level?: string,
654
+ dimensions?: PluginStaircaseDimensions,
655
+ ): PluginApiReturn<ComponentHandle>
656
+
657
+ /**
658
+ * Create **reference lines** from a profile — one reference line per curve in
659
+ * the profile's ordered chain. Returns a handle per created line.
660
+ *
661
+ * Optional style (`color`, `thickness`, `style`, `gridTag`) applies to
662
+ * every created line.
663
+ *
664
+ * @param profile - Ordered curve chain (centerlines)
665
+ * @param color - Hex color `"#RRGGBB"` (default white)
666
+ * @param thickness - Line thickness (default 1)
667
+ * @param style - Line style (default `SOLID`)
668
+ * @param gridTag - Grid tag label (default `"A"`)
669
+ * @returns a {@linkcode ComponentHandle}`[]` (one per curve), in profile order
670
+ * @throws if the profile is empty or creation fails
671
+ *
672
+ * @examplePrompt Draw a reference line between these two points
673
+ * @examplePrompt Add dashed guide lines along this path
674
+ * @examplePrompt Create grid lines tagged A through the plan
675
+ * @examplePrompt Set up construction lines for the column grid
676
+ * @examplePrompt Mark a red reference line across the site
677
+ *
678
+ * # Example
679
+ * ```ts
680
+ * const v = snaptrude.core.math.vec3
681
+ * const profile = await snaptrude.core.geom.create.profileFromLinePoints([
682
+ * await v.new(0, 0, 0),
683
+ * await v.new(10, 0, 0),
684
+ * ])
685
+ * const lines = await snaptrude.design.create.referenceLines(
686
+ * profile,
687
+ * undefined,
688
+ * undefined,
689
+ * "DASHED",
690
+ * )
691
+ * ```
692
+ */
693
+ public abstract referenceLines(
694
+ profile: ProfileHandle,
695
+ color?: string,
696
+ thickness?: number,
697
+ style?: PluginReferenceLineStyle,
698
+ gridTag?: string,
699
+ ): PluginApiReturn<ComponentHandle[]>
700
+
701
+ /**
702
+ * Create a free rectangular **structural grid** — one grid group with two
703
+ * perpendicular line families (`linesX` lines spaced `spacingX` apart, and
704
+ * `linesY` lines spaced `spacingY` apart) on the active storey. One undoable
705
+ * creation.
706
+ *
707
+ * Units: spacings in Snaptrude units; `angle` in degrees (CCW about +Y,
708
+ * default 0). Without `center` the grid is centred on the current viewport
709
+ * (the native tool's behavior) — pass `center` for deterministic placement.
710
+ *
711
+ * @param linesX - Line count of the first family (integer ≥ 1)
712
+ * @param linesY - Line count of the second family (integer ≥ 1)
713
+ * @param spacingX - First-family spacing (Snaptrude units, > 0)
714
+ * @param spacingY - Second-family spacing (Snaptrude units, > 0)
715
+ * @param options - `angle`, `center`, and {@linkcode PluginGridStyleOptions}
716
+ * @returns the created grid group's {@linkcode ComponentHandle}
717
+ *
718
+ * @examplePrompt Create a 5 by 8 structural grid with 6 metre spacing
719
+ * @examplePrompt Add a column grid rotated 30 degrees
720
+ * @examplePrompt Set up a structural grid at the site origin
721
+ *
722
+ * # Example
723
+ * ```ts
724
+ * const centre = await snaptrude.core.math.vec3.new(0, 0, 0)
725
+ * const grid = await snaptrude.design.create.grid(5, 8, 6, 6, { center: centre })
726
+ * ```
727
+ */
728
+ public abstract grid(
729
+ linesX: number,
730
+ linesY: number,
731
+ spacingX: number,
732
+ spacingY: number,
733
+ options?: {
734
+ angle?: number
735
+ center?: Vec3Handle
736
+ } & PluginGridStyleOptions,
737
+ ): PluginApiReturn<ComponentHandle>
738
+
739
+ /**
740
+ * Create a **structural grid from a single curve** — one grid group holding
741
+ * one wing with one line (the draw tool's output). The curve may be a line
742
+ * or an arc; circles are rejected with `VALIDATION`. Undoable.
743
+ *
744
+ * @param curve - The grid line's geometry ({@linkcode CurveHandle}, world space)
745
+ * @param options - `tag` (defaults to the draw tool's next tag) and
746
+ * {@linkcode PluginGridStyleOptions}
747
+ * @returns the created grid group's {@linkcode ComponentHandle}
748
+ *
749
+ * @examplePrompt Draw a grid line from A to B
750
+ * @examplePrompt Add a curved grid line through these points
751
+ * @examplePrompt Create grid line "C" along this wall
752
+ *
753
+ * # Example
754
+ * ```ts
755
+ * const { vec3 } = snaptrude.core.math
756
+ * const from = await vec3.new(0, 0, 0)
757
+ * const to = await vec3.new(30, 0, 0)
758
+ * const curve = await snaptrude.core.geom.create.line(from, to)
759
+ * const grid = await snaptrude.design.create.gridFromCurve(curve, { tag: "A" })
760
+ * ```
761
+ */
762
+ public abstract gridFromCurve(
763
+ curve: CurveHandle,
764
+ options?: {
765
+ tag?: string
766
+ } & PluginGridStyleOptions,
767
+ ): PluginApiReturn<ComponentHandle>
768
+
769
+ /**
770
+ * Generate **structural grids fitted to mass footprints** — one grid group
771
+ * per footprint cluster, with counts and orientation derived from each
772
+ * footprint's geometry and the given spacings. All created groups commit as
773
+ * ONE undoable unit.
774
+ *
775
+ * Lenient like the native tool: masses without an extractable footprint
776
+ * (no B-rep, degenerate top face) are skipped; throws `VALIDATION` only when
777
+ * NONE of the given masses yields a footprint.
778
+ *
779
+ * @param masses - Masses whose footprints seat the grids
780
+ * @param spacingX - First-family spacing (Snaptrude units, > 0)
781
+ * @param spacingY - Second-family spacing (Snaptrude units, > 0)
782
+ * @param options - {@linkcode PluginGridStyleOptions}
783
+ * @returns the created grid groups' {@linkcode ComponentHandle}`[]`
784
+ *
785
+ * @examplePrompt Generate grids for the selected masses
786
+ * @examplePrompt Auto-generate a 6m structural grid on this building
787
+ * @examplePrompt Fit column grids to every mass on this storey
788
+ *
789
+ * # Example
790
+ * ```ts
791
+ * const masses = await snaptrude.design.query.listMasses({ storeys: [1] })
792
+ * const grids = await snaptrude.design.create.gridsFromMasses(masses, 6, 6)
793
+ * ```
794
+ */
795
+ public abstract gridsFromMasses(
796
+ masses: ComponentHandle[],
797
+ spacingX: number,
798
+ spacingY: number,
799
+ options?: PluginGridStyleOptions,
800
+ ): PluginApiReturn<ComponentHandle[]>
801
+
802
+ /**
803
+ * Create **columns at every grid-line intersection** of the given grid
804
+ * groups, sized `width` × `depth` and oriented to the grid axes, on the
805
+ * grids' storey. All columns commit as ONE undoable unit.
806
+ *
807
+ * @param grids - Grid groups whose intersections seat the columns
808
+ * @param width - Column width (Snaptrude units, > 0)
809
+ * @param depth - Column depth (Snaptrude units, > 0)
810
+ * @returns the created columns' {@linkcode ComponentHandle}`[]`
811
+ * @throws `VALIDATION` when an id does not resolve to a grid group;
812
+ * `OPERATION_FAILED` when the grids have no line intersections
813
+ *
814
+ * @examplePrompt Generate columns on this grid
815
+ * @examplePrompt Place 450mm square columns at every grid intersection
816
+ *
817
+ * # Example
818
+ * ```ts
819
+ * const grids = await snaptrude.design.query.listGrids()
820
+ * const columns = await snaptrude.design.create.columnsFromGrids(grids, 0.45, 0.45)
821
+ * ```
822
+ */
823
+ public abstract columnsFromGrids(
824
+ grids: ComponentHandle[],
825
+ width: number,
826
+ depth: number,
827
+ ): PluginApiReturn<ComponentHandle[]>
828
+
829
+ /**
830
+ * Place a **furniture** item from the project library at a world position.
831
+ *
832
+ * Identified by a **catalog (library) id** — the team object's stable `_id` for
833
+ * project uploads, or the item's `fullName` for the general library. Discover ids
834
+ * with {@linkcode PluginDesignFurnitureApi.listCatalog}. Placement is asynchronous
835
+ * (the source mesh is fetched if not cached) and creates one undo entry.
836
+ *
837
+ * Placed at the item's default rotation unless `angleInDegrees` is given, which
838
+ * rotates it about the vertical axis at creation time (baked into the same undo
839
+ * entry). To rotate an existing instance instead, use `design.transform.rotate`.
840
+ *
841
+ * @param catalogId - Library id: team `_id` or general `fullName`
842
+ * @param position - Absolute world placement point. `position.y` is the REST
843
+ * elevation: the item is grounded so its bounding-box base sits exactly at
844
+ * `position.y` (the same surface-flush contract as interactive drag-drop) —
845
+ * pass the floor/storey elevation to stand furniture on it; never add half
846
+ * the item's height yourself.
847
+ * @param options - Optional placement options: `label` — instance name and
848
+ * readable label (`design.query.getLabel`; default auto `${name}Ins${n}`);
849
+ * `createNewSourceMesh` — legacy flag, kept for compatibility. The host owns
850
+ * source-mesh persistence: a catalog source is recorded exactly once, by the
851
+ * first placement that brings it in, and this flag cannot skip that record.
852
+ * @param angleInDegrees - Optional signed rotation about the vertical axis, in
853
+ * degrees (same convention as {@linkcode PluginDesignTransformApi.rotate}).
854
+ * Applied at creation time so it is part of the placement's single undo entry.
855
+ * Default: the item's own (unrotated) orientation.
856
+ * @returns the {@linkcode ComponentHandle} of the placed furniture instance
857
+ * @throws if the catalog id is unknown, the source mesh fails to load, or placement fails;
858
+ * `PRECONDITION_FAILED` (`details.engineCode: "TOOL_ACTIVE"`) while the interactive
859
+ * furniture tool is active — finish or cancel it first
860
+ *
861
+ * @examplePrompt Place a chair from the library at this spot
862
+ * @examplePrompt Add a sofa from the furniture catalog to the living room
863
+ * @examplePrompt Drop a desk into the scene at 3, 0, 5
864
+ * @examplePrompt Insert the uploaded bed model in the bedroom
865
+ * @examplePrompt Put a table from my project library here and name it Table-01
866
+ * @examplePrompt Place a chair here rotated 90 degrees
867
+ *
868
+ * # Example
869
+ * ```ts
870
+ * const chair = await snaptrude.design.create.furniture(
871
+ * "6620f1a…", // from design.furniture.listCatalog()
872
+ * await snaptrude.core.math.vec3.new(3, 0, 5),
873
+ * { label: "Chair-01" },
874
+ * )
875
+ * // …placed already turned 90° about the vertical axis:
876
+ * const turned = await snaptrude.design.create.furniture(
877
+ * "6620f1a…",
878
+ * await snaptrude.core.math.vec3.new(3, 0, 5),
879
+ * undefined,
880
+ * 90,
881
+ * )
882
+ * ```
883
+ *
884
+ * @performance For MORE THAN ONE item, call `design.create.furnitureItems(items[])` —
885
+ * one host round-trip and ONE undo entry, and a catalog source shared by several
886
+ * items is fetched once. Looping this single-item creator is N round-trips.
887
+ */
888
+ public abstract furniture(
889
+ catalogId: string,
890
+ position: Vec3Handle,
891
+ options?: { label?: string; createNewSourceMesh?: boolean },
892
+ angleInDegrees?: number,
893
+ ): PluginApiReturn<ComponentHandle>
894
+
895
+ /**
896
+ * Place **many furniture items** in one undoable operation (bulk plural of
897
+ * {@linkcode furniture}). Each item names a catalog id and an absolute world
898
+ * position (`position.y` is the REST elevation — the same grounding contract
899
+ * as the singular creator), with optional label and rotation. A catalog
900
+ * source shared by several items is fetched and recorded once for the whole
901
+ * batch, so the host — not the caller — owns source persistence (there is no
902
+ * per-item `createNewSourceMesh`). Validate-all-or-throw; one command.
903
+ *
904
+ * @param items - One {@linkcode PluginCreateFurnitureItem} per instance to
905
+ * place (≥1, ≤1000)
906
+ * @returns the placed instances as {@linkcode ComponentHandle}`[]`, in input order
907
+ * @throws `VALIDATION` if the items fail the schema (empty array, more than
908
+ * 1000 items); `HANDLE_INVALID` if a `position` handle is unknown or
909
+ * released; `PRECONDITION_FAILED` if a catalog id is unknown, a furniture
910
+ * tool is active, or a parametric group is active (exit it first, or place
911
+ * items one at a time with `furniture`); `OPERATION_FAILED` if a source
912
+ * mesh fails to load or placement fails (nothing is created —
913
+ * `details.itemIndex` is the failing item); `METHOD_NOT_PERMITTED` if the plugin may not write.
914
+ *
915
+ * @examplePrompt Place all the desks for this office at once
916
+ * @examplePrompt Furnish every bedroom in one operation
917
+ * @examplePrompt Bulk place these chairs around the table
918
+ * @examplePrompt Add the whole furniture layout in a single undo step
919
+ * @examplePrompt Drop twenty copies of this chair at these positions
920
+ *
921
+ * @performance Bulk creator — the whole batch is ONE host round-trip and ONE undo
922
+ * entry, and each distinct catalog source loads once. Always prefer this over
923
+ * calling `design.create.furniture` in a loop: build the full `items[]` array
924
+ * first (all positions and angles up front), then make one call.
925
+ *
926
+ * # Example
927
+ * ```ts
928
+ * const v = snaptrude.core.math.vec3
929
+ * const [chair] = await snaptrude.design.furniture.listCatalog()
930
+ * const placed = await snaptrude.design.create.furnitureItems([
931
+ * { catalogId: chair.id, position: await v.new(3, 0, 5), label: "Chair-01" },
932
+ * { catalogId: chair.id, position: await v.new(4, 0, 5), angleInDegrees: 90 },
933
+ * { catalogId: chair.id, position: await v.new(5, 0, 5), angleInDegrees: 180 },
934
+ * ])
935
+ * ```
936
+ */
937
+ public abstract furnitureItems(
938
+ items: PluginCreateFurnitureItem[],
939
+ ): PluginApiReturn<ComponentHandle[]>
940
+
941
+ /**
942
+ * Place a parametric **door** family into a host wall.
943
+ *
944
+ * Identified by a saved **family definition id**. Discover ids with
945
+ * {@linkcode PluginDesignDoorsApi.listCatalog}. The world `position` is
946
+ * projected onto the host wall's face to locate the opening; the wall is
947
+ * re-cut and the door hosted in a single undo entry. Placement is
948
+ * asynchronous. Values and host bindings are evaluated before the first cut.
949
+ *
950
+ * @param familyId - Hosted door definition ID; legacy mesh catalog IDs are not accepted
951
+ * @param hostWall - The wall to host the door
952
+ * @param position - World point projected onto the wall to locate the opening
953
+ * @param options - `version` pins the definition. `values` sets authored parameters
954
+ * (numeric lengths in SU, or unit strings). `label` names the instance.
955
+ * `hinge` selects the declared `hand` enum: local -X is left, +X is right.
956
+ * @param facing - World point selecting local +Z; omitted uses the picked face
957
+ * @returns the {@linkcode ComponentHandle} of the placed door
958
+ * @throws if the family/category/parameters are invalid, or placement or cutting fails
959
+ *
960
+ * @examplePrompt Add a door to this wall here
961
+ * @examplePrompt Place a sliding door on the selected wall
962
+ * @examplePrompt Put a door from the catalog at this point on the wall
963
+ * @examplePrompt Insert the entrance door into this wall
964
+ * @examplePrompt Add a door to the wall and call it Entry-01
965
+ * @examplePrompt Add a door that opens into the living room
966
+ * @examplePrompt Put a door here hinged on the north jamb
967
+ *
968
+ * # Example
969
+ * ```ts
970
+ * const [wall] = await snaptrude.design.query.listWalls({ isSelected: true })
971
+ * const [entry] = await snaptrude.design.doors.listCatalog()
972
+ * const door = await snaptrude.design.create.door(
973
+ * entry.id,
974
+ * wall,
975
+ * await snaptrude.core.math.vec3.new(3, 0, 5),
976
+ * { label: "Entry-01" },
977
+ * )
978
+ * // …facing a specific side of the wall (pass a point inside that room):
979
+ * const intoKitchen = await snaptrude.design.create.door(
980
+ * entry.id,
981
+ * wall,
982
+ * await snaptrude.core.math.vec3.new(3, 0, 5),
983
+ * undefined,
984
+ * await snaptrude.core.math.vec3.new(3, 0, 9),
985
+ * )
986
+ * // …and hinged on the jamb nearest a point (here the +x end of the opening):
987
+ * const hingedRight = await snaptrude.design.create.door(
988
+ * entry.id,
989
+ * wall,
990
+ * await snaptrude.core.math.vec3.new(3, 0, 5),
991
+ * { hinge: await snaptrude.core.math.vec3.new(3.5, 0, 5) },
992
+ * await snaptrude.core.math.vec3.new(3, 0, 9),
993
+ * )
994
+ * ```
995
+ *
996
+ * @performance For MORE THAN ONE door, call `design.create.doors(items[])` — one host
997
+ * round-trip and ONE undo entry, with each host wall re-cut once per opening inside
998
+ * that single call. Looping this single-door creator is N round-trips.
999
+ */
1000
+ public abstract door(
1001
+ familyId: string,
1002
+ hostWall: ComponentHandle,
1003
+ position: Vec3Handle,
1004
+ options?: {
1005
+ label?: string
1006
+ hinge?: Vec3Handle
1007
+ version?: number
1008
+ values?: Record<string, number | string>
1009
+ },
1010
+ facing?: Vec3Handle,
1011
+ ): PluginApiReturn<ComponentHandle>
1012
+
1013
+ /**
1014
+ * Place **many doors** into host walls in one undoable operation (bulk plural
1015
+ * of {@linkcode door}). Each item carries its own family id, host wall,
1016
+ * world position, and optional `facing`, `label`, `width` and `height` — the
1017
+ * same fields as a `"door"` {@linkcode PluginDesignCreateOpeningOptions}.
1018
+ * Validate-all-or-throw; one command.
1019
+ *
1020
+ * The wall keeps its identity. Several items may use the same host.
1021
+ * Width and height set named recipe parameters, not mesh scale. The recipe's
1022
+ * evaluated hole can include frame allowances. A failed item rolls back the batch.
1023
+ *
1024
+ * @param items - One {@linkcode PluginCreateDoorItem} per door to place
1025
+ * (≥1, ≤1000)
1026
+ * @returns the placed doors as {@linkcode ComponentHandle}`[]`, in input order
1027
+ * @throws `VALIDATION` if the items fail the schema (empty array, more than
1028
+ * 1000 items, unknown fields, a non-positive `width`/`height`);
1029
+ * `HANDLE_INVALID` if a `position`, `facing` or `hinge` handle is unknown
1030
+ * or released; `PRECONDITION_FAILED` if the family cannot be resolved or saved,
1031
+ * or a host is locked / is not in the active proposal;
1032
+ * `OPERATION_FAILED` if placement, containment, overlap checks or cutting fail
1033
+ * (nothing is created — `details.itemIndex` is the failing item);
1034
+ * `METHOD_NOT_PERMITTED` if the plugin may not write.
1035
+ *
1036
+ * @examplePrompt Add doors to all of these walls at once
1037
+ * @examplePrompt Place a door in every room in one operation
1038
+ * @examplePrompt Bulk add the entrance doors from this schedule
1039
+ * @examplePrompt Put three doors on this wall in a single undo step
1040
+ * @examplePrompt Add all the doors for this floor plan together
1041
+ *
1042
+ * @performance Bulk creator — the whole batch is ONE host round-trip and ONE undo
1043
+ * entry. Always prefer this over
1044
+ * calling `design.create.door` in a loop: build the full `items[]` array first
1045
+ * (all host walls and points up front), then make one call.
1046
+ *
1047
+ * # Example
1048
+ * ```ts
1049
+ * const v = snaptrude.core.math.vec3
1050
+ * const [wall] = await snaptrude.design.query.listWalls({ isSelected: true })
1051
+ * const [entry] = await snaptrude.design.doors.listCatalog()
1052
+ * const [front, side] = await snaptrude.design.create.doors([
1053
+ * { familyId: entry.id, hostWall: wall, position: await v.new(2, 0, 5), label: "D-01" },
1054
+ * { familyId: entry.id, hostWall: wall, position: await v.new(6, 0, 5), values: { width: "1200mm" } },
1055
+ * ])
1056
+ * // The host still resolves after both cuts:
1057
+ * const currentWall = await snaptrude.design.query.getHost(front)
1058
+ * ```
1059
+ */
1060
+ public abstract doors(
1061
+ items: PluginCreateDoorItem[],
1062
+ ): PluginApiReturn<ComponentHandle[]>
1063
+
1064
+ /**
1065
+ * Place a parametric **window** family into a host wall.
1066
+ *
1067
+ * Identified by a saved **family definition id**. Discover ids with
1068
+ * {@linkcode PluginDesignWindowsApi.listCatalog}. The world `position` is
1069
+ * projected onto the host wall's face to locate the opening; the wall is
1070
+ * re-cut and the window hosted in a single undo entry. Placement is
1071
+ * asynchronous. The sill parameter determines elevation; position Y is ignored.
1072
+ *
1073
+ * @param familyId - Hosted window definition ID; legacy mesh catalog IDs are not accepted
1074
+ * @param hostWall - The wall to host the window
1075
+ * @param position - World point projected onto the wall to locate the opening
1076
+ * @param options - `version`, `values`, `label`, and parameter-driven `hinge`, as for door
1077
+ * @param facing - World point selecting local +Z; omitted uses the picked face
1078
+ * @returns the {@linkcode ComponentHandle} of the placed window
1079
+ * @throws if the family/category/parameters are invalid, or placement or cutting fails
1080
+ *
1081
+ * @examplePrompt Add a window to this wall here
1082
+ * @examplePrompt Place a casement window on the selected wall
1083
+ * @examplePrompt Put a window from the catalog at this point on the wall
1084
+ * @examplePrompt Insert a window into the living room wall
1085
+ * @examplePrompt Add a window to the wall and name it Win-01
1086
+ * @examplePrompt Add a casement window opening toward the garden side
1087
+ *
1088
+ * # Example
1089
+ * ```ts
1090
+ * const [wall] = await snaptrude.design.query.listWalls({ isSelected: true })
1091
+ * const [entry] = await snaptrude.design.windows.listCatalog()
1092
+ * const window = await snaptrude.design.create.window(
1093
+ * entry.id,
1094
+ * wall,
1095
+ * await snaptrude.core.math.vec3.new(3, 0, 5),
1096
+ * { label: "Win-01" },
1097
+ * )
1098
+ * ```
1099
+ *
1100
+ * @performance For MORE THAN ONE window, call `design.create.windows(items[])` — one
1101
+ * host round-trip and ONE undo entry, with each host wall re-cut once per opening
1102
+ * inside that single call. Looping this single-window creator is N round-trips.
1103
+ */
1104
+ public abstract window(
1105
+ familyId: string,
1106
+ hostWall: ComponentHandle,
1107
+ position: Vec3Handle,
1108
+ options?: {
1109
+ label?: string
1110
+ hinge?: Vec3Handle
1111
+ version?: number
1112
+ values?: Record<string, number | string>
1113
+ },
1114
+ facing?: Vec3Handle,
1115
+ ): PluginApiReturn<ComponentHandle>
1116
+
1117
+ /**
1118
+ * Place **many windows** into host walls in one undoable operation (bulk
1119
+ * plural of {@linkcode window}). Each item carries its own family id, host
1120
+ * wall, world position, and optional `facing`, `label`, `width`, `height` and
1121
+ * `sillHeight` — the same fields as a `"window"`
1122
+ * {@linkcode PluginDesignCreateOpeningOptions}. `sillHeight` is measured from
1123
+ * the host wall base to the BOTTOM of the window. Validate-all-or-throw; one
1124
+ * command.
1125
+ *
1126
+ * Hosts keep their identity. Width, height and sillHeight set the declared
1127
+ * width, height and sill parameters before the first cut. No mesh scaling occurs.
1128
+ *
1129
+ * @param items - One {@linkcode PluginCreateWindowItem} per window to place
1130
+ * (≥1, ≤1000)
1131
+ * @returns the placed windows as {@linkcode ComponentHandle}`[]`, in input order
1132
+ * @throws `VALIDATION` if the items fail the schema (empty array, more than
1133
+ * 1000 items, unknown fields, a non-positive `width`/`height`, a negative
1134
+ * `sillHeight`); `HANDLE_INVALID` if a `position`, `facing` or `hinge`
1135
+ * handle is unknown or released; `PRECONDITION_FAILED` if the family cannot be
1136
+ * resolved or saved, or a host is locked / is not in the active proposal;
1137
+ * `OPERATION_FAILED` if placement, containment, overlap checks or cutting fail
1138
+ * (nothing is created — `details.itemIndex` is the failing item);
1139
+ * `METHOD_NOT_PERMITTED` if the plugin may not write.
1140
+ *
1141
+ * @examplePrompt Add windows along this whole facade at once
1142
+ * @examplePrompt Place a window in every bedroom in one operation
1143
+ * @examplePrompt Bulk add the windows from this schedule
1144
+ * @examplePrompt Put four windows on this wall in a single undo step
1145
+ * @examplePrompt Add all the windows with a 0.9m sill height together
1146
+ *
1147
+ * @performance Bulk creator — the whole batch is ONE host round-trip and ONE undo
1148
+ * entry. Always prefer this over
1149
+ * calling `design.create.window` in a loop: build the full `items[]` array first
1150
+ * (all host walls and points up front), then make one call.
1151
+ *
1152
+ * # Example
1153
+ * ```ts
1154
+ * const v = snaptrude.core.math.vec3
1155
+ * const [wall] = await snaptrude.design.query.listWalls({ isSelected: true })
1156
+ * const [casement] = await snaptrude.design.windows.listCatalog()
1157
+ * const placed = await snaptrude.design.create.windows([
1158
+ * { familyId: casement.id, hostWall: wall, position: await v.new(2, 0, 5), values: { sill: "900mm" } },
1159
+ * { familyId: casement.id, hostWall: wall, position: await v.new(5, 0, 5), values: { sill: "900mm" } },
1160
+ * ])
1161
+ * const currentWall = await snaptrude.design.query.getHost(placed[0])
1162
+ * ```
1163
+ */
1164
+ public abstract windows(
1165
+ items: PluginCreateWindowItem[],
1166
+ ): PluginApiReturn<ComponentHandle[]>
1167
+
1168
+ /**
1169
+ * Cut a **void** — a hole, opening or shaft — through an existing FLAT slab,
1170
+ * floor, roof or ceiling. The void is a selectable child object of its host
1171
+ * (the "Void" of the Draw Void tool). It always cuts the full host thickness.
1172
+ * It can be moved with `design.transform.move` (a move that would leave the
1173
+ * host is shortened without a report) and removed with
1174
+ * `design.delete.entities`; to resize, delete it and cut a new one
1175
+ * (`design.update.space` refuses a void).
1176
+ *
1177
+ * Give the outline **in plan** (all points at one height): its height is
1178
+ * ignored, and it is dropped straight onto the host's top face, so one outline
1179
+ * works on every storey. Keep it at least 25.4 mm (0.1 SU) inside the host
1180
+ * edge and away from other voids; merge overlapping holes into one outline.
1181
+ * Straight segments and arcs only (no splines).
1182
+ *
1183
+ * **A room has a floor finish AND a structural slab that overlap in plan; a
1184
+ * void in one does not cut the other, so a through-opening needs one void in
1185
+ * each.**
1186
+ *
1187
+ * `getEntityType` reports a void as `"mass"`, and `listMasses` /
1188
+ * `listByType("mass")` include voids: a mass whose `design.query.getHost` is a
1189
+ * slab, floor, roof or ceiling is a void. After its host is copied, a void can
1190
+ * report `null` and be missing from those lists; `listChildren(host)` still
1191
+ * finds it.
1192
+ *
1193
+ * Call it as `snaptrude.design.create.void(...)`; `void` is a reserved word and
1194
+ * cannot be destructured. Voids in walls, on sloped, generated or multi-plane
1195
+ * roofs, and on instanced hosts are not available yet; for a door or window
1196
+ * use `design.create.door` / `window`. To make a NEW slab that already has a
1197
+ * fixed hole, pass a contour with holes to `design.create.slab`; that hole is
1198
+ * part of the footprint, not an object. For a contour's outer loop, pass
1199
+ * `core.geom.query.contour.getOuterProfile(contour)`.
1200
+ *
1201
+ * # Example
1202
+ * ```ts
1203
+ * const m = 1000 / 254 // metres → Snaptrude units (SU)
1204
+ * const [slab] = await snaptrude.design.query.listByType("slab", { isSelected: true })
1205
+ * const center = await snaptrude.core.math.vec3.new(10 * m, 0, 5 * m) // plan point; y is ignored
1206
+ * const outline = await snaptrude.core.geom.create.profileRect(2 * m, 2 * m, center) // 2 m x 2 m
1207
+ * const hole = await snaptrude.design.create.void(slab, outline)
1208
+ * ```
1209
+ *
1210
+ * A round hole is two arcs (a circle handle is not a profile):
1211
+ * ```ts
1212
+ * const m = 1000 / 254
1213
+ * const { vec3 } = snaptrude.core.math
1214
+ * const g = snaptrude.core.geom.create
1215
+ * const r = 0.5 * m // 1 m diameter
1216
+ * const centre = await vec3.new(10 * m, 0, 5 * m)
1217
+ * const axis = await vec3.new(0, -1, 0)
1218
+ * const east = await vec3.new(10 * m + r, 0, 5 * m)
1219
+ * const west = await vec3.new(10 * m - r, 0, 5 * m)
1220
+ * const round = await g.profileFromCurves([await g.arc(east, west, centre, axis), await g.arc(west, east, centre, axis)])
1221
+ * await snaptrude.design.create.void(slab, round) // never destructure `void`
1222
+ * ```
1223
+ *
1224
+ * @param host - The slab, floor, roof or ceiling to cut through
1225
+ * @param outline - Closed, flat plan outline (world SU); its height is ignored
1226
+ * @returns the {@linkcode ComponentHandle} of the new void
1227
+ * @throws `VALIDATION` if the outline is open, crosses itself, is not flat or
1228
+ * has a spline, or the arguments are the wrong handle kinds or swapped;
1229
+ * `HANDLE_INVALID` if a handle is unknown or released or the host was
1230
+ * deleted; `HANDLE_STALE` if the host was rebuilt (re-query it);
1231
+ * `PRECONDITION_FAILED` if the
1232
+ * host is a wall or not a slab/floor/roof/ceiling, is sloped, instanced, in
1233
+ * another building, locked, outside the active proposal, a generated roof or
1234
+ * not a single plate, or there is no active structure (`engineCode`
1235
+ * `NO_ACTIVE_STRUCTURE`); `OPERATION_FAILED` with `engineCode`
1236
+ * `VOID_DOES_NOT_FIT` when the outline crosses the host edge, overlaps a void
1237
+ * or hole, is closer than 25.4 mm to either, or the fit could not be checked,
1238
+ * or another `engineCode` when the cut failed (nothing is created, except
1239
+ * `PUBLISH_FAILED` with a hint that the voids are in the scene: undo, then
1240
+ * retry); `METHOD_NOT_PERMITTED` if the plugin may not write.
1241
+ *
1242
+ * @examplePrompt Cut a hole in this slab
1243
+ * @examplePrompt Add a 1.2m by 2.4m stair opening in the first-floor slab
1244
+ * @examplePrompt Make a 600 x 600 service penetration in the floor for the riser
1245
+ * @examplePrompt Put a skylight opening through the roof
1246
+ * @examplePrompt Cut a round 1m duct hole in the slab
1247
+ * @examplePrompt Make a cut-out in the ceiling for the light well
1248
+ * @examplePrompt Add a double-height atrium void in the level 2 floor
1249
+ *
1250
+ * @performance Single-void creator. For MORE THAN ONE void, call
1251
+ * `design.create.voids(items[])`: one host round-trip, ONE undo entry, one cut
1252
+ * per host.
1253
+ */
1254
+ public abstract void(
1255
+ host: ComponentHandle,
1256
+ outline: ProfileHandle,
1257
+ ): PluginApiReturn<ComponentHandle>
1258
+
1259
+ /**
1260
+ * Cut **many voids** (holes, openings, shafts) through slabs, floors, roofs
1261
+ * and ceilings in one undoable operation (bulk plural of {@linkcode void}).
1262
+ * Items may share a host or use different hosts — one shaft outline on every
1263
+ * storey's slab AND floor is one call. Validate-all-or-throw: one item whose
1264
+ * host does not contain the outline rejects the whole batch, so pass only the
1265
+ * hosts that contain it; `details.itemIndex` names the failing item (for two
1266
+ * overlapping items of the batch, the earlier one). At most 50 voids per host
1267
+ * and 200 in all per call. Same outline rules as {@linkcode void}: plan outline, 25.4 mm
1268
+ * (0.1 SU) clearance, floor AND slab are separate hosts. Call it as
1269
+ * `snaptrude.design.create.voids(...)`.
1270
+ *
1271
+ * # Example
1272
+ * ```ts
1273
+ * const m = 1000 / 254
1274
+ * // The user selects the slabs AND floors the shaft passes through; every one must contain the outline.
1275
+ * const hosts = [
1276
+ * ...(await snaptrude.design.query.listByType("slab", { isSelected: true })),
1277
+ * ...(await snaptrude.design.query.listByType("floor", { isSelected: true })),
1278
+ * ]
1279
+ * const centre = await snaptrude.core.math.vec3.new(12 * m, 0, -6 * m)
1280
+ * const shaft = await snaptrude.core.geom.create.profileRect(2 * m, 2 * m, centre)
1281
+ * const holes = await snaptrude.design.create.voids(hosts.map((host) => ({ host, outline: shaft })))
1282
+ * ```
1283
+ *
1284
+ * @param items - One {@linkcode PluginCreateVoidItem} per void (≥1, ≤200; ≤50 per host)
1285
+ * @returns the new voids as {@linkcode ComponentHandle}`[]`, in input order
1286
+ * @throws `VALIDATION` if the items fail the schema (empty array, more than
1287
+ * 1000 items, unknown fields), an outline is invalid (as for
1288
+ * {@linkcode void}), more than 50 items share one host, or there are more
1289
+ * than 200 items; plus every code {@linkcode void} throws, each with
1290
+ * `details.itemIndex`. Nothing is created on any failure, except
1291
+ * `PUBLISH_FAILED` (as for {@linkcode void}).
1292
+ *
1293
+ * @examplePrompt Cut a lift shaft through every floor slab of the core
1294
+ * @examplePrompt Cut a 2m x 2m shaft through all the slabs at this location
1295
+ * @examplePrompt Make stair openings in all the floors above the staircases
1296
+ * @examplePrompt Make holes in the roof for these three skylights
1297
+ * @examplePrompt Cut openings in each storey's slab matching this outline
1298
+ * @examplePrompt Punch the same riser penetration through every floor at once
1299
+ *
1300
+ * @performance ONE host round-trip, ONE undo entry, ONE cut per host. Never call
1301
+ * `void` in a loop. Runs synchronously on the main thread: 50 voids on one
1302
+ * host take about 1 s, and the time grows with the number of hosts (caps:
1303
+ * 50 per host, 200 per call).
1304
+ */
1305
+ public abstract voids(
1306
+ items: PluginCreateVoidItem[],
1307
+ ): PluginApiReturn<ComponentHandle[]>
1308
+
1309
+ /**
1310
+ * Place a parametric **door or window** into a host wall with parameter overrides.
1311
+ *
1312
+ * The world `position` is projected onto the host wall to locate the opening.
1313
+ * All supplied dimensions use Snaptrude engine units. Window `sillHeight` is
1314
+ * measured from the host wall base to the bottom of the window, not to
1315
+ * its center. Placement is asynchronous and committed as one undoable creation.
1316
+ *
1317
+ * Wall only. For a hole in a slab, floor or roof use `design.create.void`.
1318
+ *
1319
+ * @param options - Opening kind, family and host references, placement, and
1320
+ * optional facing (swing side), hinge (hinged jamb), label, and dimensions
1321
+ * @returns the {@linkcode ComponentHandle} of the placed door or window
1322
+ * @throws if the options are invalid, the family id is unknown, the host is
1323
+ * not a wall, loading fails, or the opening cannot be placed on the host
1324
+ *
1325
+ * @examplePrompt Add a 1m wide door to this wall here
1326
+ * @examplePrompt Place a window with a 0.9m sill height on the selected wall
1327
+ *
1328
+ * @performance Single-opening creator — use it for one hosted opening. For MORE
1329
+ * THAN ONE, call `design.create.doors(items[])` / `design.create.windows(items[])`:
1330
+ * the same per-item fields, one host round-trip, ONE undo entry.
1331
+ *
1332
+ * # Example
1333
+ * ```ts
1334
+ * const opening = await snaptrude.design.create.opening({
1335
+ * kind: "window",
1336
+ * familyId: windowType.id,
1337
+ * hostWall: wall,
1338
+ * position: await snaptrude.core.math.vec3.new(3, 0, 5),
1339
+ * width: 1.2,
1340
+ * height: 1.5,
1341
+ * sillHeight: 0.9,
1342
+ * })
1343
+ * ```
1344
+ */
1345
+ public abstract opening(
1346
+ options: PluginDesignCreateOpeningOptions,
1347
+ ): PluginApiReturn<ComponentHandle>
1348
+
1349
+ /**
1350
+ * Place a **smart layout** — clone an in-scene template cluster (walls,
1351
+ * furniture, doors, windows, floors) into one or more target ROOM/DEPARTMENT
1352
+ * spaces, adapting orientation and fit to each target.
1353
+ *
1354
+ * Supply the template as **exactly one** of `templateGroup` (a group **id**
1355
+ * from `snaptrude.core.groups.list` — groups are string-id entities, not
1356
+ * component handles) or
1357
+ * `templateComponents` (an explicit component set); every target in `targets`
1358
+ * (≥1) receives its own placement. By default the target spaces are hidden
1359
+ * after placement (`hideTargets`, mirroring the product) — pass `false` to keep
1360
+ * them visible.
1361
+ *
1362
+ * The whole operation — every wall/opening/furniture/floor across every target,
1363
+ * plus the target-hide — is committed as a **single undo step**. Because all
1364
+ * targets merge into one creation batch, the created entities are returned
1365
+ * **flat, grouped by kind** ({@linkcode PluginSmartLayoutResult}), NOT attributed
1366
+ * per target (per-target attribution would break the single-undo guarantee).
1367
+ * `skippedWalls` is the interior-optimizer's best-candidate count of walls it
1368
+ * could not place. Synchronous and heavy — many targets can jank the main thread.
1369
+ *
1370
+ * @param options - {@linkcode PluginSmartLayoutArgs}: template source, targets, and `hideTargets`
1371
+ * @returns a {@linkcode PluginSmartLayoutResult} — created entities grouped by kind + `skippedWalls`
1372
+ * @throws if smart layout is not enabled, the template group is invalid, there
1373
+ * is no template / no targets / no valid mappings, or component creation fails
1374
+ *
1375
+ * @examplePrompt Copy this room's layout into the selected rooms
1376
+ * @examplePrompt Apply this furniture arrangement to the other offices
1377
+ * @examplePrompt Replicate this template into these two spaces
1378
+ * @examplePrompt Place this desk cluster into every meeting room
1379
+ * @examplePrompt Use this room as a template for the rooms I selected but keep them visible
1380
+ *
1381
+ * # Example
1382
+ * ```ts
1383
+ * const [templateRoom, ...targets] = await snaptrude.design.query.listSpaces({ isSelected: true })
1384
+ * const result = await snaptrude.design.create.smartLayout({
1385
+ * templateComponents: [templateRoom],
1386
+ * targets,
1387
+ * })
1388
+ * console.log("placed walls:", result.created.walls.length, "skipped:", result.skippedWalls)
1389
+ *
1390
+ * // …or clone a saved group by its id (from core.groups.list)
1391
+ * const { groups } = await snaptrude.core.groups.list()
1392
+ * await snaptrude.design.create.smartLayout({ templateGroup: groups[0].id, targets })
1393
+ * ```
1394
+ */
1395
+ public abstract smartLayout(
1396
+ options: PluginSmartLayoutArgs,
1397
+ ): PluginApiReturn<PluginSmartLayoutResult>
1398
+
1399
+ /**
1400
+ * **Copy** existing entities, offsetting each copy by `displacement * i` (i = 1…count),
1401
+ * source positions preserved. Migrated from the removed `tools.copy`. In `"instance"`
1402
+ * mode copies stay in the source's instance family where possible; `"unique"` makes
1403
+ * independent geometry. The created copies become the active selection. Undoable.
1404
+ *
1405
+ * Runs on the engine's array-copy tool, so its semantics carry over: an
1406
+ * `"instance"` copy of a source that is not yet an instance **replaces that
1407
+ * source** with a fresh instance component — the handle you passed in stops
1408
+ * resolving after the call. Re-query (e.g. `design.query.listSpaces`) to pick
1409
+ * up the replacement before operating on that entity again; copying the stale
1410
+ * handle throws. `"unique"` mode never replaces sources.
1411
+ *
1412
+ * @param components - Entities to copy (≥1)
1413
+ * @param displacement - Per-copy offset as a {@linkcode Vec3Handle} (copy `i` at `displacement * i`)
1414
+ * @param options - `count` (copies per component, default 1), `mode` (`"instance"` | `"unique"`, default `"instance"`)
1415
+ * @returns the created copies as {@linkcode ComponentHandle}`[]`
1416
+ * @throws if a component handle is unknown or stale (replaced by an earlier
1417
+ * `"instance"` copy), `count` is not a positive integer, or the engine fails
1418
+ *
1419
+ * @examplePrompt Copy this room 3 times spaced 6m apart
1420
+ * @examplePrompt Duplicate the selected furniture along the X axis
1421
+ * @examplePrompt Make 5 copies of this column at 4 metre intervals
1422
+ * @examplePrompt Array these walls with a 3m offset
1423
+ * @examplePrompt Clone the desk as a unique copy, not an instance
1424
+ *
1425
+ * @performance To place N repeats of the same geometry, bulk-create the seed(s) once then
1426
+ * call this ONCE with `{ count: N - 1 }` — one host round-trip for all copies. Never
1427
+ * reproduce geometry by looping `design.create.*` N times. Copy only after the create
1428
+ * that mints the seed ids.
1429
+ *
1430
+ * # Example
1431
+ * ```ts
1432
+ * const { vec3 } = snaptrude.core.math
1433
+ * const copies = await snaptrude.design.create.copy(["space-id"], vec3.new(6, 0, 0), { count: 3 })
1434
+ * ```
1435
+ */
1436
+ public abstract copy(
1437
+ components: ComponentHandle[],
1438
+ displacement: Vec3Handle,
1439
+ options?: { count?: number; mode?: PluginCopyMode },
1440
+ ): PluginApiReturn<ComponentHandle[]>
1441
+
1442
+ /**
1443
+ * Create **many spaces** in one undoable operation (bulk plural of {@linkcode space}).
1444
+ * Migrated from the removed `entity.space.bulkCreate`. Each item extrudes a contour
1445
+ * footprint up `height`. Validate-all-or-throw; one command. For a rectangular
1446
+ * (box) space, build the footprint with `core.geom.create.profileRect` →
1447
+ * `contourFromProfile`, then pass it as an item. Each item may carry its own
1448
+ * `storey` (see {@linkcode PluginCreateSpaceItem}) so a single call can populate
1449
+ * several floors at once.
1450
+ *
1451
+ * @param items - One {@linkcode PluginCreateSpaceItem} per space to create (≥1)
1452
+ * @returns the created spaces as {@linkcode ComponentHandle}`[]`, in input order
1453
+ * @throws if any item's contour is invalid, its height is not positive, or its
1454
+ * target `storey` does not exist (all-or-nothing — nothing is created)
1455
+ *
1456
+ * @examplePrompt Create several rooms at once from these footprints
1457
+ * @examplePrompt Generate all the bedrooms in one operation
1458
+ * @examplePrompt Bulk create the spaces for this floor plan
1459
+ * @examplePrompt Add three rooms with different heights in a single undo step
1460
+ * @examplePrompt Create one room on the ground floor and one on the first floor
1461
+ *
1462
+ * @performance Bulk creator — the whole batch is ONE host round-trip. Always prefer this
1463
+ * over calling `design.create.space` in a loop: build the full `items[]` array first
1464
+ * (all per-item math and geometry up front), then make one call.
1465
+ *
1466
+ * # Example
1467
+ * ```ts
1468
+ * const rect = await snaptrude.core.geom.create.profileRect(4, 3)
1469
+ * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
1470
+ * const [a, b] = await snaptrude.design.create.spaces([
1471
+ * { contour, height: 3, label: "R1" },
1472
+ * { contour, height: 4, label: "R2", position: await vec3.new(10, 0, 0) },
1473
+ * ])
1474
+ * ```
1475
+ */
1476
+ public abstract spaces(
1477
+ items: PluginCreateSpaceItem[],
1478
+ ): PluginApiReturn<ComponentHandle[]>
1479
+
1480
+ /**
1481
+ * Create a new parametric buildable envelope — the zoning-regulated volume a
1482
+ * building may occupy — generated from a site polygon, tiered setbacks, a
1483
+ * height or floor-count cap, and optional FAR and lot-coverage limits. The host
1484
+ * mints the envelope id and returns it. Canonical home of the create formerly
1485
+ * at `entity.buildableEnvelope.create` (now deprecated).
1486
+ *
1487
+ * @param sitePolygon - Site polygon vertices in `lengthUnit`; minimum 3 vertices.
1488
+ * @param lengthUnit - Unit used by all length fields (`"ft" | "m"`).
1489
+ * @param setbacks - Setback profile, ground tier first; minimum 1 tier.
1490
+ * @param verticalCap - Maximum height or floor count.
1491
+ * @param floorToFloor - Required floor-to-floor height in `lengthUnit`.
1492
+ * @param farRatio - Optional FAR value, positive when provided.
1493
+ * @param lotCoverageMaxPct - Optional lot coverage cap, `0..100`.
1494
+ * @returns A {@linkcode PluginBuildableEnvelopeCreateResult} with the
1495
+ * `buildableEnvelopeId` of the created envelope.
1496
+ * @throws If validation fails or generation produces no renderable geometry.
1497
+ *
1498
+ * @examplePrompt Create a buildable envelope for my site
1499
+ * @examplePrompt Generate the zoning envelope with 10ft front setbacks
1500
+ * @examplePrompt Show the maximum buildable volume with a 150ft height limit
1501
+ * @examplePrompt Create a zoning envelope capped at 12 floors with FAR 3
1502
+ *
1503
+ * # Example
1504
+ * ```ts
1505
+ * const { buildableEnvelopeId } = await snaptrude.design.create.buildableEnvelope(
1506
+ * [
1507
+ * { x: 0, z: 0 },
1508
+ * { x: 100, z: 0 },
1509
+ * { x: 100, z: 80 },
1510
+ * { x: 0, z: 80 },
1511
+ * ],
1512
+ * "ft",
1513
+ * [
1514
+ * { aboveHeight: 0, front: 10, side: 5, rear: 10 },
1515
+ * { aboveHeight: 100, front: 20, side: 10, rear: 20 },
1516
+ * ],
1517
+ * { kind: "max_height", maxHeight: 150 },
1518
+ * 12,
1519
+ * )
1520
+ * ```
1521
+ */
1522
+ public abstract buildableEnvelope(
1523
+ sitePolygon: PluginBuildableEnvelopePolygonVertex[],
1524
+ lengthUnit: "ft" | "m",
1525
+ setbacks: PluginBuildableEnvelopeSetbackTier[],
1526
+ verticalCap: PluginBuildableEnvelopeVerticalCap,
1527
+ floorToFloor: number,
1528
+ farRatio?: number,
1529
+ lotCoverageMaxPct?: number,
1530
+ ): PluginApiReturn<PluginBuildableEnvelopeCreateResult>
1531
+ }
1532
+
1533
+ // ---------------------------------------------------------------------------
1534
+ // Enums
1535
+ // ---------------------------------------------------------------------------
1536
+
1537
+ /**
1538
+ * Line style of a reference line (mirrors the engine `ReferenceLineMode` verbatim).
1539
+ *
1540
+ * | Value | Description |
1541
+ * |---|---|
1542
+ * | `"SOLID"` | Solid line (default) |
1543
+ * | `"DASHED"` | Dashed line |
1544
+ * | `"DOT_DASH"` | Dot-dash line |
1545
+ */
1546
+ export const PluginReferenceLineStyle = z.enum(["SOLID", "DASHED", "DOT_DASH"])
1547
+ export type PluginReferenceLineStyle = z.infer<typeof PluginReferenceLineStyle>
1548
+
1549
+ /**
1550
+ * Slab type (mirrors the engine `SLAB_TYPES` values verbatim).
1551
+ *
1552
+ * | Value | Description |
1553
+ * |---|---|
1554
+ * | `"Intermediate Slab"` | Intermediate floor slab (default) |
1555
+ * | `"Basement Slab"` | Basement slab |
1556
+ * | `"Plinth"` | Plinth slab |
1557
+ * | `"Roof"` | Roof slab |
1558
+ */
1559
+ export const PluginSlabType = z.enum([
1560
+ "Intermediate Slab",
1561
+ "Basement Slab",
1562
+ "Plinth",
1563
+ "Roof",
1564
+ ])
1565
+ export type PluginSlabType = z.infer<typeof PluginSlabType>
1566
+
1567
+ /**
1568
+ * A staircase preset — a base type or a named parametric preset. Mirrors the
1569
+ * engine `STAIRCASE_PRESETS` / `StaircaseType`. Use the value that matches the
1570
+ * shape you want (e.g. `"straight"`, `"dogLegged"`, `"lShaped"`).
1571
+ */
1572
+ export const PluginStaircasePreset = z.enum([
1573
+ "straight",
1574
+ "straightWoLanding",
1575
+ "straightFlightWoMidLanding",
1576
+ "dogLegged",
1577
+ "openWell",
1578
+ "lShaped",
1579
+ "3StepLShaped",
1580
+ "square",
1581
+ "singleStep",
1582
+ "plinthLevel",
1583
+ "amphitheatre",
1584
+ "connectingStepsToAmphitheatre",
1585
+ "mezzanineFloorStraight",
1586
+ "mezzanineFloorDogLegged",
1587
+ "mezzanineFloorLShaped",
1588
+ "custom",
1589
+ ])
1590
+ export type PluginStaircasePreset = z.infer<typeof PluginStaircasePreset>
1591
+
1592
+ /**
1593
+ * Optional staircase dimension overrides. Lengths use Snaptrude engine units
1594
+ * and must be positive. `angleInDegrees` controls placement about the vertical
1595
+ * axis and must be a multiple of 90 degrees.
1596
+ */
1597
+ export const PluginStaircaseDimensions = z
1598
+ .object({
1599
+ width: z.number().finite().positive().optional(),
1600
+ tread: z.number().finite().positive().optional(),
1601
+ riser: z.number().finite().positive().optional(),
1602
+ landingWidth: z.number().finite().positive().optional(),
1603
+ angleInDegrees: z.number().finite().multipleOf(90).optional(),
1604
+ })
1605
+ .strict()
1606
+ export type PluginStaircaseDimensions = z.infer<
1607
+ typeof PluginStaircaseDimensions
1608
+ >
1609
+
1610
+ // ---------------------------------------------------------------------------
1611
+ // space
1612
+ // ---------------------------------------------------------------------------
1613
+
1614
+ /**
1615
+ * Arguments for {@linkcode PluginDesignCreateApi.space}.
1616
+ *
1617
+ * | Property | Type | Description |
1618
+ * |---|---|---|
1619
+ * | `contour` | {@linkcode ContourHandle} | Bottom footprint (outer + holes) |
1620
+ * | `height` | `number` | Extrusion height (Snaptrude units, > 0) |
1621
+ * | `label` | `string`? | Room label (maps to the space's `room_type`) |
1622
+ * | `position` | {@linkcode Vec3Handle}? | Offset from origin (default origin) |
1623
+ * | `spaceType` | {@linkcode PluginSpaceType}? | Space-type classification (default `Room`) |
1624
+ * | `massType` | {@linkcode PluginMassType}? | Mass-type classification (default `Room`) |
1625
+ * | `departmentId` | {@linkcode PluginDepartmentId}? | Department assignment (default department) |
1626
+ * | `storey` | `number`? (int) | Target storey number (default active storey) |
1627
+ */
1628
+ export const PluginDesignCreateSpaceArgs = z.object({
1629
+ contour: ContourHandle,
1630
+ height: z.number(),
1631
+ label: z.string().optional(),
1632
+ position: Vec3Handle.optional(),
1633
+ spaceType: PluginSpaceType.optional(),
1634
+ massType: PluginMassType.optional(),
1635
+ departmentId: PluginDepartmentId.optional(),
1636
+ storey: z.number().int().optional(),
1637
+ })
1638
+ export type PluginDesignCreateSpaceArgs = z.infer<
1639
+ typeof PluginDesignCreateSpaceArgs
1640
+ >
1641
+ // TRANSPORT: positional signature shipped — storey is the trailing 8th arg:
1642
+ // space(contour, height, label?, position?, spaceType?, massType?, departmentId?, storey?)
1643
+
1644
+ // ---------------------------------------------------------------------------
1645
+ // mass
1646
+ // ---------------------------------------------------------------------------
1647
+
1648
+ /**
1649
+ * Arguments for {@linkcode PluginDesignCreateApi.mass}.
1650
+ *
1651
+ * | Property | Type | Description |
1652
+ * |---|---|---|
1653
+ * | `contour` | {@linkcode ContourHandle} | Footprint (outer + holes) |
1654
+ * | `height` | `number` | Extrusion height (> 0) |
1655
+ * | `label` | `string`? | Label (maps to `room_type`) |
1656
+ * | `position` | {@linkcode Vec3Handle}? | Offset from origin |
1657
+ * | `massType` | {@linkcode PluginMassType}? | Mass type (default `Generic mass`) |
1658
+ */
1659
+ export const PluginDesignCreateMassArgs = z.object({
1660
+ contour: ContourHandle,
1661
+ height: z.number(),
1662
+ label: z.string().optional(),
1663
+ position: Vec3Handle.optional(),
1664
+ massType: PluginMassType.optional(),
1665
+ })
1666
+ export type PluginDesignCreateMassArgs = z.infer<
1667
+ typeof PluginDesignCreateMassArgs
1668
+ >
1669
+
1670
+ // ---------------------------------------------------------------------------
1671
+ // massFromBrep
1672
+ // ---------------------------------------------------------------------------
1673
+
1674
+ /**
1675
+ * Arguments for {@linkcode PluginDesignCreateApi.massFromBrep}.
1676
+ *
1677
+ * | Property | Type | Description |
1678
+ * |---|---|---|
1679
+ * | `brep` | {@linkcode BrepHandle} | A solid from a `core.geom.create` brep constructor |
1680
+ * | `label` | `string`? | Label (maps to `room_type`) |
1681
+ */
1682
+ export const PluginDesignCreateMassFromBrepArgs = z.object({
1683
+ brep: BrepHandle,
1684
+ label: z.string().optional(),
1685
+ })
1686
+ export type PluginDesignCreateMassFromBrepArgs = z.infer<
1687
+ typeof PluginDesignCreateMassFromBrepArgs
1688
+ >
1689
+
1690
+ // ---------------------------------------------------------------------------
1691
+ // slab
1692
+ // ---------------------------------------------------------------------------
1693
+
1694
+ /**
1695
+ * Arguments for {@linkcode PluginDesignCreateApi.slab}.
1696
+ *
1697
+ * | Property | Type | Description |
1698
+ * |---|---|---|
1699
+ * | `contour` | {@linkcode ContourHandle} | Footprint (outer + holes) |
1700
+ * | `thickness` | `number` | Slab thickness (> 0) |
1701
+ * | `direction` | `"up" \| "down"`? | Extrusion direction (default `"down"`) |
1702
+ * | `slabType` | {@linkcode PluginSlabType}? | Slab-type classification |
1703
+ */
1704
+ export const PluginDesignCreateSlabArgs = z.object({
1705
+ contour: ContourHandle,
1706
+ thickness: z.number(),
1707
+ direction: z.enum(["up", "down"]).optional(),
1708
+ slabType: PluginSlabType.optional(),
1709
+ })
1710
+ export type PluginDesignCreateSlabArgs = z.infer<
1711
+ typeof PluginDesignCreateSlabArgs
1712
+ >
1713
+
1714
+ // ---------------------------------------------------------------------------
1715
+ // floor
1716
+ // ---------------------------------------------------------------------------
1717
+
1718
+ /**
1719
+ * Arguments for {@linkcode PluginDesignCreateApi.floor}.
1720
+ *
1721
+ * | Property | Type | Description |
1722
+ * |---|---|---|
1723
+ * | `contour` | {@linkcode ContourHandle} | Footprint (outer + holes) |
1724
+ * | `thickness` | `number` | Floor thickness (> 0) |
1725
+ * | `position` | {@linkcode Vec3Handle}? | Offset from origin |
1726
+ */
1727
+ export const PluginDesignCreateFloorArgs = z.object({
1728
+ contour: ContourHandle,
1729
+ thickness: z.number(),
1730
+ position: Vec3Handle.optional(),
1731
+ })
1732
+ export type PluginDesignCreateFloorArgs = z.infer<
1733
+ typeof PluginDesignCreateFloorArgs
1734
+ >
1735
+
1736
+ // ---------------------------------------------------------------------------
1737
+ // roof
1738
+ // ---------------------------------------------------------------------------
1739
+
1740
+ /**
1741
+ * Arguments for {@linkcode PluginDesignCreateApi.roof}.
1742
+ *
1743
+ * | Property | Type | Description |
1744
+ * |---|---|---|
1745
+ * | `contour` | {@linkcode ContourHandle} | Footprint (outer + holes) |
1746
+ * | `thickness` | `number` | Roof-slab thickness (> 0) |
1747
+ */
1748
+ export const PluginDesignCreateRoofArgs = z.object({
1749
+ contour: ContourHandle,
1750
+ thickness: z.number(),
1751
+ })
1752
+ export type PluginDesignCreateRoofArgs = z.infer<
1753
+ typeof PluginDesignCreateRoofArgs
1754
+ >
1755
+
1756
+ // ---------------------------------------------------------------------------
1757
+ // ceiling
1758
+ // ---------------------------------------------------------------------------
1759
+
1760
+ /**
1761
+ * Arguments for {@linkcode PluginDesignCreateApi.ceiling}.
1762
+ *
1763
+ * | Property | Type | Description |
1764
+ * |---|---|---|
1765
+ * | `contour` | {@linkcode ContourHandle} | Footprint (outer + holes) |
1766
+ * | `thickness` | `number` | Ceiling thickness (> 0) |
1767
+ * | `heightFromFloor` | `number`? | Lift above the floor (default 0) |
1768
+ */
1769
+ export const PluginDesignCreateCeilingArgs = z.object({
1770
+ contour: ContourHandle,
1771
+ thickness: z.number(),
1772
+ heightFromFloor: z.number().optional(),
1773
+ })
1774
+ export type PluginDesignCreateCeilingArgs = z.infer<
1775
+ typeof PluginDesignCreateCeilingArgs
1776
+ >
1777
+
1778
+ // ---------------------------------------------------------------------------
1779
+ // column
1780
+ // ---------------------------------------------------------------------------
1781
+
1782
+ /**
1783
+ * Arguments for {@linkcode PluginDesignCreateApi.column}.
1784
+ *
1785
+ * | Property | Type | Description |
1786
+ * |---|---|---|
1787
+ * | `position` | {@linkcode Vec3Handle} | Base point |
1788
+ * | `crossSection` | {@linkcode ContourHandle} | Column cross-section footprint |
1789
+ * | `height` | `number` | Column height (> 0) |
1790
+ * | `directionUp` | {@linkcode Vec3Handle}? | Up axis (default world up) |
1791
+ */
1792
+ export const PluginDesignCreateColumnArgs = z.object({
1793
+ position: Vec3Handle,
1794
+ crossSection: ContourHandle,
1795
+ height: z.number(),
1796
+ directionUp: Vec3Handle.optional(),
1797
+ })
1798
+ export type PluginDesignCreateColumnArgs = z.infer<
1799
+ typeof PluginDesignCreateColumnArgs
1800
+ >
1801
+
1802
+ // ---------------------------------------------------------------------------
1803
+ // beam
1804
+ // ---------------------------------------------------------------------------
1805
+
1806
+ /**
1807
+ * Arguments for {@linkcode PluginDesignCreateApi.beam}.
1808
+ *
1809
+ * | Property | Type | Description |
1810
+ * |---|---|---|
1811
+ * | `section` | {@linkcode ContourHandle} | Beam cross-section footprint |
1812
+ * | `length` | `number` | Beam length along `direction` (> 0) |
1813
+ * | `direction` | {@linkcode Vec3Handle}? | Extrusion axis (default world up) |
1814
+ */
1815
+ export const PluginDesignCreateBeamArgs = z.object({
1816
+ section: ContourHandle,
1817
+ length: z.number(),
1818
+ direction: Vec3Handle.optional(),
1819
+ })
1820
+ export type PluginDesignCreateBeamArgs = z.infer<
1821
+ typeof PluginDesignCreateBeamArgs
1822
+ >
1823
+
1824
+ // ---------------------------------------------------------------------------
1825
+ // walls
1826
+ // ---------------------------------------------------------------------------
1827
+
1828
+ /**
1829
+ * Arguments for {@linkcode PluginDesignCreateApi.walls}.
1830
+ *
1831
+ * | Property | Type | Description |
1832
+ * |---|---|---|
1833
+ * | `profile` | {@linkcode ProfileHandle} | Ordered curve chain (wall centerlines) |
1834
+ * | `height` | `number`? | Wall height (default engine default) |
1835
+ * | `thickness` | `number`? | Wall thickness (default: `wallType`'s total layer thickness when given, else engine default) |
1836
+ * | `wallType` | {@linkcode PluginWallType}? | Legacy name/id or exact native `{ id, version }` pin from `design.types.list("wall")` (default generic) |
1837
+ * | `storey` | `number`? | Target storey (integer, must exist) — walls assigned + lifted to its base in the same undo entry (default: geometry-derived) |
1838
+ * | `topProfiles` | ({@linkcode PluginWallTopProfile} \| `null`)[]? | Top edge per curve (same order); `null`/missing = flat at `height`. Straight curves only |
1839
+ */
1840
+ export const PluginDesignCreateWallsArgs = z.object({
1841
+ profile: ProfileHandle,
1842
+ height: z.number().optional(),
1843
+ thickness: z.number().optional(),
1844
+ wallType: PluginWallType.optional(),
1845
+ storey: z.number().int().optional(),
1846
+ topProfiles: z.array(PluginWallTopProfile.nullable()).optional(),
1847
+ values: PluginFamilyValues.optional(),
1848
+ })
1849
+ export type PluginDesignCreateWallsArgs = z.infer<
1850
+ typeof PluginDesignCreateWallsArgs
1851
+ >
1852
+ // TRANSPORT: positional signature shipped — storey is the 5th arg, topProfiles the trailing 6th:
1853
+ // walls(profile: ProfileHandle, height?: number, thickness?: number, wallType?: string, storey?: number, topProfiles?: (PluginWallTopProfile | null)[])
1854
+
1855
+ // ---------------------------------------------------------------------------
1856
+ // staircase
1857
+ // ---------------------------------------------------------------------------
1858
+
1859
+ /**
1860
+ * Arguments for {@linkcode PluginDesignCreateApi.staircase}.
1861
+ *
1862
+ * | Property | Type | Description |
1863
+ * |---|---|---|
1864
+ * | `preset` | {@linkcode PluginStaircasePreset} | The parametric preset to generate |
1865
+ * | `position` | {@linkcode Vec3Handle} | Placement point |
1866
+ * | `label` | `string`? | Optional label |
1867
+ * | `structureId` | `string`? | Target structure (default active) |
1868
+ * | `level` | `string`? | Target level name (default active/`"01"`) |
1869
+ * | `dimensions` | {@linkcode PluginStaircaseDimensions}? | Positive dimension overrides in engine units, applied before creation |
1870
+ */
1871
+ export const PluginDesignCreateStaircaseArgs = z.object({
1872
+ preset: PluginStaircasePreset,
1873
+ position: Vec3Handle,
1874
+ label: z.string().optional(),
1875
+ structureId: z.string().optional(),
1876
+ level: z.string().optional(),
1877
+ dimensions: PluginStaircaseDimensions.optional(),
1878
+ })
1879
+ export type PluginDesignCreateStaircaseArgs = z.infer<
1880
+ typeof PluginDesignCreateStaircaseArgs
1881
+ >
1882
+
1883
+ // ---------------------------------------------------------------------------
1884
+ // furniture
1885
+ // ---------------------------------------------------------------------------
1886
+
1887
+ /**
1888
+ * Arguments for {@linkcode PluginDesignCreateApi.furniture}.
1889
+ *
1890
+ * | Property | Type | Description |
1891
+ * |---|---|---|
1892
+ * | `catalogId` | `string` | Library id: team `_id` or general `fullName` |
1893
+ * | `position` | {@linkcode Vec3Handle} | Absolute world placement point |
1894
+ * | `label` | `string`? | Instance name (default auto `${name}Ins${n}`) |
1895
+ * | `createNewSourceMesh` | `boolean`? | Legacy, kept for compatibility; the host records a catalog source exactly once and this flag cannot skip it |
1896
+ * | `angleInDegrees` | `number`? | Rotation about the vertical axis, in degrees (default unrotated) |
1897
+ */
1898
+ export const PluginDesignCreateFurnitureArgs = z.object({
1899
+ catalogId: z.string().min(1),
1900
+ position: Vec3Handle,
1901
+ label: z.string().optional(),
1902
+ createNewSourceMesh: z.boolean().optional(),
1903
+ angleInDegrees: z.number().optional(),
1904
+ })
1905
+ export type PluginDesignCreateFurnitureArgs = z.infer<
1906
+ typeof PluginDesignCreateFurnitureArgs
1907
+ >
1908
+ // TRANSPORT: positional signature shipped — angleInDegrees is the trailing 4th arg:
1909
+ // furniture(catalogId: string, position: Vec3Handle, options?: { label?, createNewSourceMesh? }, angleInDegrees?: number)
1910
+
1911
+ // ---------------------------------------------------------------------------
1912
+ // door
1913
+ // ---------------------------------------------------------------------------
1914
+
1915
+ /**
1916
+ * Arguments for {@linkcode PluginDesignCreateApi.door}.
1917
+ *
1918
+ * | Property | Type | Description |
1919
+ * |---|---|---|
1920
+ * | `familyId` | `string` | Hosted door family definition ID |
1921
+ * | `version` | `number`? | Exact version; newest known by default |
1922
+ * | `values` | `Record<string, number \| string>`? | Parameters; numeric lengths use SU |
1923
+ * | `hostWall` | {@linkcode ComponentHandle} | The wall to host the door |
1924
+ * | `position` | {@linkcode Vec3Handle} | World point projected onto the wall |
1925
+ * | `label` | `string`? | Instance name (optional) |
1926
+ * | `facing` | {@linkcode Vec3Handle}? | World point on the side of the wall the door swings open to (default engine-chosen) |
1927
+ * | `hinge` | {@linkcode Vec3Handle}? | World point near the hinged jamb; requires hand control |
1928
+ */
1929
+ export const PluginDesignCreateDoorArgs = z.object({
1930
+ ...PluginOpeningBaseOptions,
1931
+ })
1932
+ export type PluginDesignCreateDoorArgs = z.infer<
1933
+ typeof PluginDesignCreateDoorArgs
1934
+ >
1935
+ // TRANSPORT: positional signature shipped — facing is the trailing 5th arg, hinge rides in options:
1936
+ // door(familyId, hostWall, position, options?: { label?, hinge?, version?, values? }, facing?)
1937
+
1938
+ // ---------------------------------------------------------------------------
1939
+ // window
1940
+ // ---------------------------------------------------------------------------
1941
+
1942
+ /**
1943
+ * Arguments for {@linkcode PluginDesignCreateApi.window}.
1944
+ *
1945
+ * | Property | Type | Description |
1946
+ * |---|---|---|
1947
+ * | `familyId` | `string` | Hosted window family definition ID |
1948
+ * | `version` | `number`? | Exact version; newest known by default |
1949
+ * | `values` | `Record<string, number \| string>`? | Parameters; numeric lengths use SU |
1950
+ * | `hostWall` | {@linkcode ComponentHandle} | The wall to host the window |
1951
+ * | `position` | {@linkcode Vec3Handle} | World point projected onto the wall |
1952
+ * | `label` | `string`? | Instance name (optional) |
1953
+ * | `facing` | {@linkcode Vec3Handle}? | World point on the side of the wall the window opens to (default engine-chosen) |
1954
+ * | `hinge` | {@linkcode Vec3Handle}? | World point near the hinged jamb; requires hand control |
1955
+ */
1956
+ export const PluginDesignCreateWindowArgs = z.object({
1957
+ ...PluginOpeningBaseOptions,
1958
+ })
1959
+ export type PluginDesignCreateWindowArgs = z.infer<
1960
+ typeof PluginDesignCreateWindowArgs
1961
+ >
1962
+ // TRANSPORT: positional signature shipped — facing is the trailing 5th arg, hinge rides in options:
1963
+ // window(familyId, hostWall, position, options?: { label?, hinge?, version?, values? }, facing?)
1964
+
1965
+ // ---------------------------------------------------------------------------
1966
+ // opening
1967
+ // ---------------------------------------------------------------------------
1968
+
1969
+ /**
1970
+ * Options for {@linkcode PluginDesignCreateApi.opening}, discriminated by
1971
+ * `kind`. Width and height are positive Snaptrude engine-unit values.
1972
+ * `sillHeight` is available only for windows, is nonnegative, and is precisely
1973
+ * the distance from the host wall base to the bottom of the window.
1974
+ */
1975
+ export const PluginDesignCreateOpeningOptions = z.discriminatedUnion("kind", [
1976
+ z
1977
+ .object({
1978
+ kind: z.literal("door"),
1979
+ ...PluginOpeningBaseOptions,
1980
+ })
1981
+ .strict(),
1982
+ z
1983
+ .object({
1984
+ kind: z.literal("window"),
1985
+ ...PluginOpeningBaseOptions,
1986
+ sillHeight: z.number().finite().nonnegative().optional(),
1987
+ })
1988
+ .strict(),
1989
+ ])
1990
+ export type PluginDesignCreateOpeningOptions = z.infer<
1991
+ typeof PluginDesignCreateOpeningOptions
1992
+ >
1993
+
1994
+ // ---------------------------------------------------------------------------
1995
+ // smartLayout
1996
+ // ---------------------------------------------------------------------------
1997
+
1998
+ /**
1999
+ * Arguments for {@linkcode PluginDesignCreateApi.smartLayout}. Provide **exactly
2000
+ * one** template source: `templateGroup` or a non-empty `templateComponents`.
2001
+ *
2002
+ * | Property | Type | Description |
2003
+ * |---|---|---|
2004
+ * | `templateGroup` | `string`? | Id of the group to clone as the template (a group id from `snaptrude.core.groups.list`, NOT a component handle) |
2005
+ * | `templateComponents` | {@linkcode ComponentHandle}`[]`? | Explicit component set to clone as the template |
2006
+ * | `targets` | {@linkcode ComponentHandle}`[]` | ROOM/DEPARTMENT spaces to place into (≥1) |
2007
+ * | `hideTargets` | `boolean`? | Hide the target spaces after placement (default `true`) |
2008
+ */
2009
+ export const PluginSmartLayoutArgs = z
2010
+ .object({
2011
+ templateGroup: z.string().min(1).optional(),
2012
+ templateComponents: z.array(ComponentHandle).optional(),
2013
+ targets: z.array(ComponentHandle).min(1),
2014
+ hideTargets: z.boolean().optional(),
2015
+ })
2016
+ .refine(
2017
+ (v) =>
2018
+ (v.templateGroup != null) !== (v.templateComponents?.length ?? 0) > 0,
2019
+ {
2020
+ message:
2021
+ "Provide exactly one template source: templateGroup or a non-empty templateComponents",
2022
+ },
2023
+ )
2024
+ export type PluginSmartLayoutArgs = z.infer<typeof PluginSmartLayoutArgs>
2025
+
2026
+ /**
2027
+ * Result of {@linkcode PluginDesignCreateApi.smartLayout} — the entities the run
2028
+ * created, grouped by kind (flat across all targets; see the method JSDoc for why
2029
+ * this is not attributed per target).
2030
+ *
2031
+ * | Property | Type | Description |
2032
+ * |---|---|---|
2033
+ * | `created.walls` | {@linkcode ComponentHandle}`[]` | Created walls |
2034
+ * | `created.furniture` | {@linkcode ComponentHandle}`[]` | Created furniture |
2035
+ * | `created.doors` | {@linkcode ComponentHandle}`[]` | Created doors |
2036
+ * | `created.windows` | {@linkcode ComponentHandle}`[]` | Created windows |
2037
+ * | `created.floors` | {@linkcode ComponentHandle}`[]` | Created floors |
2038
+ * | `skippedWalls` | `number` | Walls the interior optimizer could not place |
2039
+ */
2040
+ export const PluginSmartLayoutResult = z.object({
2041
+ created: z.object({
2042
+ walls: z.array(ComponentHandle),
2043
+ furniture: z.array(ComponentHandle),
2044
+ doors: z.array(ComponentHandle),
2045
+ windows: z.array(ComponentHandle),
2046
+ floors: z.array(ComponentHandle),
2047
+ }),
2048
+ skippedWalls: z.number(),
2049
+ })
2050
+ export type PluginSmartLayoutResult = z.infer<typeof PluginSmartLayoutResult>
2051
+
2052
+ // ---------------------------------------------------------------------------
2053
+ // referenceLines
2054
+ // ---------------------------------------------------------------------------
2055
+
2056
+ /**
2057
+ * Arguments for {@linkcode PluginDesignCreateApi.referenceLines}.
2058
+ *
2059
+ * | Property | Type | Description |
2060
+ * |---|---|---|
2061
+ * | `profile` | {@linkcode ProfileHandle} | Ordered curve chain (centerlines) |
2062
+ * | `color` | `string`? | Hex color `"#RRGGBB"` (default white) |
2063
+ * | `thickness` | `number`? | Line thickness (default 1) |
2064
+ * | `style` | {@linkcode PluginReferenceLineStyle}? | Line style (default `SOLID`) |
2065
+ * | `gridTag` | `string`? | Grid tag label (default `"A"`) |
2066
+ */
2067
+ export const PluginDesignCreateReferenceLinesArgs = z.object({
2068
+ profile: ProfileHandle,
2069
+ color: z.string().optional(),
2070
+ thickness: z.number().optional(),
2071
+ style: PluginReferenceLineStyle.optional(),
2072
+ gridTag: z.string().optional(),
2073
+ })
2074
+ export type PluginDesignCreateReferenceLinesArgs = z.infer<
2075
+ typeof PluginDesignCreateReferenceLinesArgs
2076
+ >
2077
+
2078
+ // ---------------------------------------------------------------------------
2079
+ // copy
2080
+ // ---------------------------------------------------------------------------
2081
+
2082
+ /**
2083
+ * Copy mode for {@linkcode PluginDesignCreateApi.copy}.
2084
+ *
2085
+ * | Value | Description |
2086
+ * |---|---|
2087
+ * | `"instance"` | Keep copies in the source's instance family where possible |
2088
+ * | `"unique"` | Independent geometry copies |
2089
+ */
2090
+ export const PluginCopyMode = z.enum(["instance", "unique"])
2091
+ export type PluginCopyMode = z.infer<typeof PluginCopyMode>
2092
+
2093
+ /**
2094
+ * Arguments for {@linkcode PluginDesignCreateApi.copy} (options flattened).
2095
+ *
2096
+ * | Property | Type | Description |
2097
+ * |---|---|---|
2098
+ * | `components` | {@linkcode ComponentHandle}`[]` | Entities to copy (≥1) |
2099
+ * | `displacement` | {@linkcode Vec3Handle} | Per-copy offset (copy `i` at `displacement * i`) |
2100
+ * | `count` | `number`? | Copies per component (default 1) |
2101
+ * | `mode` | {@linkcode PluginCopyMode}? | `"instance"` (default) or `"unique"` |
2102
+ */
2103
+ export const PluginDesignCreateCopyArgs = z.object({
2104
+ components: z.array(ComponentHandle).min(1),
2105
+ displacement: Vec3Handle,
2106
+ count: z.number().int().positive().optional(),
2107
+ mode: PluginCopyMode.optional(),
2108
+ })
2109
+ export type PluginDesignCreateCopyArgs = z.infer<
2110
+ typeof PluginDesignCreateCopyArgs
2111
+ >
2112
+ // TRANSPORT: positional signature shipped —
2113
+ // copy(components: ComponentHandle[], displacement: Vec3Handle, options?: { count?, mode? })
2114
+
2115
+ // ---------------------------------------------------------------------------
2116
+ // spaces (bulk)
2117
+ // ---------------------------------------------------------------------------
2118
+
2119
+ /**
2120
+ * One space to create via {@linkcode PluginDesignCreateApi.spaces} — the same
2121
+ * footprint-extrude inputs as {@linkcode PluginDesignCreateApi.space}.
2122
+ *
2123
+ * | Property | Type | Description |
2124
+ * |---|---|---|
2125
+ * | `contour` | {@linkcode ContourHandle} | Footprint (outer profile + holes) |
2126
+ * | `height` | `number` | Extrude height |
2127
+ * | `label` | `string`? | Room label |
2128
+ * | `position` | {@linkcode Vec3Handle}? | Placement offset |
2129
+ * | `spaceType` | `PluginSpaceType`? | Space type |
2130
+ * | `massType` | `PluginMassType`? | Mass type |
2131
+ * | `departmentId` | `PluginDepartmentId`? | Department |
2132
+ * | `storey` | `number`? (int) | Target storey number (default active storey) |
2133
+ */
2134
+ export const PluginCreateSpaceItem = z.object({
2135
+ contour: ContourHandle,
2136
+ height: z.number(),
2137
+ label: z.string().optional(),
2138
+ position: Vec3Handle.optional(),
2139
+ spaceType: PluginSpaceType.optional(),
2140
+ massType: PluginMassType.optional(),
2141
+ departmentId: PluginDepartmentId.optional(),
2142
+ storey: z.number().int().optional(),
2143
+ })
2144
+ export type PluginCreateSpaceItem = z.infer<typeof PluginCreateSpaceItem>
2145
+
2146
+ export * from "./opening-fields"
2147
+ export * from "./bulk-items"
2148
+ export * from "./grids"