@snaptrude/plugin-core 0.10.0 → 1.0.0

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 (229) hide show
  1. package/AGENTS.md +4 -0
  2. package/CHANGELOG.md +187 -3
  3. package/api-manifest.json +929 -25
  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 +463 -0
  7. package/dist/api/core/camera/index.d.ts.map +1 -1
  8. package/dist/api/core/geom/create/index.d.ts +942 -101
  9. package/dist/api/core/geom/create/index.d.ts.map +1 -1
  10. package/dist/api/core/geom/query/brep.d.ts +59 -2
  11. package/dist/api/core/geom/query/brep.d.ts.map +1 -1
  12. package/dist/api/core/geom/query/curve.d.ts +59 -35
  13. package/dist/api/core/geom/query/curve.d.ts.map +1 -1
  14. package/dist/api/core/geom/query/edge.d.ts +2 -2
  15. package/dist/api/core/geom/query/face.d.ts +105 -0
  16. package/dist/api/core/geom/query/face.d.ts.map +1 -1
  17. package/dist/api/core/geom/update/contour.d.ts +10 -2
  18. package/dist/api/core/geom/update/contour.d.ts.map +1 -1
  19. package/dist/api/core/geom/update/curve.d.ts +5 -5
  20. package/dist/api/core/geom/update/profile.d.ts +3 -1
  21. package/dist/api/core/geom/update/profile.d.ts.map +1 -1
  22. package/dist/api/core/handles/index.d.ts +4 -2
  23. package/dist/api/core/handles/index.d.ts.map +1 -1
  24. package/dist/api/core/index.d.ts +4 -4
  25. package/dist/api/core/index.d.ts.map +1 -1
  26. package/dist/api/core/io/import/index.d.ts +3 -1
  27. package/dist/api/core/io/import/index.d.ts.map +1 -1
  28. package/dist/api/core/layers.d.ts +377 -255
  29. package/dist/api/core/layers.d.ts.map +1 -1
  30. package/dist/api/core/mode/index.d.ts +19 -7
  31. package/dist/api/core/mode/index.d.ts.map +1 -1
  32. package/dist/api/core/project/index.d.ts +68 -1
  33. package/dist/api/core/project/index.d.ts.map +1 -1
  34. package/dist/api/core/proposals/index.d.ts +4 -3
  35. package/dist/api/core/proposals/index.d.ts.map +1 -1
  36. package/dist/api/core/storeys/index.d.ts +31 -2
  37. package/dist/api/core/storeys/index.d.ts.map +1 -1
  38. package/dist/api/core/storeys/layers.d.ts +408 -0
  39. package/dist/api/core/storeys/layers.d.ts.map +1 -0
  40. package/dist/api/core/tags.d.ts +84 -3
  41. package/dist/api/core/tags.d.ts.map +1 -1
  42. package/dist/api/core/zoom/index.d.ts +13 -0
  43. package/dist/api/core/zoom/index.d.ts.map +1 -1
  44. package/dist/api/design/bim.d.ts +299 -0
  45. package/dist/api/design/bim.d.ts.map +1 -0
  46. package/dist/api/design/boolean/index.d.ts +2 -0
  47. package/dist/api/design/boolean/index.d.ts.map +1 -1
  48. package/dist/api/design/catalog.d.ts +320 -0
  49. package/dist/api/design/catalog.d.ts.map +1 -0
  50. package/dist/api/design/create/bulk-items.d.ts +269 -0
  51. package/dist/api/design/create/bulk-items.d.ts.map +1 -0
  52. package/dist/api/design/create/grids.d.ts +132 -0
  53. package/dist/api/design/create/grids.d.ts.map +1 -0
  54. package/dist/api/design/create/index.d.ts +752 -78
  55. package/dist/api/design/create/index.d.ts.map +1 -1
  56. package/dist/api/design/create/opening-fields.d.ts +38 -0
  57. package/dist/api/design/create/opening-fields.d.ts.map +1 -0
  58. package/dist/api/design/delete/index.d.ts +5 -0
  59. package/dist/api/design/delete/index.d.ts.map +1 -1
  60. package/dist/api/design/dimensions.d.ts +427 -0
  61. package/dist/api/design/dimensions.d.ts.map +1 -0
  62. package/dist/api/design/doors/index.d.ts +24 -23
  63. package/dist/api/design/doors/index.d.ts.map +1 -1
  64. package/dist/api/design/family.d.ts +1446 -0
  65. package/dist/api/design/family.d.ts.map +1 -0
  66. package/dist/api/design/furniture/index.d.ts +33 -0
  67. package/dist/api/design/furniture/index.d.ts.map +1 -1
  68. package/dist/api/design/grids.d.ts +237 -0
  69. package/dist/api/design/grids.d.ts.map +1 -0
  70. package/dist/api/design/index.d.ts +30 -0
  71. package/dist/api/design/index.d.ts.map +1 -1
  72. package/dist/api/design/networks.d.ts +1703 -0
  73. package/dist/api/design/networks.d.ts.map +1 -0
  74. package/dist/api/design/query/geometry/index.d.ts +33 -5
  75. package/dist/api/design/query/geometry/index.d.ts.map +1 -1
  76. package/dist/api/design/query/grids.d.ts +287 -0
  77. package/dist/api/design/query/grids.d.ts.map +1 -0
  78. package/dist/api/design/query/index.d.ts +143 -34
  79. package/dist/api/design/query/index.d.ts.map +1 -1
  80. package/dist/api/design/query/spaces.d.ts +5 -5
  81. package/dist/api/design/selection/index.d.ts +12 -12
  82. package/dist/api/design/types/index.d.ts +40 -24
  83. package/dist/api/design/types/index.d.ts.map +1 -1
  84. package/dist/api/design/update/index.d.ts +412 -8
  85. package/dist/api/design/update/index.d.ts.map +1 -1
  86. package/dist/api/design/visibility.d.ts +28 -0
  87. package/dist/api/design/visibility.d.ts.map +1 -1
  88. package/dist/api/design/windows/index.d.ts +8 -8
  89. package/dist/api/design/windows/index.d.ts.map +1 -1
  90. package/dist/api/entity/buildableEnvelope.d.ts +84 -2
  91. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
  92. package/dist/api/entity/referenceLine.d.ts +13 -1
  93. package/dist/api/entity/referenceLine.d.ts.map +1 -1
  94. package/dist/api/entity/space.d.ts +12 -12
  95. package/dist/api/entity/story.d.ts +4 -4
  96. package/dist/api/presentation/aiInspiration.d.ts +24 -24
  97. package/dist/api/presentation/annotate.d.ts +38 -22
  98. package/dist/api/presentation/annotate.d.ts.map +1 -1
  99. package/dist/api/presentation/camera.d.ts +265 -0
  100. package/dist/api/presentation/camera.d.ts.map +1 -0
  101. package/dist/api/presentation/drawingContract.d.ts +32 -0
  102. package/dist/api/presentation/drawingContract.d.ts.map +1 -0
  103. package/dist/api/presentation/drawings.d.ts +3523 -0
  104. package/dist/api/presentation/drawings.d.ts.map +1 -0
  105. package/dist/api/presentation/export.d.ts +23 -5
  106. package/dist/api/presentation/export.d.ts.map +1 -1
  107. package/dist/api/presentation/graphics.d.ts +419 -0
  108. package/dist/api/presentation/graphics.d.ts.map +1 -0
  109. package/dist/api/presentation/index.d.ts +66 -12
  110. package/dist/api/presentation/index.d.ts.map +1 -1
  111. package/dist/api/presentation/placedViews.d.ts +116 -16
  112. package/dist/api/presentation/placedViews.d.ts.map +1 -1
  113. package/dist/api/presentation/sections.d.ts +461 -0
  114. package/dist/api/presentation/sections.d.ts.map +1 -0
  115. package/dist/api/presentation/shapes.d.ts +2 -2
  116. package/dist/api/presentation/sheets.d.ts +175 -19
  117. package/dist/api/presentation/sheets.d.ts.map +1 -1
  118. package/dist/api/presentation/standards.d.ts +590 -0
  119. package/dist/api/presentation/standards.d.ts.map +1 -0
  120. package/dist/api/presentation/viewPresets.d.ts +222 -0
  121. package/dist/api/presentation/viewPresets.d.ts.map +1 -0
  122. package/dist/api/presentation/views.d.ts +144 -9
  123. package/dist/api/presentation/views.d.ts.map +1 -1
  124. package/dist/api/presentation/walkthroughs.d.ts +1350 -0
  125. package/dist/api/presentation/walkthroughs.d.ts.map +1 -0
  126. package/dist/api/program/departments.d.ts +58 -2
  127. package/dist/api/program/departments.d.ts.map +1 -1
  128. package/dist/api/program/index.d.ts +16 -6
  129. package/dist/api/program/index.d.ts.map +1 -1
  130. package/dist/api/program/labels.d.ts +355 -0
  131. package/dist/api/program/labels.d.ts.map +1 -0
  132. package/dist/api/program/metadata.d.ts +328 -0
  133. package/dist/api/program/metadata.d.ts.map +1 -0
  134. package/dist/api/program/site.d.ts +4 -4
  135. package/dist/api/program/spreadsheet.d.ts +267 -4
  136. package/dist/api/program/spreadsheet.d.ts.map +1 -1
  137. package/dist/api/workspace/index.d.ts +49 -2
  138. package/dist/api/workspace/index.d.ts.map +1 -1
  139. package/dist/errors/codes.d.ts +3 -1
  140. package/dist/errors/codes.d.ts.map +1 -1
  141. package/dist/handles.d.ts +32 -3
  142. package/dist/handles.d.ts.map +1 -1
  143. package/dist/index.cjs +6539 -2804
  144. package/dist/index.cjs.map +1 -1
  145. package/dist/index.d.ts +2 -0
  146. package/dist/index.d.ts.map +1 -1
  147. package/dist/index.js +6121 -2801
  148. package/dist/index.js.map +1 -1
  149. package/dist/massParameters.d.ts +287 -0
  150. package/dist/massParameters.d.ts.map +1 -0
  151. package/dist/massParameters.ops.d.ts +138 -0
  152. package/dist/massParameters.ops.d.ts.map +1 -0
  153. package/package.json +14 -13
  154. package/scripts/check-dist-fresh.mjs +22 -0
  155. package/scripts/generate-manifest.mjs +5 -0
  156. package/scripts/generate-manifest.test.mjs +14 -3
  157. package/src/api/core/camera/index.ts +446 -1
  158. package/src/api/core/geom/create/index.ts +1037 -102
  159. package/src/api/core/geom/query/brep.ts +60 -2
  160. package/src/api/core/geom/query/curve.ts +26 -2
  161. package/src/api/core/geom/query/edge.ts +2 -2
  162. package/src/api/core/geom/query/face.ts +109 -4
  163. package/src/api/core/geom/update/contour.ts +10 -2
  164. package/src/api/core/geom/update/profile.ts +2 -0
  165. package/src/api/core/handles/index.ts +3 -2
  166. package/src/api/core/index.ts +4 -4
  167. package/src/api/core/io/import/index.ts +11 -3
  168. package/src/api/core/layers.ts +380 -173
  169. package/src/api/core/mode/index.ts +19 -7
  170. package/src/api/core/project/index.ts +62 -1
  171. package/src/api/core/proposals/index.ts +4 -3
  172. package/src/api/core/storeys/index.ts +34 -2
  173. package/src/api/core/storeys/layers.ts +339 -0
  174. package/src/api/core/tags.ts +76 -0
  175. package/src/api/core/zoom/index.ts +13 -0
  176. package/src/api/design/bim.ts +210 -0
  177. package/src/api/design/boolean/index.ts +2 -0
  178. package/src/api/design/catalog.ts +203 -0
  179. package/src/api/design/create/bulk-items.ts +294 -0
  180. package/src/api/design/create/grids.ts +137 -0
  181. package/src/api/design/create/index.ts +823 -114
  182. package/src/api/design/create/opening-fields.ts +40 -0
  183. package/src/api/design/delete/index.ts +5 -0
  184. package/src/api/design/dimensions.ts +453 -0
  185. package/src/api/design/doors/index.ts +64 -41
  186. package/src/api/design/family.ts +1342 -0
  187. package/src/api/design/furniture/index.ts +34 -0
  188. package/src/api/design/grids.ts +237 -0
  189. package/src/api/design/index.ts +49 -4
  190. package/src/api/design/networks.ts +607 -0
  191. package/src/api/design/query/geometry/index.ts +35 -4
  192. package/src/api/design/query/grids.ts +197 -0
  193. package/src/api/design/query/index.ts +105 -3
  194. package/src/api/design/types/index.ts +31 -24
  195. package/src/api/design/update/index.ts +398 -4
  196. package/src/api/design/visibility.ts +34 -0
  197. package/src/api/design/windows/index.ts +40 -22
  198. package/src/api/entity/buildableEnvelope.ts +77 -2
  199. package/src/api/entity/referenceLine.ts +25 -12
  200. package/src/api/presentation/annotate.ts +90 -58
  201. package/src/api/presentation/camera.ts +289 -0
  202. package/src/api/presentation/drawingContract.ts +70 -0
  203. package/src/api/presentation/drawings.ts +1179 -0
  204. package/src/api/presentation/export.ts +32 -6
  205. package/src/api/presentation/graphics.ts +324 -0
  206. package/src/api/presentation/index.ts +73 -14
  207. package/src/api/presentation/placedViews.ts +119 -28
  208. package/src/api/presentation/sections.ts +420 -0
  209. package/src/api/presentation/sheets.ts +181 -20
  210. package/src/api/presentation/standards.ts +445 -0
  211. package/src/api/presentation/viewPresets.ts +241 -0
  212. package/src/api/presentation/views.ts +81 -10
  213. package/src/api/presentation/walkthroughs.ts +1201 -0
  214. package/src/api/program/departments.ts +54 -2
  215. package/src/api/program/index.ts +16 -6
  216. package/src/api/program/labels.ts +332 -0
  217. package/src/api/program/metadata.ts +364 -0
  218. package/src/api/program/spreadsheet.ts +282 -0
  219. package/src/api/workspace/index.ts +51 -2
  220. package/src/errors/codes.ts +7 -0
  221. package/src/handles.ts +42 -3
  222. package/src/index.ts +2 -0
  223. package/src/massParameters.ops.ts +246 -0
  224. package/src/massParameters.ts +427 -0
  225. package/test/drawingContract.test.mjs +288 -0
  226. package/test/errors.test.mjs +1 -0
  227. package/test/massParameters.test.mjs +952 -0
  228. package/test/paperPensContract.test.mjs +75 -0
  229. package/test/presentationViewSettings.test.mjs +85 -0
