@snaptrude/plugin-core 0.0.0-dev-20260907135026 → 0.0.0-dev-20260908074328

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 (69) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/api-manifest.json +12 -151
  3. package/dist/api/core/geom/create/index.d.ts +86 -559
  4. package/dist/api/core/geom/create/index.d.ts.map +1 -1
  5. package/dist/api/core/geom/query/brep.d.ts +0 -50
  6. package/dist/api/core/geom/query/brep.d.ts.map +1 -1
  7. package/dist/api/core/geom/query/curve.d.ts +35 -58
  8. package/dist/api/core/geom/query/curve.d.ts.map +1 -1
  9. package/dist/api/core/geom/query/edge.d.ts +2 -2
  10. package/dist/api/core/geom/query/face.d.ts +0 -45
  11. package/dist/api/core/geom/query/face.d.ts.map +1 -1
  12. package/dist/api/core/geom/update/curve.d.ts +5 -5
  13. package/dist/api/core/geom/update/profile.d.ts +1 -1
  14. package/dist/api/design/create/index.d.ts +29 -6
  15. package/dist/api/design/create/index.d.ts.map +1 -1
  16. package/dist/api/design/delete/index.d.ts +20 -2
  17. package/dist/api/design/delete/index.d.ts.map +1 -1
  18. package/dist/api/design/query/geometry/index.d.ts +1 -27
  19. package/dist/api/design/query/geometry/index.d.ts.map +1 -1
  20. package/dist/api/design/query/index.d.ts +2 -47
  21. package/dist/api/design/query/index.d.ts.map +1 -1
  22. package/dist/api/design/query/spaces.d.ts +66 -5
  23. package/dist/api/design/query/spaces.d.ts.map +1 -1
  24. package/dist/api/design/update/index.d.ts +0 -87
  25. package/dist/api/design/update/index.d.ts.map +1 -1
  26. package/dist/api/entity/referenceLine.d.ts +2 -2
  27. package/dist/api/entity/referenceLine.d.ts.map +1 -1
  28. package/dist/api/entity/space.d.ts +7 -5
  29. package/dist/api/entity/space.d.ts.map +1 -1
  30. package/dist/api/entity/story.d.ts +4 -4
  31. package/dist/api/presentation/placedViews.d.ts +35 -1
  32. package/dist/api/presentation/placedViews.d.ts.map +1 -1
  33. package/dist/api/presentation/sheets.d.ts +20 -2
  34. package/dist/api/presentation/sheets.d.ts.map +1 -1
  35. package/dist/api/program/spreadsheet.d.ts +4 -4
  36. package/dist/errors/codes.d.ts +8 -3
  37. package/dist/errors/codes.d.ts.map +1 -1
  38. package/dist/handles.d.ts +3 -12
  39. package/dist/handles.d.ts.map +1 -1
  40. package/dist/index.cjs +2766 -3030
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.ts +0 -1
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +2761 -2996
  45. package/dist/index.js.map +1 -1
  46. package/package.json +1 -1
  47. package/snaptrude-plugin-core-0.11.0.tgz +0 -0
  48. package/src/api/core/geom/create/index.ts +84 -588
  49. package/src/api/core/geom/query/brep.ts +0 -51
  50. package/src/api/core/geom/query/curve.ts +2 -25
  51. package/src/api/core/geom/query/edge.ts +2 -2
  52. package/src/api/core/geom/query/face.ts +0 -49
  53. package/src/api/design/create/index.ts +34 -8
  54. package/src/api/design/delete/index.ts +20 -1
  55. package/src/api/design/query/geometry/index.ts +0 -29
  56. package/src/api/design/query/index.ts +2 -50
  57. package/src/api/design/query/spaces.ts +68 -0
  58. package/src/api/design/update/index.ts +0 -94
  59. package/src/api/entity/space.ts +2 -0
  60. package/src/api/presentation/placedViews.ts +29 -1
  61. package/src/api/presentation/sheets.ts +19 -3
  62. package/src/errors/codes.ts +30 -2
  63. package/src/handles.ts +3 -15
  64. package/src/index.ts +0 -1
  65. package/test/errors.test.mjs +4 -0
  66. package/dist/massParameters.d.ts +0 -319
  67. package/dist/massParameters.d.ts.map +0 -1
  68. package/src/massParameters.ts +0 -472
  69. package/test/massParameters.test.mjs +0 -500
