@snaptrude/plugin-core 0.11.0-rc.1 → 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 (226) hide show
  1. package/AGENTS.md +4 -0
  2. package/CHANGELOG.md +176 -14
  3. package/api-manifest.json +872 -49
  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 +447 -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/proposals/index.d.ts +4 -3
  33. package/dist/api/core/proposals/index.d.ts.map +1 -1
  34. package/dist/api/core/storeys/index.d.ts +17 -2
  35. package/dist/api/core/storeys/index.d.ts.map +1 -1
  36. package/dist/api/core/storeys/layers.d.ts +408 -0
  37. package/dist/api/core/storeys/layers.d.ts.map +1 -0
  38. package/dist/api/core/tags.d.ts +84 -3
  39. package/dist/api/core/tags.d.ts.map +1 -1
  40. package/dist/api/core/zoom/index.d.ts +13 -0
  41. package/dist/api/core/zoom/index.d.ts.map +1 -1
  42. package/dist/api/design/bim.d.ts +299 -0
  43. package/dist/api/design/bim.d.ts.map +1 -0
  44. package/dist/api/design/boolean/index.d.ts +2 -0
  45. package/dist/api/design/boolean/index.d.ts.map +1 -1
  46. package/dist/api/design/catalog.d.ts +320 -0
  47. package/dist/api/design/catalog.d.ts.map +1 -0
  48. package/dist/api/design/create/bulk-items.d.ts +269 -0
  49. package/dist/api/design/create/bulk-items.d.ts.map +1 -0
  50. package/dist/api/design/create/grids.d.ts +132 -0
  51. package/dist/api/design/create/grids.d.ts.map +1 -0
  52. package/dist/api/design/create/index.d.ts +753 -102
  53. package/dist/api/design/create/index.d.ts.map +1 -1
  54. package/dist/api/design/create/opening-fields.d.ts +38 -0
  55. package/dist/api/design/create/opening-fields.d.ts.map +1 -0
  56. package/dist/api/design/delete/index.d.ts +7 -20
  57. package/dist/api/design/delete/index.d.ts.map +1 -1
  58. package/dist/api/design/dimensions.d.ts +427 -0
  59. package/dist/api/design/dimensions.d.ts.map +1 -0
  60. package/dist/api/design/doors/index.d.ts +24 -23
  61. package/dist/api/design/doors/index.d.ts.map +1 -1
  62. package/dist/api/design/family.d.ts +1446 -0
  63. package/dist/api/design/family.d.ts.map +1 -0
  64. package/dist/api/design/grids.d.ts +237 -0
  65. package/dist/api/design/grids.d.ts.map +1 -0
  66. package/dist/api/design/index.d.ts +30 -0
  67. package/dist/api/design/index.d.ts.map +1 -1
  68. package/dist/api/design/networks.d.ts +1703 -0
  69. package/dist/api/design/networks.d.ts.map +1 -0
  70. package/dist/api/design/query/geometry/index.d.ts +33 -5
  71. package/dist/api/design/query/geometry/index.d.ts.map +1 -1
  72. package/dist/api/design/query/grids.d.ts +287 -0
  73. package/dist/api/design/query/grids.d.ts.map +1 -0
  74. package/dist/api/design/query/index.d.ts +143 -36
  75. package/dist/api/design/query/index.d.ts.map +1 -1
  76. package/dist/api/design/query/spaces.d.ts +5 -66
  77. package/dist/api/design/query/spaces.d.ts.map +1 -1
  78. package/dist/api/design/selection/index.d.ts +12 -12
  79. package/dist/api/design/types/index.d.ts +40 -24
  80. package/dist/api/design/types/index.d.ts.map +1 -1
  81. package/dist/api/design/update/index.d.ts +412 -8
  82. package/dist/api/design/update/index.d.ts.map +1 -1
  83. package/dist/api/design/windows/index.d.ts +8 -8
  84. package/dist/api/design/windows/index.d.ts.map +1 -1
  85. package/dist/api/entity/buildableEnvelope.d.ts +84 -2
  86. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
  87. package/dist/api/entity/referenceLine.d.ts +13 -1
  88. package/dist/api/entity/referenceLine.d.ts.map +1 -1
  89. package/dist/api/entity/space.d.ts +12 -15
  90. package/dist/api/entity/space.d.ts.map +1 -1
  91. package/dist/api/entity/story.d.ts +4 -4
  92. package/dist/api/presentation/aiInspiration.d.ts +24 -24
  93. package/dist/api/presentation/annotate.d.ts +38 -22
  94. package/dist/api/presentation/annotate.d.ts.map +1 -1
  95. package/dist/api/presentation/camera.d.ts +265 -0
  96. package/dist/api/presentation/camera.d.ts.map +1 -0
  97. package/dist/api/presentation/drawingContract.d.ts +32 -0
  98. package/dist/api/presentation/drawingContract.d.ts.map +1 -0
  99. package/dist/api/presentation/drawings.d.ts +3523 -0
  100. package/dist/api/presentation/drawings.d.ts.map +1 -0
  101. package/dist/api/presentation/export.d.ts +23 -5
  102. package/dist/api/presentation/export.d.ts.map +1 -1
  103. package/dist/api/presentation/graphics.d.ts +419 -0
  104. package/dist/api/presentation/graphics.d.ts.map +1 -0
  105. package/dist/api/presentation/index.d.ts +66 -12
  106. package/dist/api/presentation/index.d.ts.map +1 -1
  107. package/dist/api/presentation/placedViews.d.ts +117 -51
  108. package/dist/api/presentation/placedViews.d.ts.map +1 -1
  109. package/dist/api/presentation/sections.d.ts +461 -0
  110. package/dist/api/presentation/sections.d.ts.map +1 -0
  111. package/dist/api/presentation/shapes.d.ts +2 -2
  112. package/dist/api/presentation/sheets.d.ts +175 -37
  113. package/dist/api/presentation/sheets.d.ts.map +1 -1
  114. package/dist/api/presentation/standards.d.ts +590 -0
  115. package/dist/api/presentation/standards.d.ts.map +1 -0
  116. package/dist/api/presentation/viewPresets.d.ts +222 -0
  117. package/dist/api/presentation/viewPresets.d.ts.map +1 -0
  118. package/dist/api/presentation/views.d.ts +144 -9
  119. package/dist/api/presentation/views.d.ts.map +1 -1
  120. package/dist/api/presentation/walkthroughs.d.ts +1350 -0
  121. package/dist/api/presentation/walkthroughs.d.ts.map +1 -0
  122. package/dist/api/program/departments.d.ts +58 -2
  123. package/dist/api/program/departments.d.ts.map +1 -1
  124. package/dist/api/program/index.d.ts +16 -6
  125. package/dist/api/program/index.d.ts.map +1 -1
  126. package/dist/api/program/labels.d.ts +355 -0
  127. package/dist/api/program/labels.d.ts.map +1 -0
  128. package/dist/api/program/metadata.d.ts +328 -0
  129. package/dist/api/program/metadata.d.ts.map +1 -0
  130. package/dist/api/program/site.d.ts +4 -4
  131. package/dist/api/program/spreadsheet.d.ts +267 -4
  132. package/dist/api/program/spreadsheet.d.ts.map +1 -1
  133. package/dist/api/workspace/index.d.ts +49 -2
  134. package/dist/api/workspace/index.d.ts.map +1 -1
  135. package/dist/errors/codes.d.ts +5 -8
  136. package/dist/errors/codes.d.ts.map +1 -1
  137. package/dist/handles.d.ts +32 -3
  138. package/dist/handles.d.ts.map +1 -1
  139. package/dist/index.cjs +6534 -2865
  140. package/dist/index.cjs.map +1 -1
  141. package/dist/index.d.ts +2 -0
  142. package/dist/index.d.ts.map +1 -1
  143. package/dist/index.js +6118 -2857
  144. package/dist/index.js.map +1 -1
  145. package/dist/massParameters.d.ts +287 -0
  146. package/dist/massParameters.d.ts.map +1 -0
  147. package/dist/massParameters.ops.d.ts +138 -0
  148. package/dist/massParameters.ops.d.ts.map +1 -0
  149. package/package.json +2 -1
  150. package/scripts/check-dist-fresh.mjs +22 -0
  151. package/scripts/generate-manifest.mjs +5 -0
  152. package/scripts/generate-manifest.test.mjs +14 -3
  153. package/src/api/core/camera/index.ts +429 -1
  154. package/src/api/core/geom/create/index.ts +1037 -102
  155. package/src/api/core/geom/query/brep.ts +60 -2
  156. package/src/api/core/geom/query/curve.ts +26 -2
  157. package/src/api/core/geom/query/edge.ts +2 -2
  158. package/src/api/core/geom/query/face.ts +109 -4
  159. package/src/api/core/geom/update/contour.ts +10 -2
  160. package/src/api/core/geom/update/profile.ts +2 -0
  161. package/src/api/core/handles/index.ts +3 -2
  162. package/src/api/core/index.ts +4 -4
  163. package/src/api/core/io/import/index.ts +11 -3
  164. package/src/api/core/layers.ts +380 -173
  165. package/src/api/core/mode/index.ts +19 -7
  166. package/src/api/core/proposals/index.ts +4 -3
  167. package/src/api/core/storeys/index.ts +19 -2
  168. package/src/api/core/storeys/layers.ts +339 -0
  169. package/src/api/core/tags.ts +76 -0
  170. package/src/api/core/zoom/index.ts +13 -0
  171. package/src/api/design/bim.ts +210 -0
  172. package/src/api/design/boolean/index.ts +2 -0
  173. package/src/api/design/catalog.ts +203 -0
  174. package/src/api/design/create/bulk-items.ts +294 -0
  175. package/src/api/design/create/grids.ts +137 -0
  176. package/src/api/design/create/index.ts +824 -141
  177. package/src/api/design/create/opening-fields.ts +40 -0
  178. package/src/api/design/delete/index.ts +6 -20
  179. package/src/api/design/dimensions.ts +453 -0
  180. package/src/api/design/doors/index.ts +64 -41
  181. package/src/api/design/family.ts +1342 -0
  182. package/src/api/design/grids.ts +237 -0
  183. package/src/api/design/index.ts +49 -4
  184. package/src/api/design/networks.ts +607 -0
  185. package/src/api/design/query/geometry/index.ts +35 -4
  186. package/src/api/design/query/grids.ts +197 -0
  187. package/src/api/design/query/index.ts +105 -5
  188. package/src/api/design/query/spaces.ts +0 -68
  189. package/src/api/design/types/index.ts +31 -24
  190. package/src/api/design/update/index.ts +398 -4
  191. package/src/api/design/windows/index.ts +40 -22
  192. package/src/api/entity/buildableEnvelope.ts +77 -2
  193. package/src/api/entity/referenceLine.ts +25 -12
  194. package/src/api/entity/space.ts +0 -2
  195. package/src/api/presentation/annotate.ts +90 -58
  196. package/src/api/presentation/camera.ts +289 -0
  197. package/src/api/presentation/drawingContract.ts +70 -0
  198. package/src/api/presentation/drawings.ts +1179 -0
  199. package/src/api/presentation/export.ts +32 -6
  200. package/src/api/presentation/graphics.ts +324 -0
  201. package/src/api/presentation/index.ts +73 -14
  202. package/src/api/presentation/placedViews.ts +120 -57
  203. package/src/api/presentation/sections.ts +420 -0
  204. package/src/api/presentation/sheets.ts +182 -37
  205. package/src/api/presentation/standards.ts +445 -0
  206. package/src/api/presentation/viewPresets.ts +241 -0
  207. package/src/api/presentation/views.ts +81 -10
  208. package/src/api/presentation/walkthroughs.ts +1201 -0
  209. package/src/api/program/departments.ts +54 -2
  210. package/src/api/program/index.ts +16 -6
  211. package/src/api/program/labels.ts +332 -0
  212. package/src/api/program/metadata.ts +364 -0
  213. package/src/api/program/spreadsheet.ts +282 -0
  214. package/src/api/workspace/index.ts +51 -2
  215. package/src/errors/codes.ts +9 -30
  216. package/src/handles.ts +42 -3
  217. package/src/index.ts +2 -0
  218. package/src/massParameters.ops.ts +246 -0
  219. package/src/massParameters.ts +427 -0
  220. package/test/drawingContract.test.mjs +288 -0
  221. package/test/errors.test.mjs +1 -4
  222. package/test/massParameters.test.mjs +952 -0
  223. package/test/paperPensContract.test.mjs +75 -0
  224. package/test/presentationViewSettings.test.mjs +85 -0
  225. package/api-manifest.full.json +0 -6928
  226. package/snaptrude-plugin-core-0.11.0.tgz +0 -0