@@ -0,0 +1,294 @@
1
+ import * as z from "zod"
2
+ import {
3
+ ComponentHandle,
4
+ ContourHandle,
5
+ ProfileHandle,
6
+ Vec3Handle,
7
+ } from "../../../handles"
8
+ import { PluginOpeningBaseOptions } from "./opening-fields"
9
+ import { PluginWallType } from "../types"
10
+ import { PluginFamilyValues } from "../catalog"
11
+
12
+ /**
13
+ * Maximum items per bulk `design.create.*` call. A bounded request keeps
14
+ * validation, command capture and rollback work finite; split a larger import
15
+ * into separate awaited batches, each with its own undo entry.
16
+ */
17
+ export const PLUGIN_CREATE_BATCH_LIMIT = 1000
18
+
19
+ // ---------------------------------------------------------------------------
20
+ // wall top profile (raked / gabled walls)
21
+ // ---------------------------------------------------------------------------
22
+
23
+ /**
24
+ * One break point of a wall's top edge — see {@linkcode PluginWallTopProfile}.
25
+ *
26
+ * | Property | Type | Description |
27
+ * |---|---|---|
28
+ * | `along` | `number` | Position along the wall centerline as a fraction: `0` = start of the curve, `1` = end |
29
+ * | `height` | `number` | Top height above the wall base at that point (Snaptrude units, > 0) |
30
+ */
31
+ export const PluginWallTopProfilePoint = z.object({
32
+ along: z.number().min(0).max(1),
33
+ height: z.number().positive(),
34
+ })
35
+ export type PluginWallTopProfilePoint = z.infer<
36
+ typeof PluginWallTopProfilePoint
37
+ >
38
+
39
+ /**
40
+ * The top edge of ONE wall as a polyline over its centerline: at least two
41
+ * points, `along` strictly increasing from `0` (curve start) to `1` (curve end),
42
+ * straight segments between them. Two points give a single slope (a raked
43
+ * wall), three give a gable, more give any stepped or folded ridge. Heights are
44
+ * measured from the wall base, like `height`. Both long faces follow the same
45
+ * profile, so the top stays a set of flat faces and the wall keeps its thickness
46
+ * end to end.
47
+ *
48
+ * Only straight centerlines take a top profile (an arc curve with one is
49
+ * rejected). A wall built this way is a real Wall — doors and windows host on
50
+ * it, corners mitre, quantities and Revit export read its geometry — but it is
51
+ * **non-parametric**: the parametric wall graph does not rebuild it, so a later
52
+ * move of a neighbour does not re-mitre its corner, exactly like a wall whose
53
+ * top edge was dragged by hand. `design.update.wall({ height })` scales it
54
+ * proportionally.
55
+ */
56
+ export const PluginWallTopProfile = z
57
+ .array(PluginWallTopProfilePoint)
58
+ .min(2)
59
+ .superRefine((points, ctx) => {
60
+ if (points[0].along !== 0) {
61
+ ctx.addIssue({
62
+ code: "custom",
63
+ message: "topProfile must start at along = 0",
64
+ })
65
+ }
66
+ if (points[points.length - 1].along !== 1) {
67
+ ctx.addIssue({
68
+ code: "custom",
69
+ message: "topProfile must end at along = 1",
70
+ })
71
+ }
72
+ for (let i = 1; i < points.length; i++) {
73
+ if (points[i].along <= points[i - 1].along) {
74
+ ctx.addIssue({
75
+ code: "custom",
76
+ message:
77
+ "topProfile points must be in strictly increasing `along` order",
78
+ })
79
+ break
80
+ }
81
+ }
82
+ })
83
+ export type PluginWallTopProfile = z.infer<typeof PluginWallTopProfile>
84
+
85
+ // ---------------------------------------------------------------------------
86
+ // wallRuns
87
+ // ---------------------------------------------------------------------------
88
+
89
+ /**
90
+ * One wall run to create via {@linkcode PluginDesignCreateApi.wallRuns} — the
91
+ * same inputs as {@linkcode PluginDesignCreateApi.walls}, one run per item.
92
+ *
93
+ * | Property | Type | Description |
94
+ * |---|---|---|
95
+ * | `profile` | {@linkcode ProfileHandle} | Ordered curve chain (wall centerlines) |
96
+ * | `height` | `number`? | Wall height (Snaptrude units, > 0; default engine default) |
97
+ * | `thickness` | `number`? | Wall thickness (Snaptrude units, > 0; default: `wallType`'s total layer thickness when given, else engine default) |
98
+ * | `wallType` | {@linkcode PluginWallType}? | Legacy name/id or exact native `{ id, version }` pin from `design.types.list("wall")` (default generic) |
99
+ * | `storey` | `number`? (int) | Target storey (must exist) — the run's walls are assigned + lifted to its base in the same undo entry (default: geometry-derived) |
100
+ * | `topProfiles` | ({@linkcode PluginWallTopProfile} \| `null`)[]? | Top edge per curve of `profile`, same order; a `null` or missing entry keeps that wall flat at `height`. Raked / gabled walls (straight curves only) |
101
+ */
102
+ export const PluginCreateWallRunItem = z.object({
103
+ profile: ProfileHandle,
104
+ height: z.number().optional(),
105
+ thickness: z.number().optional(),
106
+ wallType: PluginWallType.optional(),
107
+ storey: z.number().int().optional(),
108
+ topProfiles: z.array(PluginWallTopProfile.nullable()).optional(),
109
+ /** Optional family overrides in mm/degrees. Host length/height stay geometry inputs. */
110
+ values: PluginFamilyValues.optional(),
111
+ })
112
+ export type PluginCreateWallRunItem = z.infer<typeof PluginCreateWallRunItem>
113
+
114
+ /** The `items` array of {@linkcode PluginDesignCreateApi.wallRuns} (1…1000). */
115
+ export const PluginCreateWallRunItems = z
116
+ .array(PluginCreateWallRunItem)
117
+ .min(1)
118
+ .max(PLUGIN_CREATE_BATCH_LIMIT)
119
+ export type PluginCreateWallRunItems = z.infer<typeof PluginCreateWallRunItems>
120
+
121
+ // ---------------------------------------------------------------------------
122
+ // floors
123
+ // ---------------------------------------------------------------------------
124
+
125
+ /**
126
+ * One floor to create via {@linkcode PluginDesignCreateApi.floors} — the same
127
+ * footprint-extrude inputs as {@linkcode PluginDesignCreateApi.floor}.
128
+ *
129
+ * | Property | Type | Description |
130
+ * |---|---|---|
131
+ * | `contour` | {@linkcode ContourHandle} | Footprint (outer profile + holes) |
132
+ * | `thickness` | `number` | Floor thickness (Snaptrude units, > 0) |
133
+ * | `position` | {@linkcode Vec3Handle}? | Offset from origin (default origin) |
134
+ */
135
+ export const PluginCreateFloorItem = z.object({
136
+ contour: ContourHandle,
137
+ thickness: z.number(),
138
+ position: Vec3Handle.optional(),
139
+ })
140
+ export type PluginCreateFloorItem = z.infer<typeof PluginCreateFloorItem>
141
+
142
+ /** The `items` array of {@linkcode PluginDesignCreateApi.floors} (1…1000). */
143
+ export const PluginCreateFloorItems = z
144
+ .array(PluginCreateFloorItem)
145
+ .min(1)
146
+ .max(PLUGIN_CREATE_BATCH_LIMIT)
147
+ export type PluginCreateFloorItems = z.infer<typeof PluginCreateFloorItems>
148
+
149
+ // ---------------------------------------------------------------------------
150
+ // doors / windows
151
+ // ---------------------------------------------------------------------------
152
+
153
+ /**
154
+ * One door to place via {@linkcode PluginDesignCreateApi.doors} — the same
155
+ * fields as a `"door"` {@linkcode PluginDesignCreateOpeningOptions}.
156
+ * Values are evaluated before cutting. Numeric lengths use SU; unit strings
157
+ * are accepted in values. `facing` selects local +Z; `hinge` sets the declared
158
+ * hand enum (left = local -X, right = +X). Both are world points.
159
+ *
160
+ * | Property | Type | Description |
161
+ * |---|---|---|
162
+ * | `familyId` | `string` | Hosted door family definition ID |
163
+ * | `version` | `number`? | Exact version; newest known by default |
164
+ * | `values` | `Record<string, number \| string>`? | Authored parameter overrides |
165
+ * | `hostWall` | {@linkcode ComponentHandle} | The wall to host the door |
166
+ * | `position` | {@linkcode Vec3Handle} | World point projected onto the wall |
167
+ * | `facing` | {@linkcode Vec3Handle}? | World point on the side the door swings open to (default engine-chosen) |
168
+ * | `hinge` | {@linkcode Vec3Handle}? | World point near the hinged jamb; requires hand control |
169
+ * | `label` | `string`? | Instance name (optional) |
170
+ * | `width` | `number`? | Declared width parameter (SU, > 0), not evaluated hole width |
171
+ * | `height` | `number`? | Declared height parameter (SU, > 0) |
172
+ */
173
+ export const PluginCreateDoorItem = z
174
+ .object({ ...PluginOpeningBaseOptions })
175
+ .strict()
176
+ export type PluginCreateDoorItem = z.infer<typeof PluginCreateDoorItem>
177
+
178
+ /** The `items` array of {@linkcode PluginDesignCreateApi.doors} (1…1000). */
179
+ export const PluginCreateDoorItems = z
180
+ .array(PluginCreateDoorItem)
181
+ .min(1)
182
+ .max(PLUGIN_CREATE_BATCH_LIMIT)
183
+ export type PluginCreateDoorItems = z.infer<typeof PluginCreateDoorItems>
184
+
185
+ /**
186
+ * One window to place via {@linkcode PluginDesignCreateApi.windows} — the same
187
+ * fields as a `"window"` {@linkcode PluginDesignCreateOpeningOptions}.
188
+ * `sillHeight` is a nonnegative Snaptrude-unit distance from the host wall's
189
+ * base to the BOTTOM of the window, not to its center. `facing` and `hinge`
190
+ * are WORLD POINTS, not directions: `facing` on the side of the wall the
191
+ * window opens to, `hinge` near the jamb it is hinged on. Rejects unknown
192
+ * fields.
193
+ *
194
+ * | Property | Type | Description |
195
+ * |---|---|---|
196
+ * | `familyId` | `string` | Hosted window family definition ID |
197
+ * | `version` | `number`? | Exact version; newest known by default |
198
+ * | `values` | `Record<string, number \| string>`? | Authored parameter overrides; numeric lengths use SU |
199
+ * | `hostWall` | {@linkcode ComponentHandle} | The wall to host the window |
200
+ * | `position` | {@linkcode Vec3Handle} | World point projected onto the wall |
201
+ * | `facing` | {@linkcode Vec3Handle}? | World point on the side the window opens to (default engine-chosen) |
202
+ * | `hinge` | {@linkcode Vec3Handle}? | World point near the hinged jamb; requires hand control |
203
+ * | `label` | `string`? | Instance name (optional) |
204
+ * | `width` | `number`? | Declared width parameter (SU, > 0), not evaluated hole width |
205
+ * | `height` | `number`? | Declared height parameter (SU, > 0) |
206
+ * | `sillHeight` | `number`? | Declared sill parameter (SU, ≥ 0); position Y is ignored |
207
+ */
208
+ export const PluginCreateWindowItem = z
209
+ .object({
210
+ ...PluginOpeningBaseOptions,
211
+ sillHeight: z.number().finite().nonnegative().optional(),
212
+ })
213
+ .strict()
214
+ export type PluginCreateWindowItem = z.infer<typeof PluginCreateWindowItem>
215
+
216
+ /** The `items` array of {@linkcode PluginDesignCreateApi.windows} (1…1000). */
217
+ export const PluginCreateWindowItems = z
218
+ .array(PluginCreateWindowItem)
219
+ .min(1)
220
+ .max(PLUGIN_CREATE_BATCH_LIMIT)
221
+ export type PluginCreateWindowItems = z.infer<typeof PluginCreateWindowItems>
222
+
223
+ // ---------------------------------------------------------------------------
224
+ // furnitureItems
225
+ // ---------------------------------------------------------------------------
226
+
227
+ /**
228
+ * One furniture instance to place via
229
+ * {@linkcode PluginDesignCreateApi.furnitureItems} — the same inputs as
230
+ * {@linkcode PluginDesignCreateApi.furniture} minus `createNewSourceMesh`: in a
231
+ * batch the host owns source-mesh persistence (a source is recorded once per
232
+ * call, however many items reuse it).
233
+ *
234
+ * `position.y` is the REST elevation: the item is grounded so its bounding-box
235
+ * base sits exactly at `position.y` (the same surface-flush contract as
236
+ * interactive drag-drop) — pass the floor/storey elevation to stand furniture
237
+ * on it; never add half the item's height yourself.
238
+ *
239
+ * | Property | Type | Description |
240
+ * |---|---|---|
241
+ * | `catalogId` | `string` | Library id: team `_id` or general `fullName` |
242
+ * | `position` | {@linkcode Vec3Handle} | Absolute world placement point (`y` = rest elevation) |
243
+ * | `label` | `string`? | Instance name and readable label (default auto `${name}Ins${n}`) |
244
+ * | `angleInDegrees` | `number`? | Rotation about the vertical axis, in degrees (default unrotated) |
245
+ */
246
+ export const PluginCreateFurnitureItem = z.object({
247
+ catalogId: z.string().min(1),
248
+ position: Vec3Handle,
249
+ label: z.string().optional(),
250
+ angleInDegrees: z.number().optional(),
251
+ })
252
+ export type PluginCreateFurnitureItem = z.infer<
253
+ typeof PluginCreateFurnitureItem
254
+ >
255
+
256
+ /**
257
+ * The `items` array of {@linkcode PluginDesignCreateApi.furnitureItems}
258
+ * (1…1000).
259
+ */
260
+ export const PluginCreateFurnitureItems = z
261
+ .array(PluginCreateFurnitureItem)
262
+ .min(1)
263
+ .max(PLUGIN_CREATE_BATCH_LIMIT)
264
+ export type PluginCreateFurnitureItems = z.infer<
265
+ typeof PluginCreateFurnitureItems
266
+ >
267
+
268
+ // ---------------------------------------------------------------------------
269
+ // voids
270
+ // ---------------------------------------------------------------------------
271
+
272
+ /**
273
+ * One void to cut via {@linkcode PluginDesignCreateApi.voids} — the same fields as
274
+ * {@linkcode PluginDesignCreateApi.void}. Rejects unknown fields.
275
+ *
276
+ * | Property | Type | Description |
277
+ * | --- | --- | --- |
278
+ * | `host` | {@linkcode ComponentHandle} | The slab, floor, roof or ceiling to cut through. Not a wall. |
279
+ * | `outline` | {@linkcode ProfileHandle} | Closed, flat plan outline in world SU (all points at one height). That height is ignored: it is dropped straight onto the host's top face. |
280
+ */
281
+ export const PluginCreateVoidItem = z
282
+ .object({
283
+ host: ComponentHandle,
284
+ outline: ProfileHandle,
285
+ })
286
+ .strict()
287
+ export type PluginCreateVoidItem = z.infer<typeof PluginCreateVoidItem>
288
+
289
+ /** The `items` array of {@linkcode PluginDesignCreateApi.voids} (1…1000; the host takes at most 200, 50 per host). */
290
+ export const PluginCreateVoidItems = z
291
+ .array(PluginCreateVoidItem)
292
+ .min(1)
293
+ .max(PLUGIN_CREATE_BATCH_LIMIT)
294
+ export type PluginCreateVoidItems = z.infer<typeof PluginCreateVoidItems>
@@ -0,0 +1,137 @@
1
+ import * as z from "zod"
2
+ import { ComponentHandle, CurveHandle, Vec3Handle } from "../../../handles"
3
+
4
+ // ---------------------------------------------------------------------------
5
+ // Shared grid style vocabulary
6
+ // ---------------------------------------------------------------------------
7
+
8
+ /**
9
+ * Grid line style (mirrors the engine `LineMode` values verbatim — the same
10
+ * vocabulary as {@linkcode PluginReferenceLineStyle}).
11
+ */
12
+ export const PluginGridLineStyle = z.enum(["SOLID", "DASHED", "DOT_DASH"])
13
+ export type PluginGridLineStyle = z.infer<typeof PluginGridLineStyle>
14
+
15
+ /**
16
+ * Optional visual styling shared by every grid creator (and reused as the
17
+ * patch shape by `design.update.grid`). All fields optional; engine defaults
18
+ * apply when omitted.
19
+ *
20
+ * | Property | Type | Description |
21
+ * |---|---|---|
22
+ * | `style` | {@linkcode PluginGridLineStyle}? | Line style |
23
+ * | `weight` | `number`? | Line weight (> 0) |
24
+ * | `color` | `string`? | Line color as a `#rrggbb` hex string |
25
+ * | `showStart` | `boolean`? | Show the start-end tag bubble |
26
+ * | `showEnd` | `boolean`? | Show the end-end tag bubble |
27
+ */
28
+ export const PluginGridStyleOptions = z.object({
29
+ style: PluginGridLineStyle.optional(),
30
+ weight: z.number().positive().optional(),
31
+ color: z
32
+ .string()
33
+ .regex(/^#[0-9a-fA-F]{6}$/, "color must be a #rrggbb hex string")
34
+ .optional(),
35
+ showStart: z.boolean().optional(),
36
+ showEnd: z.boolean().optional(),
37
+ })
38
+ export type PluginGridStyleOptions = z.infer<typeof PluginGridStyleOptions>
39
+
40
+ // ---------------------------------------------------------------------------
41
+ // create.grid — free rectangular grid
42
+ // ---------------------------------------------------------------------------
43
+
44
+ /**
45
+ * Arguments for {@linkcode PluginDesignCreateApi.grid}.
46
+ *
47
+ * | Property | Type | Description |
48
+ * |---|---|---|
49
+ * | `linesX` | `number` | Line count of the first family (integer ≥ 1) |
50
+ * | `linesY` | `number` | Line count of the second family (integer ≥ 1) |
51
+ * | `spacingX` | `number` | Spacing of the first family (Snaptrude units, > 0) |
52
+ * | `spacingY` | `number` | Spacing of the second family (Snaptrude units, > 0) |
53
+ * | `angle` | `number`? | Rotation in degrees, CCW about +Y (default 0) |
54
+ * | `center` | {@linkcode Vec3Handle}? | Placement centre; defaults to the native viewport-centre behavior |
55
+ * | …style | {@linkcode PluginGridStyleOptions} | Optional line styling |
56
+ */
57
+ export const PluginDesignCreateGridArgs = z
58
+ .object({
59
+ linesX: z.number().int().min(1),
60
+ linesY: z.number().int().min(1),
61
+ spacingX: z.number().positive().finite(),
62
+ spacingY: z.number().positive().finite(),
63
+ angle: z.number().finite().optional(),
64
+ center: Vec3Handle.optional(),
65
+ })
66
+ .merge(PluginGridStyleOptions)
67
+ export type PluginDesignCreateGridArgs = z.infer<typeof PluginDesignCreateGridArgs>
68
+
69
+ // ---------------------------------------------------------------------------
70
+ // create.gridFromCurve — single-curve grid
71
+ // ---------------------------------------------------------------------------
72
+
73
+ /**
74
+ * Arguments for {@linkcode PluginDesignCreateApi.gridFromCurve}.
75
+ *
76
+ * | Property | Type | Description |
77
+ * |---|---|---|
78
+ * | `curve` | {@linkcode CurveHandle} | The grid line's geometry — a line or arc (circles are rejected) |
79
+ * | `tag` | `string`? | The line's grid tag (defaults to the draw tool's next tag) |
80
+ * | …style | {@linkcode PluginGridStyleOptions} | Optional line styling |
81
+ */
82
+ export const PluginDesignCreateGridFromCurveArgs = z
83
+ .object({
84
+ curve: CurveHandle,
85
+ tag: z.string().min(1).optional(),
86
+ })
87
+ .merge(PluginGridStyleOptions)
88
+ export type PluginDesignCreateGridFromCurveArgs = z.infer<
89
+ typeof PluginDesignCreateGridFromCurveArgs
90
+ >
91
+
92
+ // ---------------------------------------------------------------------------
93
+ // create.gridsFromMasses — fitted grids
94
+ // ---------------------------------------------------------------------------
95
+
96
+ /**
97
+ * Arguments for {@linkcode PluginDesignCreateApi.gridsFromMasses}.
98
+ *
99
+ * | Property | Type | Description |
100
+ * |---|---|---|
101
+ * | `masses` | {@linkcode ComponentHandle}`[]` | Masses whose footprints seat the grids |
102
+ * | `spacingX` | `number` | First-family spacing (Snaptrude units, > 0) |
103
+ * | `spacingY` | `number` | Second-family spacing (Snaptrude units, > 0) |
104
+ * | …style | {@linkcode PluginGridStyleOptions} | Optional line styling |
105
+ */
106
+ export const PluginDesignCreateGridsFromMassesArgs = z
107
+ .object({
108
+ masses: z.array(ComponentHandle).min(1),
109
+ spacingX: z.number().positive().finite(),
110
+ spacingY: z.number().positive().finite(),
111
+ })
112
+ .merge(PluginGridStyleOptions)
113
+ export type PluginDesignCreateGridsFromMassesArgs = z.infer<
114
+ typeof PluginDesignCreateGridsFromMassesArgs
115
+ >
116
+
117
+ // ---------------------------------------------------------------------------
118
+ // create.columnsFromGrids — columns at line intersections
119
+ // ---------------------------------------------------------------------------
120
+
121
+ /**
122
+ * Arguments for {@linkcode PluginDesignCreateApi.columnsFromGrids}.
123
+ *
124
+ * | Property | Type | Description |
125
+ * |---|---|---|
126
+ * | `grids` | {@linkcode ComponentHandle}`[]` | Grid groups whose line intersections seat the columns |
127
+ * | `width` | `number` | Column width (Snaptrude units, > 0) |
128
+ * | `depth` | `number` | Column depth (Snaptrude units, > 0) |
129
+ */
130
+ export const PluginDesignCreateColumnsFromGridsArgs = z.object({
131
+ grids: z.array(ComponentHandle).min(1),
132
+ width: z.number().positive().finite(),
133
+ depth: z.number().positive().finite(),
134
+ })
135
+ export type PluginDesignCreateColumnsFromGridsArgs = z.infer<
136
+ typeof PluginDesignCreateColumnsFromGridsArgs
137
+ >