@@ -174,11 +174,6 @@ export abstract class PluginGeomQueryBrepApi {
174
174
  * | `"line"` | `startPoint`, `endPoint`, `length` |
175
175
  * | `"arc"` | `startPoint`, `endPoint`, `centre`, `axis`, `radius`, `length` |
176
176
  * | `"circle"` | `centre`, `axis`, `radius`, `length` — a full-circle edge (e.g. a cylinder cap rim) |
177
- * | `"spline"` | `startPoint`, `endPoint`, `degree`, `controlPoints`, `knots`, `length` — a free-form NURBS edge |
178
- *
179
- * For a `"spline"` edge, `knots` is the **expanded** knot vector — each knot
180
- * repeated by its multiplicity, the textbook NURBS form — so
181
- * `knots.length === controlPoints.length + degree + 1`.
182
177
  *
183
178
  * @param brep The brep the edge belongs to
184
179
  * @param edge The edge whose curve to read
@@ -189,7 +184,6 @@ export abstract class PluginGeomQueryBrepApi {
189
184
  * @examplePrompt Is this edge straight or an arc?
190
185
  * @examplePrompt Get the exact start and end points of this edge
191
186
  * @examplePrompt Measure the length of each edge of this mass
192
- * @examplePrompt Read the control points of this curved edge
193
187
  *
194
188
  * # Example
195
189
  * ```ts
@@ -225,16 +219,6 @@ export abstract class PluginGeomQueryBrepApi {
225
219
  radius: number
226
220
  length: number
227
221
  }
228
- | {
229
- type: "spline"
230
- startPoint: Vec3Components
231
- endPoint: Vec3Components
232
- degree: number
233
- controlPoints: Vec3Components[]
234
- /** Expanded by multiplicity: `controlPoints.length + degree + 1` entries. */
235
- knots: number[]
236
- length: number
237
- }
238
222
  >
239
223
 
240
224
  /**
@@ -382,37 +366,6 @@ export abstract class PluginGeomQueryBrepApi {
382
366
  */
383
367
  public abstract getBoundingBox(brep: BrepHandle): PluginApiReturn<BBoxComponents>
384
368
 
385
- /**
386
- * Get the enclosed **volume** of a closed solid, integrated from its exact
387
- * surfaces. Curved faces are measured analytically, not from their
388
- * tessellation — a real sphere of radius 5 reports 523.6, whatever its
389
- * triangle count. That makes this the reliable way to confirm a solid is the
390
- * shape you intended (a torus should measure 2·π²·R·r²).
391
- *
392
- * Runs on the OpenCascade kernel (the first kernel call loads a wasm of tens
393
- * of MB — expect a pause of seconds).
394
- *
395
- * @param brep The solid to measure
396
- * @returns The enclosed volume in cubic raw Babylon units
397
- * @throws OPERATION_FAILED if the kernel cannot compute the volume (the brep
398
- * is not a closed solid)
399
- *
400
- * @examplePrompt What is the volume of this mass?
401
- * @examplePrompt How much concrete is in this shape?
402
- * @examplePrompt Check the volume of the dome I just made
403
- *
404
- * # Example
405
- * ```ts
406
- * const [mass] = await snaptrude.design.query.listMasses()
407
- * const brep = await snaptrude.design.query.geometry.getBrep(mass)
408
- * if (brep) {
409
- * const volume = await snaptrude.core.geom.query.brep.getVolume(brep)
410
- * console.log("volume:", volume)
411
- * }
412
- * ```
413
- */
414
- public abstract getVolume(brep: BrepHandle): PluginApiReturn<number>
415
-
416
369
  /**
417
370
  * Test whether two breps are geometrically equal.
418
371
  * @param brepA First brep
@@ -581,10 +534,6 @@ export type PluginGeomQueryBrepGetBoundingBoxArgs = z.infer<
581
534
  typeof PluginGeomQueryBrepGetBoundingBoxArgs
582
535
  >
583
536
 
584
- /** Arguments for {@linkcode PluginGeomQueryBrepApi.getVolume}. `{ brep: BrepHandle }` */
585
- export const PluginGeomQueryBrepGetVolumeArgs = brepArg
586
- export type PluginGeomQueryBrepGetVolumeArgs = z.infer<typeof PluginGeomQueryBrepGetVolumeArgs>
587
-
588
537
  /**
589
538
  * Arguments for {@linkcode PluginGeomQueryBrepApi.isEqual}.
590
539
  *
@@ -3,8 +3,8 @@ import { PluginApiReturn } from "../../../../types"
3
3
  import { Vec3Handle, CurveHandle, LineHandle, Vec3Components } from "../../../../handles"
4
4
 
5
5
  /**
6
- * Curve queries — read-only geometric questions about curves (lines, arcs and
7
- * splines) and the relationships between two curves (all-handle model, §11).
6
+ * Curve queries — read-only geometric questions about curves (lines and arcs)
7
+ * and the relationships between two curves (all-handle model, §11).
8
8
  *
9
9
  * Every method takes opaque curve handles ({@linkcode CurveHandle}/{@linkcode LineHandle})
10
10
  * and point handles ({@linkcode Vec3Handle}) and returns plain values — points as
@@ -13,29 +13,6 @@ import { Vec3Handle, CurveHandle, LineHandle, Vec3Components } from "../../../..
13
13
  * {@linkcode CurveHandle} (or `null` when there is no result). No query mutates its
14
14
  * inputs.
15
15
  *
16
- * ## Splines
17
- *
18
- * A {@linkcode CurveHandle} is a line, an arc, or a NURBS spline (minted by
19
- * `core.geom.create.splineFromPoints`). Every method here accepts a spline at
20
- * compile time, but only the reads backed by the engine's spline math answer
21
- * for one today. The rest throw `PRECONDITION_FAILED` ("not supported for
22
- * splines yet") — a typed refusal, never a quietly wrong answer.
23
- *
24
- * | Splines | Members |
25
- * |---|---|
26
- * | **supported** | {@linkcode PluginGeomQueryCurveApi.getStartPoint}, {@linkcode PluginGeomQueryCurveApi.getEndPoint}, {@linkcode PluginGeomQueryCurveApi.getLength}, {@linkcode PluginGeomQueryCurveApi.getTangent}, {@linkcode PluginGeomQueryCurveApi.listPoints}, {@linkcode PluginGeomQueryCurveApi.getNearestPoint} |
27
- * | **not yet** | `getMidPoint`, `getChordLength`, `getNormal`, `getProjection`, `getPointAtDistance`, `getParameterAtPoint`, `getCurvature`, `getDistanceToPoint`, `getDistanceAlong`, `listSubdivisions`, `isLinear`, `isOnCurve`, `hasPoint`, `isEqual`, `isOverlapping`, `getCommonPart`, `listIntersections`, `getMergedCurve`, `isContinuous`, `isParallel`, `getShortestGap`, `getDistanceBetween` |
28
- *
29
- * {@linkcode PluginGeomQueryCurveApi.isOverlapping} is deliberately in the
30
- * second row: its line/arc path falls back to structural equality, which would
31
- * answer a spline pair wrongly rather than not at all.
32
- *
33
- * To work around the second row, sample the curve —
34
- * {@linkcode PluginGeomQueryCurveApi.listPoints} then the ordinary
35
- * `core.math.vec3` operations — or read a spline brep edge exactly with
36
- * `core.geom.query.brep.getEdgeCurve`, which returns its degree, control points
37
- * and knots.
38
- *
39
16
  * Accessed via `snaptrude.core.geom.query.curve`.
40
17
  */
41
18
  export abstract class PluginGeomQueryCurveApi {
@@ -69,9 +69,9 @@ export abstract class PluginGeomQueryEdgeApi {
69
69
  public abstract listVertices(edge: EdgeHandle): PluginApiReturn<VertexHandle[]>
70
70
 
71
71
  /**
72
- * Get the underlying curve geometry of an edge (a line, arc or spline).
72
+ * Get the underlying curve geometry of an edge (a line or arc).
73
73
  * @param edge The edge to query
74
- * @returns The curve as a {@linkcode CurveHandle} (`line_`, `arc_` or `spline_`), or `null` if it is a circle or unset
74
+ * @returns The curve as a {@linkcode CurveHandle}, or `null` if it is a circle or unset
75
75
  *
76
76
  * # Example
77
77
  * ```ts
@@ -59,49 +59,6 @@ export abstract class PluginGeomQueryFaceApi {
59
59
  */
60
60
  public abstract getMaterialIndex(face: FaceHandle): PluginApiReturn<number>
61
61
 
62
- /**
63
- * Read what KIND of surface a face lies on. This is the one read that tells a
64
- * genuinely curved face from a faceted approximation of one: every face of a
65
- * 200-triangle "dome" answers `"plane"`, while a real dome has faces
66
- * answering `"sphere"`. Use it to confirm a curved solid actually came out
67
- * curved.
68
- *
69
- * | Value | Surface |
70
- * |---|---|
71
- * | `"plane"` | Flat face |
72
- * | `"cylinder"` | Cylindrical face — constant radius about an axis |
73
- * | `"cone"` | Conical face — a tapered ring (a cone or frustum side) |
74
- * | `"sphere"` | Spherical face |
75
- * | `"torus"` | Toroidal face — the ring surface of a donut |
76
- * | `"spline"` | Free-form NURBS face |
77
- *
78
- * Pure read: no geometry kernel is loaded.
79
- *
80
- * @param face The face to query
81
- * @returns The surface kind (see the table), or `null` when the face carries
82
- * no surface classification
83
- *
84
- * @examplePrompt Is this face flat or curved?
85
- * @examplePrompt Check that this dome is a real sphere, not a faceted approximation
86
- * @examplePrompt What kind of surface is this face?
87
- * @examplePrompt How many curved faces does this mass have?
88
- *
89
- * # Example
90
- * ```ts
91
- * const [mass] = await snaptrude.design.query.listMasses()
92
- * const brep = await snaptrude.design.query.geometry.getBrep(mass)
93
- * if (brep) {
94
- * const faces = await snaptrude.core.geom.query.brep.listFaces(brep)
95
- * const kinds = []
96
- * for (const face of faces) kinds.push(await snaptrude.core.geom.query.face.getSurfaceKind(face))
97
- * console.log("spherical faces:", kinds.filter((k) => k === "sphere").length)
98
- * }
99
- * ```
100
- */
101
- public abstract getSurfaceKind(
102
- face: FaceHandle,
103
- ): PluginApiReturn<"plane" | "cylinder" | "cone" | "sphere" | "torus" | "spline" | null>
104
-
105
62
  /**
106
63
  * Get a seed half-edge of a face's outer loop.
107
64
  * @param face The face to query
@@ -355,12 +312,6 @@ export type PluginGeomQueryFaceGetMaterialIndexArgs = z.infer<
355
312
  typeof PluginGeomQueryFaceGetMaterialIndexArgs
356
313
  >
357
314
 
358
- /** Arguments for {@linkcode PluginGeomQueryFaceApi.getSurfaceKind}. `{ face: FaceHandle }` */
359
- export const PluginGeomQueryFaceGetSurfaceKindArgs = faceArg
360
- export type PluginGeomQueryFaceGetSurfaceKindArgs = z.infer<
361
- typeof PluginGeomQueryFaceGetSurfaceKindArgs
362
- >
363
-
364
315
  /** Arguments for {@linkcode PluginGeomQueryFaceApi.getHalfEdge}. `{ face: FaceHandle }` */
365
316
  export const PluginGeomQueryFaceGetHalfEdgeArgs = faceArg
366
317
  export type PluginGeomQueryFaceGetHalfEdgeArgs = z.infer<typeof PluginGeomQueryFaceGetHalfEdgeArgs>
@@ -217,11 +217,26 @@ export abstract class PluginDesignCreateApi {
217
217
  * Create a **floor** by extruding a footprint contour by `thickness`
218
218
  * (extruded upward).
219
219
  *
220
+ * The parametric engine owns floor topology and may resolve the request
221
+ * differently than asked: drawing against existing floors can **split** the
222
+ * footprint into several floors, or **merge** it into a pre-existing
223
+ * neighbour (that floor's region grows; nothing new is created). The call
224
+ * honors the engine's resolution and returns **every floor that covers the
225
+ * requested footprint after the operation** — the newly created floor(s),
226
+ * and/or the pre-existing floor that absorbed it. The array is never empty
227
+ * on success; a lone independently-created floor comes back as `[floor]`.
228
+ *
229
+ * **Breaking change in 0.11.0** — previously returned a single
230
+ * {@linkcode ComponentHandle}; callers must switch to the array (the first
231
+ * element preserves the old single-floor behavior for simple creates).
232
+ *
220
233
  * @param contour - Footprint (outer + holes)
221
234
  * @param thickness - Floor thickness (> 0)
222
235
  * @param position - Offset from origin
223
- * @returns the {@linkcode ComponentHandle} of the created floor
224
- * @throws if the contour is invalid or the thickness is not positive
236
+ * @returns the {@linkcode ComponentHandle}s of every floor covering the
237
+ * requested footprint after parametric resolution (created and/or absorbing)
238
+ * @throws if the contour is invalid, the thickness is not positive, or the
239
+ * engine rejected the operation (nothing covers the footprint)
225
240
  *
226
241
  * @examplePrompt Create a floor from this room outline
227
242
  * @examplePrompt Add a 100mm thick floor over the footprint
@@ -232,14 +247,14 @@ export abstract class PluginDesignCreateApi {
232
247
  * ```ts
233
248
  * const rect = await snaptrude.core.geom.create.profileRect(5, 4)
234
249
  * const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
235
- * const floor = await snaptrude.design.create.floor(contour, 0.1)
250
+ * const [floor, ...siblings] = await snaptrude.design.create.floor(contour, 0.1)
236
251
  * ```
237
252
  */
238
253
  public abstract floor(
239
254
  contour: ContourHandle,
240
255
  thickness: number,
241
256
  position?: Vec3Handle,
242
- ): PluginApiReturn<ComponentHandle>
257
+ ): PluginApiReturn<ComponentHandle[]>
243
258
 
244
259
  /**
245
260
  * Create a **roof** by extruding a footprint contour by `thickness`. Created
@@ -395,7 +410,13 @@ export abstract class PluginDesignCreateApi {
395
410
  * single undo entry. The storey must already exist
396
411
  * (`core.storeys.create` first). Default: geometry-derived — a profile
397
412
  * drawn at y = 0 lands on storey 1; the ACTIVE storey is NOT consulted.
398
- * @returns a {@linkcode ComponentHandle}`[]` (one per wall), in profile order
413
+ * @returns the actually-created wall {@linkcode ComponentHandle}s. The
414
+ * parametric engine owns wall topology — curves touching existing walls
415
+ * may merge into or split against them, so the returned count can differ
416
+ * from the input curve count. Profile-ordered 1:1 matches come first,
417
+ * then the remaining merged/split products in creation order. Re-query
418
+ * (e.g. `design.query.spaces.listGeneratedBim`) rather than assuming a
419
+ * wall per input curve.
399
420
  * @throws if the profile is empty, `wallType` names no wall type in the
400
421
  * project, `storey` does not exist, or wall creation fails
401
422
  *
@@ -537,7 +558,9 @@ export abstract class PluginDesignCreateApi {
537
558
  * the item's height yourself.
538
559
  * @param options - Optional placement options: `label` — instance name
539
560
  * (default auto `${name}Ins${n}`); `createNewSourceMesh` — emit a
540
- * source-mesh creation command (default `true`)
561
+ * source-mesh creation command (default `true`). `position.y` is always
562
+ * grounded: the placed instance's bounding-box bottom rests at it (the
563
+ * surface-flush grounding described above)
541
564
  * @param angleInDegrees - Optional signed rotation about the vertical axis, in
542
565
  * degrees (same convention as {@linkcode PluginDesignTransformApi.rotate}).
543
566
  * Applied at creation time so it is part of the placement's single undo entry.
@@ -571,7 +594,10 @@ export abstract class PluginDesignCreateApi {
571
594
  public abstract furniture(
572
595
  catalogId: string,
573
596
  position: Vec3Handle,
574
- options?: { label?: string; createNewSourceMesh?: boolean },
597
+ options?: {
598
+ label?: string
599
+ createNewSourceMesh?: boolean
600
+ },
575
601
  angleInDegrees?: number,
576
602
  ): PluginApiReturn<ComponentHandle>
577
603
 
@@ -1219,7 +1245,7 @@ export const PluginDesignCreateWallsArgs = z.object({
1219
1245
  export type PluginDesignCreateWallsArgs = z.infer<
1220
1246
  typeof PluginDesignCreateWallsArgs
1221
1247
  >
1222
- // TRANSPORT: positional signature shipped — storey is the trailing 5th arg:
1248
+ // TRANSPORT: positional signature shipped:
1223
1249
  // walls(profile: ProfileHandle, height?: number, thickness?: number, wallType?: string, storey?: number)
1224
1250
 
1225
1251
  // ---------------------------------------------------------------------------
@@ -20,6 +20,22 @@ export const PluginDesignDeleteEntitiesArgs = z.object({
20
20
  })
21
21
  export type PluginDesignDeleteEntitiesArgs = z.infer<typeof PluginDesignDeleteEntitiesArgs>
22
22
 
23
+ /**
24
+ * Result of {@linkcode PluginDesignDeleteApi.entities} — the shared
25
+ * change-result shape plus the delete cascade. Deliberately a delete-specific
26
+ * extension of {@linkcode PluginDesignChangeResult} (which other change
27
+ * mutations keep unchanged).
28
+ *
29
+ * | Property | Type | Description |
30
+ * |---|---|---|
31
+ * | `affected` | {@linkcode ComponentHandle}`[]` | The entities that were deleted (the resolved input set) |
32
+ * | `cascaded` | {@linkcode ComponentHandle}`[]`? | Components PG2 removed as a consequence — derived walls/floors/slabs of deleted spaces; returned so callers can invalidate cached handles |
33
+ */
34
+ export const PluginDesignDeleteResult = PluginDesignChangeResult.extend({
35
+ cascaded: z.array(ComponentHandle).optional(),
36
+ })
37
+ export type PluginDesignDeleteResult = z.infer<typeof PluginDesignDeleteResult>
38
+
23
39
  /**
24
40
  * `snaptrude.design.delete.*` — **hard removal** of scene BIM entities.
25
41
  *
@@ -43,6 +59,9 @@ export abstract class PluginDesignDeleteApi {
43
59
  * @returns The entities that were deleted, as {@linkcode ComponentHandle}`[]`
44
60
  * (echoed host-side from the resolved+deleted set — the engine returns no ids).
45
61
  * Deleted handles are **stale** afterwards: re-resolving one throws `HANDLE_INVALID`.
62
+ * When the parametric engine removes further components as a consequence
63
+ * (derived walls/floors/slabs of deleted spaces), those are reported in the
64
+ * optional `cascaded` array — invalidate any cached handles to them too.
46
65
  * @throws If any supplied handle is unknown/forged (`HANDLE_INVALID`) — the whole
47
66
  * call rejects before anything is deleted (all-or-nothing resolution).
48
67
  *
@@ -66,5 +85,5 @@ export abstract class PluginDesignDeleteApi {
66
85
  */
67
86
  public abstract entities(
68
87
  components: ComponentHandle[],
69
- ): PluginApiReturn<PluginDesignChangeResult>
88
+ ): PluginApiReturn<PluginDesignDeleteResult>
70
89
  }
@@ -34,25 +34,10 @@ export abstract class PluginDesignQueryGeometryApi {
34
34
  * scene entity, as a reusable {@linkcode BrepHandle} for the
35
35
  * `core.geom.query.brep.*` reads.
36
36
  *
37
- * **Frame.** By default the brep comes back in the component's own LOCAL frame
38
- * (its vertices are relative to the mesh origin, exactly as stored) — the
39
- * behaviour every 0.9.x caller relies on. Pass `{ frame: "world" }` to get the
40
- * same solid placed where it sits in the scene (world coordinates, like
41
- * `getBottomContour` / `getTriangulatedMeshes` and every `design.query.measure`
42
- * read). Use `"world"` whenever the handle will be COMBINED with other scene
43
- * geometry or committed back beside its source: booleans between two scene
44
- * masses, `brepFromFillet` / `brepFromShell` / `brepFromOffset` /
45
- * `brepFromChamfer` on a scene mass followed by `massFromBrep`, or comparing
46
- * its vertices with a bounding box. A world-frame handle from a parametrically
47
- * live mass also carries that mass's recipe, so an operation result keeps an
48
- * editable record.
49
- *
50
37
  * @param component - The scene component to read
51
- * @param options - `frame`: `"local"` (default, mesh-local coordinates) or `"world"` (scene coordinates)
52
38
  * @returns The brep as a {@linkcode BrepHandle}, or `null` if the component has no brep geometry
53
39
  *
54
40
  * @examplePrompt Get the 3D solid geometry of the selected wall
55
- * @examplePrompt Round the top rim of this column and put it back where it is
56
41
  * @examplePrompt How many faces does this mass have?
57
42
  * @examplePrompt Inspect the mesh of this slab so I can look at its faces and edges
58
43
  * @examplePrompt Read the vertices of the selected column's geometry
@@ -63,16 +48,10 @@ export abstract class PluginDesignQueryGeometryApi {
63
48
  * if (brep) {
64
49
  * const faces = await snaptrude.core.geom.query.brep.listFaces(brep)
65
50
  * }
66
- *
67
- * // Operate on a scene mass and commit the result where the mass sits:
68
- * const placed = await snaptrude.design.query.geometry.getBrep(mass, { frame: "world" })
69
- * const rounded = await snaptrude.core.geom.create.brepFromFillet(placed, edges, 0.2)
70
- * await snaptrude.design.create.massFromBrep(rounded, "Rounded")
71
51
  * ```
72
52
  */
73
53
  public abstract getBrep(
74
54
  component: ComponentHandle,
75
- options?: PluginDesignQueryGeometryGetBrepOptions,
76
55
  ): PluginApiReturn<BrepHandle | null>
77
56
 
78
57
  /**
@@ -210,16 +189,8 @@ export abstract class PluginDesignQueryGeometryApi {
210
189
  * |---|---|---|
211
190
  * | `component` | {@linkcode ComponentHandle} | The scene component to read |
212
191
  */
213
- /** Options for {@linkcode PluginDesignQueryGeometryApi.getBrep}: `frame` defaults to `"local"`. */
214
- export type PluginDesignQueryGeometryGetBrepOptions = { frame?: "local" | "world" }
215
- export const PluginDesignQueryGeometryGetBrepOptions: z.ZodType<
216
- PluginDesignQueryGeometryGetBrepOptions,
217
- PluginDesignQueryGeometryGetBrepOptions
218
- > = z.object({ frame: z.enum(["local", "world"]).optional() })
219
-
220
192
  export const PluginDesignQueryGeometryGetBrepArgs = z.object({
221
193
  component: ComponentHandle,
222
- options: PluginDesignQueryGeometryGetBrepOptions.optional(),
223
194
  })
224
195
 
225
196
  export type PluginDesignQueryGeometryGetBrepArgs = z.infer<
@@ -1,7 +1,6 @@
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"
5
4
  import {
6
5
  PluginSpaceType,
7
6
  PluginMassType,
@@ -176,6 +175,7 @@ export type PluginDesignQueryComponentsArgs = z.infer<
176
175
  * | `isLocked` | `boolean` | Lock flag |
177
176
  * | `isHidden` | `boolean` | User-hidden flag |
178
177
  * | `isSelected` | `boolean` | Current selection state |
178
+ * | `isVisible` | `boolean` | Whether the entity currently has a visible representation on canvas (user hide flag AND LOD/mode gating both considered); read-only |
179
179
  * | `boundingBox` | {@linkcode BBoxComponents} | World-space AABB |
180
180
  * | `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`. |
181
181
  */
@@ -195,6 +195,7 @@ export const PluginEntityProperties = z
195
195
  isLocked: z.boolean(),
196
196
  isHidden: z.boolean(),
197
197
  isSelected: z.boolean(),
198
+ isVisible: z.boolean(),
198
199
  boundingBox: BBoxComponents,
199
200
  adjacency: z.array(z.object({ spaceId: z.string(), value: z.number() })),
200
201
  })
@@ -1015,55 +1016,6 @@ export abstract class PluginDesignQueryApi {
1015
1016
  staircase: ComponentHandle,
1016
1017
  ): PluginApiReturn<PluginStaircaseParams | null>
1017
1018
 
1018
- /**
1019
- * Read a mass's creation-parameter record — the recipe it was built from
1020
- * (`kind` plus the values that constructor was called with). Present on
1021
- * masses committed from a `core.geom.create` brep constructor that carries a
1022
- * recipe: {@linkcode MassParametersRecord} covers the four primitives
1023
- * (sphere, cylinder, cone, torus), extrusions, revolutions, lofts and sweeps.
1024
- *
1025
- * A fillet, chamfer, shell or offset of a recorded solid keeps the record
1026
- * too: `kind` stays the base constructor and the operation is appended to the
1027
- * record's `operations` list. Edit any of it with `design.update.parameters`.
1028
- *
1029
- * `null` for everything else — drawn masses, imported geometry, booleans,
1030
- * split parts, `brepFromFaces` / `brepFromMesh`, and results built on a
1031
- * source that carried no record — and for a mass whose record no longer
1032
- * matches what is on
1033
- * screen (a later free-form edit dropped the recipe, or the mass carries a
1034
- * baked scale). `null` too when the recipe was not recordable: the record
1035
- * schema has its own caps (a sweep path of at most 512 points, a loft of at
1036
- * most 32 sections, at most 8 chained `operations`, at most 256 curves in one
1037
- * profile loop and 64 holes in one contour), and a mass built past one of
1038
- * them — through a route that does not enforce the matching creator cap —
1039
- * commits as ordinary geometry carrying no record. The `operations` cap is
1040
- * the one an agent can walk into by accident: a 9th chained
1041
- * fillet/chamfer/shell/offset drops the record silently, so the result
1042
- * commits as ordinary geometry and reads back `null` here. A record is never
1043
- * reported unless it is still the truth.
1044
- *
1045
- * Points and axes come back in **world** coordinates. Pure read — nothing is
1046
- * created or modified.
1047
- *
1048
- * @param component - the mass's {@linkcode ComponentHandle}
1049
- * @returns the {@linkcode MassParametersRecord}, or `null`
1050
- *
1051
- * @examplePrompt What radius is this sphere?
1052
- * @examplePrompt Is this mass parametric?
1053
- * @examplePrompt Read back the dome's creation parameters
1054
- * @examplePrompt How tall was this cylinder made?
1055
- *
1056
- * # Example
1057
- * ```ts
1058
- * const [mass] = await snaptrude.design.query.listMasses({ isSelected: true })
1059
- * const params = await snaptrude.design.query.getParameters(mass)
1060
- * if (params?.kind === "sphere") console.log("radius:", params.values.radius)
1061
- * ```
1062
- */
1063
- public abstract getParameters(
1064
- component: ComponentHandle,
1065
- ): PluginApiReturn<MassParametersRecord | null>
1066
-
1067
1019
  /**
1068
1020
  * Get the **union** axis-aligned bounding box enclosing a set of entities.
1069
1021
  *
@@ -124,6 +124,41 @@ 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>
127
162
  }
128
163
 
129
164
  /**
@@ -273,3 +308,36 @@ export const PluginSpaceEnclosure = z.object({
273
308
  adjacentSpaces: z.array(PluginAdjacentSpace),
274
309
  })
275
310
  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>
@@ -9,7 +9,6 @@ import {
9
9
  PluginSpaceUpdateResult,
10
10
  } from "../../entity/space"
11
11
  import { PluginDesignChangeResult } from "../lock"
12
- import { MassParametersPatch, type MassParametersRecord } from "../../../massParameters"
13
12
  import {
14
13
  PluginBuildableEnvelopePolygonVertex,
15
14
  PluginBuildableEnvelopeSetbackTier,
@@ -137,22 +136,6 @@ export type PluginDesignUpdateStaircaseArgs = z.infer<
137
136
  typeof PluginDesignUpdateStaircaseArgs
138
137
  >
139
138
 
140
- /**
141
- * Arguments for {@linkcode PluginDesignUpdateApi.parameters}.
142
- *
143
- * | Property | Type | Description |
144
- * |---|---|---|
145
- * | `component` | {@linkcode ComponentHandle} | The parametric mass to edit |
146
- * | `patch` | {@linkcode MassParametersPatch} | Partial `values` (+ optional `operations`), or the full edited record |
147
- */
148
- export const PluginDesignUpdateParametersArgs = z.object({
149
- component: ComponentHandle,
150
- patch: MassParametersPatch,
151
- })
152
- export type PluginDesignUpdateParametersArgs = z.infer<
153
- typeof PluginDesignUpdateParametersArgs
154
- >
155
-
156
139
  /**
157
140
  * Sparse edits for a wall (all optional; at least one required). Only the
158
141
  * fields you provide change. Dimensions are in **engine units** (the same
@@ -426,83 +409,6 @@ export abstract class PluginDesignUpdateApi {
426
409
  params: PluginStaircaseParamUpdates,
427
410
  ): PluginApiReturn<PluginDesignChangeResult>
428
411
 
429
- /**
430
- * Edit a parametric mass by patching its creation recipe and rebuilding the
431
- * solid in place — the mass keeps its id, storey, materials, position and
432
- * linked copies; only the geometry changes. Read the current record with
433
- * `design.query.getParameters` first.
434
- *
435
- * `patch` is a partial of `record.values` — or the whole record you read
436
- * back, edited. A key you leave out is unchanged (that includes
437
- * `operations`). Scalars and points MERGE by key (`{ radius: 8 }` changes
438
- * only the radius); arrays (`contour`, `sections`, `path`, `profile`,
439
- * `operations`) REPLACE WHOLE when present — send the complete new list;
440
- * `{ operations: [] }` drops every operation. A patch that changes nothing
441
- * returns the current record and records no edit (no undo step). `kind` and
442
- * `version` are immutable: to change the kind, build a new mass. Keys are the
443
- * record's `values` keys for its `kind` (sphere: `centre`, `radius`;
444
- * cylinder: `base`, `axis`, `radius`, `height`; torus: `centre`, `axis`,
445
- * `majorRadius`, `minorRadius`; …) plus `operations`. To change a fillet
446
- * radius, edit `operations[i].radius` in the record you read and send
447
- * `{ operations }` back. Points and axes are WORLD coordinates in internal
448
- * units, exactly as `getParameters` reports them.
449
- *
450
- * Rebuilds in memory first, then swaps onto the SAME component; every linked
451
- * copy regenerates together. One undo step; saves and syncs to collaborators
452
- * like any geometry edit. Kernel kinds (revolution, sweep, loft, primitives,
453
- * any `operations`) run on OpenCascade — expect a short pause.
454
- *
455
- * @param component - a mass whose `getParameters` is non-null
456
- * @param patch - partial `values` (+ optional `operations`), or the full edited record
457
- * @returns the complete post-edit record, world coordinates (what
458
- * `getParameters` now returns)
459
- * @throws PRECONDITION_FAILED when the mass carries no live recipe — built
460
- * from a boolean, split, `brepFromFaces`/`brepFromMesh` or drawn; edited
461
- * free-form since (push/pull, move face, boolean); or scaled with the
462
- * transform tool. `getParameters` returns `null` for exactly these.
463
- * Do not retry — rebuild it with a recipe constructor and say so.
464
- * Also PRECONDITION_FAILED when the mass is **locked** (the message says
465
- * so). Locking is invisible to `getParameters` — a locked parametric mass
466
- * still reads back a full record — so this is the one PRECONDITION_FAILED
467
- * the read cannot predict. Unlock the mass and call again; never rebuild
468
- * it, the recipe is intact.
469
- * Also PRECONDITION_FAILED when an `operations` entry's edge/face selectors
470
- * no longer resolve on the rebuilt base (the message names the operation
471
- * and edge): re-select the edges on the new shape and re-apply that
472
- * operation.
473
- * @throws VALIDATION for a key the kind does not have (the message lists the
474
- * kind's keys), `kind` or `version` in a partial patch, or a value outside
475
- * the constructor's own rules (torus tube ≥ ring, revolution angle ∉
476
- * (0, 360], a profile crossing its axis, a spline with fewer than
477
- * degree + 1 poles).
478
- * @throws OPERATION_FAILED when the kernel cannot build the edited recipe;
479
- * the model is left unchanged.
480
- *
481
- * @examplePrompt Make the dome's radius 8 metres
482
- * @examplePrompt Raise the podium to 5 m
483
- * @examplePrompt Widen the vase — move its profile points 20 cm outward
484
- * @examplePrompt Change the fillet on the rounded column to 300 mm
485
- *
486
- * # Example
487
- * ```ts
488
- * // { kind: "sphere", values: { centre, radius: 19.685 }, … }
489
- * const before = await snaptrude.design.query.getParameters(dome)
490
- * const after = await snaptrude.design.update.parameters(dome, { radius: 31.496 }) // 8 m in internal units
491
- *
492
- * // Fillet radius on a recorded result: read → edit → send the array back
493
- * const rec = await snaptrude.design.query.getParameters(column)
494
- * const operations = rec?.operations ?? []
495
- * if (operations[0]?.op === "fillet") {
496
- * operations[0].radius = 1.181
497
- * await snaptrude.design.update.parameters(column, { operations })
498
- * }
499
- * ```
500
- */
501
- public abstract parameters(
502
- component: ComponentHandle,
503
- patch: MassParametersPatch,
504
- ): PluginApiReturn<MassParametersRecord>
505
-
506
412
  /**
507
413
  * Edit a **wall** — its thickness and/or height (the same command the
508
414
  * properties panel's Thickness/Height fields drive) and/or its **wall type**