@@ -0,0 +1,197 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+ import { CurveHandle, BBoxComponents } from "../../../handles"
4
+ import { PluginReferenceLineStyle } from "../create"
5
+
6
+ // ---------------------------------------------------------------------------
7
+ // Records
8
+ // ---------------------------------------------------------------------------
9
+
10
+ /**
11
+ * Visual properties of grid lines — the group's defaults and any per-line
12
+ * overrides share this shape (values mirror the engine's `GridLineProps`).
13
+ *
14
+ * | Property | Type | Description |
15
+ * |---|---|---|
16
+ * | `style` | {@linkcode PluginReferenceLineStyle} | Line style (`"SOLID"` \| `"DASHED"` \| `"DOT_DASH"`) |
17
+ * | `weight` | `number` | Line weight |
18
+ * | `color` | `string` | Line color as a `#rrggbb` hex string |
19
+ * | `showStart` | `boolean` | Whether the start-end tag bubble is shown |
20
+ * | `showEnd` | `boolean` | Whether the end-end tag bubble is shown |
21
+ */
22
+ export const PluginGridLineProps = z.object({
23
+ style: PluginReferenceLineStyle,
24
+ weight: z.number(),
25
+ color: z.string(),
26
+ showStart: z.boolean(),
27
+ showEnd: z.boolean(),
28
+ })
29
+ export type PluginGridLineProps = z.infer<typeof PluginGridLineProps>
30
+
31
+ /**
32
+ * One grid line within a wing.
33
+ *
34
+ * | Property | Type | Description |
35
+ * |---|---|---|
36
+ * | `curve` | {@linkcode CurveHandle} | The line's geometry in **world space** (a line or arc; read coordinates via `core.geom.curve`) |
37
+ * | `tag` | `string` | The line's grid tag (e.g. `"A"`, `"3"`) |
38
+ * | `visible` | `boolean` | Persisted per-line visibility |
39
+ * | `props` | {@linkcode PluginGridLineProps} | **Effective** visual properties (group defaults merged with this line's overrides) |
40
+ * | `overrides` | `Partial<`{@linkcode PluginGridLineProps}`>`? | This line's raw overrides, when any exist |
41
+ */
42
+ export const PluginGridLineRecord = z.object({
43
+ curve: CurveHandle,
44
+ tag: z.string(),
45
+ visible: z.boolean(),
46
+ props: PluginGridLineProps,
47
+ overrides: PluginGridLineProps.partial().optional(),
48
+ })
49
+ export type PluginGridLineRecord = z.infer<typeof PluginGridLineRecord>
50
+
51
+ /**
52
+ * One wing of a grid — a family of parallel lines sharing a local frame.
53
+ * `spacing` and `span` are measured along the wing's local axes in
54
+ * Snaptrude units; line addresses used by mutating APIs are
55
+ * `{ wing, line }` index pairs into these arrays.
56
+ *
57
+ * | Property | Type | Description |
58
+ * |---|---|---|
59
+ * | `spacing` | `number` | Nominal spacing between adjacent lines (Snaptrude units) |
60
+ * | `tagStart` | `string` | First tag of the wing's deterministic tag sequence |
61
+ * | `span` | `{ min: number; max: number }`? | Explicit family length along the wing's line axis, when baked |
62
+ * | `lines` | {@linkcode PluginGridLineRecord}`[]` | The wing's lines, in wing order (index = the `line` address) |
63
+ */
64
+ export const PluginGridWingRecord = z.object({
65
+ spacing: z.number(),
66
+ tagStart: z.string(),
67
+ span: z.object({ min: z.number(), max: z.number() }).optional(),
68
+ lines: z.array(PluginGridLineRecord),
69
+ })
70
+ export type PluginGridWingRecord = z.infer<typeof PluginGridWingRecord>
71
+
72
+ /**
73
+ * Per-storey 2D-plan visibility of a grid.
74
+ *
75
+ * | Property | Type | Description |
76
+ * |---|---|---|
77
+ * | `activeStorey` | `number` | The storey the grid belongs to |
78
+ * | `disabledOnStoreys` | `number[]` | Storeys on whose 2D plan the grid is hidden |
79
+ */
80
+ export const PluginGridStoreyVisibility = z.object({
81
+ activeStorey: z.number(),
82
+ disabledOnStoreys: z.array(z.number()),
83
+ })
84
+ export type PluginGridStoreyVisibility = z.infer<typeof PluginGridStoreyVisibility>
85
+
86
+ // ---------------------------------------------------------------------------
87
+ // get — args & result
88
+ // ---------------------------------------------------------------------------
89
+
90
+ /**
91
+ * Property names readable via {@linkcode PluginDesignQueryGridsApi.get}.
92
+ *
93
+ * | Value | Description |
94
+ * |---|---|
95
+ * | `"angle"` | World rotation about +Y, in **degrees** |
96
+ * | `"props"` | Group-level default line properties |
97
+ * | `"storeyVisibility"` | Active storey + storeys where the grid is hidden in 2D |
98
+ * | `"wings"` | Full wing/line structure with world-space curve handles |
99
+ * | `"bounds"` | World-space axis-aligned bounding box of the grid geometry |
100
+ */
101
+ export const PluginGridGetProperty = z.enum([
102
+ "angle",
103
+ "props",
104
+ "storeyVisibility",
105
+ "wings",
106
+ "bounds",
107
+ ])
108
+ export type PluginGridGetProperty = z.infer<typeof PluginGridGetProperty>
109
+
110
+ /**
111
+ * Arguments for {@linkcode PluginDesignQueryGridsApi.get}.
112
+ *
113
+ * | Property | Type | Description |
114
+ * |---|---|---|
115
+ * | `gridId` | `string` | The grid group ID to query |
116
+ * | `properties` | {@linkcode PluginGridGetProperty}`[]` | Properties to retrieve |
117
+ */
118
+ export const PluginGridGetArgs = z.object({
119
+ gridId: z.string(),
120
+ properties: z.array(PluginGridGetProperty),
121
+ })
122
+ export type PluginGridGetArgs = z.infer<typeof PluginGridGetArgs>
123
+
124
+ /**
125
+ * Result of {@linkcode PluginDesignQueryGridsApi.get} — only the requested
126
+ * properties are present.
127
+ */
128
+ export const PluginGridGetResult = z
129
+ .object({
130
+ angle: z.number(),
131
+ props: PluginGridLineProps,
132
+ storeyVisibility: PluginGridStoreyVisibility,
133
+ wings: z.array(PluginGridWingRecord),
134
+ bounds: BBoxComponents,
135
+ })
136
+ .partial()
137
+ export type PluginGridGetResult = z.infer<typeof PluginGridGetResult>
138
+
139
+ // ---------------------------------------------------------------------------
140
+ // Abstract API
141
+ // ---------------------------------------------------------------------------
142
+
143
+ /**
144
+ * `design.query.grids.*` — structural-grid-specific reads.
145
+ *
146
+ * A **grid** (grid group) is a structural/documentation grid: one or more
147
+ * *wings* (families of parallel lines with a shared local frame), each holding
148
+ * tagged grid *lines* (straight lines, or a lone arc). Enumerate grids with
149
+ * `design.query.listGrids`; read an individual grid's structure here.
150
+ *
151
+ * Lines have no stable identity of their own — mutating APIs address them
152
+ * positionally as `{ wing, line }` index pairs into the `wings` arrays
153
+ * returned by {@linkcode get}. Structural edits (adding/removing lines,
154
+ * count changes) re-index lines; re-query after mutating.
155
+ *
156
+ * Accessed via `snaptrude.design.query.grids`.
157
+ */
158
+ export abstract class PluginDesignQueryGridsApi {
159
+ constructor() {}
160
+
161
+ /**
162
+ * Get properties of a grid by its ID.
163
+ *
164
+ * Only the properties listed in `properties` are returned — unlisted
165
+ * properties will be `undefined` in the result. `wings` is the heavy
166
+ * read (it registers a world-space {@linkcode CurveHandle} per line);
167
+ * request it only when the geometry is needed.
168
+ *
169
+ * Units: `angle` is in **degrees** (positive = CCW about +Y); `spacing`,
170
+ * `span`, `bounds`, and curve coordinates are in **Snaptrude units**,
171
+ * world space.
172
+ *
173
+ * @param gridId - The unique grid group ID
174
+ * @param properties - Array of property names to retrieve. See
175
+ * {@linkcode PluginGridGetProperty}.
176
+ * @returns A partial {@linkcode PluginGridGetResult} containing only the
177
+ * requested properties
178
+ * @throws If the grid does not exist
179
+ *
180
+ * @examplePrompt What is the spacing of this grid?
181
+ * @examplePrompt Read the grid line tags on this structural grid
182
+ * @examplePrompt Get the geometry of every line in this grid
183
+ * @examplePrompt Which storeys is this grid hidden on?
184
+ *
185
+ * # Example
186
+ * ```ts
187
+ * const [grid] = await snaptrude.design.query.listGrids()
188
+ * const { wings } = await snaptrude.design.query.grids.get(grid, ["wings"])
189
+ * // wings[0].lines[0].curve is an opaque CurveHandle in world space;
190
+ * // read its coordinates via `snaptrude.core.geom.curve`.
191
+ * ```
192
+ */
193
+ public abstract get(
194
+ gridId: string,
195
+ properties: z.infer<typeof PluginGridGetProperty>[],
196
+ ): PluginApiReturn<PluginGridGetResult>
197
+ }
@@ -1,6 +1,7 @@
1
1
  import * as z from "zod"
2
2
  import { PluginApiReturn } from "../../../types"
3
3
  import { ComponentHandle, BBoxComponents } from "../../../handles"
4
+ import type { MassParametersRecord } from "../../../massParameters"
4
5
  import {
5
6
  PluginSpaceType,
6
7
  PluginMassType,
@@ -11,6 +12,7 @@ import { PluginStaircasePreset } from "../create"
11
12
  import { PluginDesignQueryGeometryApi } from "./geometry"
12
13
  import { PluginDesignQuerySpacesApi } from "./spaces"
13
14
  import { PluginDesignQueryReferenceLinesApi } from "./referenceLines"
15
+ import { PluginDesignQueryGridsApi } from "./grids"
14
16
 
15
17
  // ---------------------------------------------------------------------------
16
18
  // Entity type vocabulary
@@ -27,6 +29,7 @@ import { PluginDesignQueryReferenceLinesApi } from "./referenceLines"
27
29
  * | `"wall"` | Wall |
28
30
  * | `"space"` | Space (a room mass) |
29
31
  * | `"mass"` | Generic mass (non-room) |
32
+ * | `"void"` | A hosted cutting solid, separate from spaces and masses |
30
33
  * | `"door"` | Door |
31
34
  * | `"window"` | Window |
32
35
  * | `"floor"` | Floor |
@@ -41,11 +44,14 @@ import { PluginDesignQueryReferenceLinesApi } from "./referenceLines"
41
44
  * | `"curtainWall"` | Parametric curtain wall |
42
45
  * | `"mullion"` | Curtain-wall mullion |
43
46
  * | `"panel"` | Curtain-wall panel |
47
+ * | `"parametricComponent"` | A placed parametric family instance (native or Revit-imported). Its geometry is rebuilt from `design.family` parameters, so read and drive it through `design.family.getParameters` / `setParameters` rather than editing its meshes. |
48
+ * | `"grid"` | Structural grid group |
44
49
  */
45
50
  export const PluginEntityType = z.enum([
46
51
  "wall",
47
52
  "space",
48
53
  "mass",
54
+ "void",
49
55
  "door",
50
56
  "window",
51
57
  "floor",
@@ -60,6 +66,8 @@ export const PluginEntityType = z.enum([
60
66
  "curtainWall",
61
67
  "mullion",
62
68
  "panel",
69
+ "parametricComponent",
70
+ "grid",
63
71
  ])
64
72
  export type PluginEntityType = z.infer<typeof PluginEntityType>
65
73
 
@@ -173,7 +181,6 @@ export type PluginDesignQueryComponentsArgs = z.infer<
173
181
  * | `isLocked` | `boolean` | Lock flag |
174
182
  * | `isHidden` | `boolean` | User-hidden flag |
175
183
  * | `isSelected` | `boolean` | Current selection state |
176
- * | `isVisible` | `boolean` | Whether the entity currently has a visible representation on canvas (user hide flag AND LOD/mode gating both considered); read-only |
177
184
  * | `boundingBox` | {@linkcode BBoxComponents} | World-space AABB |
178
185
  * | `adjacency` | `{ spaceId: string; value: number }[]` | Adjacency relationships (spaces/masses only). `value`: `2` = Direct (required), `1` = Indirect or physical contact, `-1` = Restricted; `0` entries are filtered out. `[]` when adjacency has never been computed — see `program.adjacency.compute`. |
179
186
  */
@@ -193,7 +200,6 @@ export const PluginEntityProperties = z
193
200
  isLocked: z.boolean(),
194
201
  isHidden: z.boolean(),
195
202
  isSelected: z.boolean(),
196
- isVisible: z.boolean(),
197
203
  boundingBox: BBoxComponents,
198
204
  adjacency: z.array(z.object({ spaceId: z.string(), value: z.number() })),
199
205
  })
@@ -306,6 +312,8 @@ export abstract class PluginDesignQueryApi {
306
312
  public abstract spaces: PluginDesignQuerySpacesApi
307
313
  /** Reference-line-specific reads. See {@linkcode PluginDesignQueryReferenceLinesApi}. */
308
314
  public abstract referenceLines: PluginDesignQueryReferenceLinesApi
315
+ /** Structural-grid-specific reads. See {@linkcode PluginDesignQueryGridsApi}. */
316
+ public abstract grids: PluginDesignQueryGridsApi
309
317
 
310
318
  constructor() {}
311
319
 
@@ -348,6 +356,9 @@ export abstract class PluginDesignQueryApi {
348
356
  * List all entities of one BIM object type — wall, door, slab, panel, and so
349
357
  * on — optionally narrowed by the shared filter.
350
358
  *
359
+ * `"void"` lists native Void components (made by `design.create.void`),
360
+ * as does `design.query.listVoids`. `"mass"` excludes voids.
361
+ *
351
362
  * @param type - the {@linkcode PluginEntityType} to list
352
363
  * @param filter - an optional {@linkcode PluginEntityFilter}
353
364
  * @returns matching entities as {@linkcode ComponentHandle}`[]`
@@ -439,6 +450,8 @@ export abstract class PluginDesignQueryApi {
439
450
  * List all the generic masses (non-room massing volumes) in the project,
440
451
  * optionally filtered by storey, building, label, mass type, or region.
441
452
  *
453
+ * Excludes Void components. Use `design.query.listVoids` for hosted cutters.
454
+ *
442
455
  * @param filter - an optional {@linkcode PluginEntityFilter}
443
456
  * @returns mass {@linkcode ComponentHandle}`[]`
444
457
  *
@@ -459,6 +472,19 @@ export abstract class PluginDesignQueryApi {
459
472
  filter?: PluginEntityFilter,
460
473
  ): PluginApiReturn<ComponentHandle[]>
461
474
 
475
+ /**
476
+ * List Void components, excluding masses and spaces. Voids cut their hosts.
477
+ * Use family queries for authored parametric families with a cut relationship.
478
+ *
479
+ * @param filter - Optional storey, building, selection, or region filter.
480
+ * @returns Void component handles, or an empty array when none match.
481
+ * @example
482
+ * const voids = await snaptrude.design.query.listVoids({ storeys: [1] })
483
+ */
484
+ public abstract listVoids(
485
+ filter?: PluginEntityFilter,
486
+ ): PluginApiReturn<ComponentHandle[]>
487
+
462
488
  /**
463
489
  * List all the doors in the project, optionally filtered by storey, building,
464
490
  * selection state, or region.
@@ -723,6 +749,27 @@ export abstract class PluginDesignQueryApi {
723
749
  filter?: PluginEntityFilter,
724
750
  ): PluginApiReturn<ComponentHandle[]>
725
751
 
752
+ /**
753
+ * List all the structural grids (grid groups) in the project, optionally
754
+ * filtered by storey, building, selection state, or region.
755
+ *
756
+ * @param filter - an optional {@linkcode PluginEntityFilter}
757
+ * @returns grid-group {@linkcode ComponentHandle}`[]`
758
+ *
759
+ * @examplePrompt List all the structural grids in the model
760
+ * @examplePrompt How many grids are on the ground floor?
761
+ * @examplePrompt Show the grids on this storey
762
+ * @examplePrompt Which grids are currently selected?
763
+ *
764
+ * # Example
765
+ * ```ts
766
+ * const groundFloorGrids = await snaptrude.design.query.listGrids({ storeys: [1] })
767
+ * ```
768
+ */
769
+ public abstract listGrids(
770
+ filter?: PluginEntityFilter,
771
+ ): PluginApiReturn<ComponentHandle[]>
772
+
726
773
  // ── single-entity access & identity ─────────────────────────────────────────
727
774
 
728
775
  /**
@@ -854,7 +901,8 @@ export abstract class PluginDesignQueryApi {
854
901
 
855
902
  /**
856
903
  * List an entity's direct child entities — for example the doors and windows
857
- * hosted in a wall.
904
+ * hosted in a wall, or the voids (holes, shafts, openings) cut in a slab,
905
+ * floor, roof or ceiling by `design.create.void`.
858
906
  * @param component - the entity's {@linkcode ComponentHandle}
859
907
  * @returns child {@linkcode ComponentHandle}`[]` (`[]` if none)
860
908
  *
@@ -862,6 +910,7 @@ export abstract class PluginDesignQueryApi {
862
910
  * @examplePrompt Show the child elements of the selected object
863
911
  * @examplePrompt Which openings belong to this wall?
864
912
  * @examplePrompt List everything nested under this mass
913
+ * @examplePrompt List all holes in this slab
865
914
  *
866
915
  * # Example
867
916
  * ```ts
@@ -881,7 +930,8 @@ export abstract class PluginDesignQueryApi {
881
930
  ): PluginApiReturn<ComponentHandle[]>
882
931
 
883
932
  /**
884
- * Get an entity's host/parent entity (e.g. the wall a door is cut into).
933
+ * Get an entity's host/parent entity (e.g. the wall a door is cut into, or
934
+ * the slab, floor, roof or ceiling a void is cut through).
885
935
  * @param component - the entity's {@linkcode ComponentHandle}
886
936
  * @returns the host {@linkcode ComponentHandle}, or `null` if top-level
887
937
  *
@@ -889,6 +939,7 @@ export abstract class PluginDesignQueryApi {
889
939
  * @examplePrompt Find the parent of the selected window
890
940
  * @examplePrompt What is this element attached to?
891
941
  * @examplePrompt Which wall hosts this window?
942
+ * @examplePrompt Which slab is this shaft in?
892
943
  *
893
944
  * # Example
894
945
  * ```ts
@@ -1014,6 +1065,55 @@ export abstract class PluginDesignQueryApi {
1014
1065
  staircase: ComponentHandle,
1015
1066
  ): PluginApiReturn<PluginStaircaseParams | null>
1016
1067
 
1068
+ /**
1069
+ * Read a mass's creation-parameter record — the recipe it was built from
1070
+ * (`kind` plus the values that constructor was called with). Present on
1071
+ * masses committed from a `core.geom.create` brep constructor that carries a
1072
+ * recipe: {@linkcode MassParametersRecord} covers the four primitives
1073
+ * (sphere, cylinder, cone, torus), extrusions, revolutions, lofts and sweeps.
1074
+ *
1075
+ * A fillet, chamfer, shell or offset of a recorded solid keeps the record
1076
+ * too: `kind` stays the base constructor and the operation is appended to the
1077
+ * record's `operations` list. Edit any of it with `design.update.parameters`.
1078
+ *
1079
+ * `null` for everything else — drawn masses, imported geometry, booleans,
1080
+ * split parts, `brepFromFaces` / `brepFromMesh`, and results built on a
1081
+ * source that carried no record — and for a mass whose record no longer
1082
+ * matches what is on
1083
+ * screen (a later free-form edit dropped the recipe, or the mass carries a
1084
+ * baked scale). `null` too when the recipe was not recordable: the record
1085
+ * schema has its own caps (a sweep path of at most 512 points, a loft of at
1086
+ * most 32 sections, at most 8 chained `operations`, at most 256 curves in one
1087
+ * profile loop and 64 holes in one contour), and a mass built past one of
1088
+ * them — through a route that does not enforce the matching creator cap —
1089
+ * commits as ordinary geometry carrying no record. The `operations` cap is
1090
+ * the one an agent can walk into by accident: a 9th chained
1091
+ * fillet/chamfer/shell/offset drops the record silently, so the result
1092
+ * commits as ordinary geometry and reads back `null` here. A record is never
1093
+ * reported unless it is still the truth.
1094
+ *
1095
+ * Points and axes come back in **world** coordinates. Pure read — nothing is
1096
+ * created or modified.
1097
+ *
1098
+ * @param component - the mass's {@linkcode ComponentHandle}
1099
+ * @returns the {@linkcode MassParametersRecord}, or `null`
1100
+ *
1101
+ * @examplePrompt What radius is this sphere?
1102
+ * @examplePrompt Is this mass parametric?
1103
+ * @examplePrompt Read back the dome's creation parameters
1104
+ * @examplePrompt How tall was this cylinder made?
1105
+ *
1106
+ * # Example
1107
+ * ```ts
1108
+ * const [mass] = await snaptrude.design.query.listMasses({ isSelected: true })
1109
+ * const params = await snaptrude.design.query.getParameters(mass)
1110
+ * if (params?.kind === "sphere") console.log("radius:", params.values.radius)
1111
+ * ```
1112
+ */
1113
+ public abstract getParameters(
1114
+ component: ComponentHandle,
1115
+ ): PluginApiReturn<MassParametersRecord | null>
1116
+
1017
1117
  /**
1018
1118
  * Get the **union** axis-aligned bounding box enclosing a set of entities.
1019
1119
  *
@@ -1090,7 +1190,6 @@ export abstract class PluginDesignQueryApi {
1090
1190
  ): PluginApiReturn<PluginStoreyOutlineResult>
1091
1191
  }
1092
1192
 
1093
-
1094
1193
  /** A point in the world-space plan (x, z) projection, Snaptrude internal units. */
1095
1194
  export const PluginOutlinePlanPoint = z.object({ x: z.number(), z: z.number() })
1096
1195
  export type PluginOutlinePlanPoint = z.infer<typeof PluginOutlinePlanPoint>
@@ -1147,3 +1246,4 @@ export type PluginStoreyOutlineResult = z.infer<
1147
1246
  export * from "./geometry"
1148
1247
  export * from "./spaces"
1149
1248
  export * from "./referenceLines"
1249
+ export * from "./grids"
@@ -124,41 +124,6 @@ export abstract class PluginDesignQuerySpacesApi {
124
124
  public abstract getEnclosure(
125
125
  space: ComponentHandle,
126
126
  ): PluginApiReturn<PluginSpaceEnclosure | null>
127
-
128
- /**
129
- * List the space's **engine-generated BIM components** — the walls, floors
130
- * and slabs the parametric engine derived from this space, grouped by kind.
131
- *
132
- * Unlike {@linkcode getEnclosure} (a geometric best-effort match), this read
133
- * reports the engine's own derivation records, so every returned handle is a
134
- * component the engine created *for this space*.
135
- *
136
- * The derived set is NOT stable across writes: a merge/split/rebuild of the
137
- * space graph retires members and creates successors — re-query after any
138
- * write that touches the space. This is the churn-recovery anchor: when a
139
- * cached derived handle goes stale, call this again to pick up the current
140
- * set.
141
- *
142
- * @param space - The space (room mass) to read
143
- * @returns the generated component handles, grouped by kind
144
- * ({@linkcode PluginSpaceGeneratedBim}); a group is `[]` when the engine
145
- * derived nothing of that kind
146
- * @throws If the space does not exist or the component is not a space/mass
147
- *
148
- * @examplePrompt Which walls did this room generate?
149
- * @examplePrompt List the BIM components derived from the selected space
150
- * @examplePrompt Get the floors and slabs that belong to this room
151
- *
152
- * # Example
153
- * ```ts
154
- * const [space] = await snaptrude.design.query.listSpaces()
155
- * const bim = await snaptrude.design.query.spaces.listGeneratedBim(space)
156
- * console.log(`${bim.walls.length} walls, ${bim.floors.length} floors`)
157
- * ```
158
- */
159
- public abstract listGeneratedBim(
160
- space: ComponentHandle,
161
- ): PluginApiReturn<PluginSpaceGeneratedBim>
162
127
  }
163
128
 
164
129
  /**
@@ -308,36 +273,3 @@ export const PluginSpaceEnclosure = z.object({
308
273
  adjacentSpaces: z.array(PluginAdjacentSpace),
309
274
  })
310
275
  export type PluginSpaceEnclosure = z.infer<typeof PluginSpaceEnclosure>
311
-
312
- /**
313
- * Arguments for {@linkcode PluginDesignQuerySpacesApi.listGeneratedBim}.
314
- *
315
- * | Property | Type | Description |
316
- * |---|---|---|
317
- * | `space` | {@linkcode ComponentHandle} | The space (room mass) to read |
318
- */
319
- export const PluginDesignQuerySpacesListGeneratedBimArgs = z.object({
320
- space: ComponentHandle,
321
- })
322
- export type PluginDesignQuerySpacesListGeneratedBimArgs = z.infer<
323
- typeof PluginDesignQuerySpacesListGeneratedBimArgs
324
- >
325
-
326
- /**
327
- * Result of {@linkcode PluginDesignQuerySpacesApi.listGeneratedBim} — the
328
- * space's engine-generated BIM component handles, grouped by kind. The set
329
- * changes whenever a write merges/splits/rebuilds the space graph — re-query
330
- * after writes rather than caching it.
331
- *
332
- * | Property | Type | Description |
333
- * |---|---|---|
334
- * | `walls` | {@linkcode ComponentHandle}`[]` | Walls the engine derived from the space |
335
- * | `floors` | {@linkcode ComponentHandle}`[]` | Floors the engine derived from the space |
336
- * | `slabs` | {@linkcode ComponentHandle}`[]` | Slabs the engine derived from the space |
337
- */
338
- export const PluginSpaceGeneratedBim = z.object({
339
- walls: z.array(ComponentHandle),
340
- floors: z.array(ComponentHandle),
341
- slabs: z.array(ComponentHandle),
342
- })
343
- export type PluginSpaceGeneratedBim = z.infer<typeof PluginSpaceGeneratedBim>
@@ -1,23 +1,25 @@
1
1
  import * as z from "zod"
2
2
  import { PluginApiReturn } from "../../../types"
3
3
 
4
+ /** An exact saved native wall family. Access is checked on every use; Draw selection is not registration. */
5
+ export const PluginNativeWallType = z.object({
6
+ id: z.string().min(1),
7
+ version: z.number().int().positive(),
8
+ })
9
+ export type PluginNativeWallType = z.infer<typeof PluginNativeWallType>
10
+
11
+ /** Legacy project type name/id, or an exact authorized native wall family pin. */
12
+ export const PluginWallType = z.union([z.string().trim().min(1), PluginNativeWallType])
13
+ export type PluginWallType = z.infer<typeof PluginWallType>
14
+
4
15
  /**
5
- * `snaptrude.design.types` — READ-ONLY reference over the project's building
6
- * **type / assembly** system (the Project Properties layer stacks: External /
7
- * Internal walls, slabs, floors, ceilings, roofs). A type bundles a labelled
8
- * layer stack — each layer's role, thickness (engine units) and material — plus a
9
- * summed total thickness. Both the built-in defaults and any team/user-added types
10
- * are surfaced.
11
- *
12
- * Types are plain value records ({@linkcode PluginBuildingType}) — NOT scene
13
- * entities/handles. A type's `id` is a stable `"<kind>:<name>"` token
14
- * (e.g. `"wall:brickWithPlasterAndPaint"`) returned by
15
- * {@linkcode PluginDesignTypesApi.list} and consumed by
16
- * {@linkcode PluginDesignTypesApi.get}. Reads never throw — an unknown id yields
17
- * `null`; a kind with no types yields `[]`.
18
- *
19
- * These are reads only: there is no engine seam to author a type from a plugin
20
- * (types are created through the construction/project-properties UI).
16
+ * Read-only project assemblies and authorized saved native wall families.
17
+ * Legacy ids use `"<kind>:<name>"`. Native wall records carry `nativeFamily`:
18
+ * pass that exact `{ id, version }` pin to get, create.walls, create.wallRuns,
19
+ * or update.wall. Labels and bare definition ids do not select native families.
20
+ * Native lengths use Snaptrude units (1 SU = 254 mm).
21
+ * Missing ids return null; catalog/network failures reject rather than return
22
+ * an incomplete catalog. Author native families with design.family.
21
23
  */
22
24
  export abstract class PluginDesignTypesApi {
23
25
  constructor() {}
@@ -46,10 +48,10 @@ export abstract class PluginDesignTypesApi {
46
48
  ): PluginApiReturn<PluginBuildingTypeSummary[]>
47
49
 
48
50
  /**
49
- * Get one building type by its `"<kind>:<name>"` id — its labelled layer stack
51
+ * Get one building type by its legacy id or exact native wall pin — its labelled layer stack
50
52
  * (each layer's role, thickness and material) plus the summed total thickness.
51
53
  *
52
- * @param typeId The type id from {@linkcode PluginDesignTypesApi.list} (e.g. `"wall:exposedConcrete"`)
54
+ * @param typeId The legacy id or nativeFamily pin from {@linkcode PluginDesignTypesApi.list}
53
55
  * @returns The full type, or `null` if no type matches
54
56
  *
55
57
  * @examplePrompt What layers make up this wall type?
@@ -60,11 +62,11 @@ export abstract class PluginDesignTypesApi {
60
62
  * # Example
61
63
  * ```ts
62
64
  * const [first] = await snaptrude.design.types.list("wall")
63
- * const type = await snaptrude.design.types.get(first.id)
65
+ * const type = await snaptrude.design.types.get(first.nativeFamily ?? first.id)
64
66
  * if (type) for (const layer of type.layers) console.log(layer.name, layer.thickness)
65
67
  * ```
66
68
  */
67
- public abstract get(typeId: string): PluginApiReturn<PluginBuildingType | null>
69
+ public abstract get(typeId: PluginWallType): PluginApiReturn<PluginBuildingType | null>
68
70
  }
69
71
 
70
72
  /** The building-type families exposed by {@linkcode PluginDesignTypesApi}. */
@@ -85,6 +87,8 @@ export const PluginTypeLayer = z.object({
85
87
  name: z.string(),
86
88
  role: z.string(),
87
89
  thickness: z.number(),
90
+ /** Native authored core membership. Never inferred from material or layer name. */
91
+ isCore: z.boolean().optional(),
88
92
  material: z
89
93
  .object({
90
94
  name: z.string(),
@@ -99,7 +103,7 @@ export type PluginTypeLayer = z.infer<typeof PluginTypeLayer>
99
103
  *
100
104
  * | Property | Type | Description |
101
105
  * |---|---|---|
102
- * | `id` | `string` | Stable `"<kind>:<name>"` token — pass to `design.types.get` |
106
+ * | `id` | `string` | Legacy `"<kind>:<name>"` token or native definition id; native lookups use `nativeFamily` |
103
107
  * | `kind` | {@linkcode PluginBuildingTypeKind} | Which family it belongs to |
104
108
  * | `label` | `string` | Human-readable label |
105
109
  * | `isDefault` | `boolean` | `true` for a built-in type, `false` for a team/user type |
@@ -111,6 +115,8 @@ export const PluginBuildingTypeSummary = z.object({
111
115
  label: z.string(),
112
116
  isDefault: z.boolean(),
113
117
  thickness: z.number(),
118
+ /** Present for native walls. Pass the whole pin to get/create/update, not its label or bare id. */
119
+ nativeFamily: PluginNativeWallType.optional(),
114
120
  })
115
121
  export type PluginBuildingTypeSummary = z.infer<typeof PluginBuildingTypeSummary>
116
122
 
@@ -119,7 +125,7 @@ export type PluginBuildingTypeSummary = z.infer<typeof PluginBuildingTypeSummary
119
125
  *
120
126
  * | Property | Type | Description |
121
127
  * |---|---|---|
122
- * | `id` | `string` | Stable `"<kind>:<name>"` token |
128
+ * | `id` | `string` | Legacy type token or native definition id |
123
129
  * | `kind` | {@linkcode PluginBuildingTypeKind} | Which family it belongs to |
124
130
  * | `label` | `string` | Human-readable label |
125
131
  * | `isDefault` | `boolean` | `true` for a built-in type |
@@ -148,9 +154,10 @@ export type PluginDesignTypesListArgs = z.infer<typeof PluginDesignTypesListArgs
148
154
  *
149
155
  * | Property | Type | Description |
150
156
  * |---|---|---|
151
- * | `typeId` | `string` | The `"<kind>:<name>"` id from `design.types.list` |
157
+ * | `typeId` | {@linkcode PluginWallType} | A legacy `"<kind>:<name>"` id or exact `nativeFamily` pin from `design.types.list` |
152
158
  */
153
159
  export const PluginDesignTypesGetArgs = z.object({
154
- typeId: z.string(),
160
+ // Preserve legacy lookup behavior: malformed string ids return null in the host.
161
+ typeId: z.union([z.string(), PluginNativeWallType]),
155
162
  })
156
163
  export type PluginDesignTypesGetArgs = z.infer<typeof PluginDesignTypesGetArgs>