@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
@@ -434,6 +434,7 @@ export type PluginSpaceUpdateArgs = z.infer<typeof PluginSpaceUpdateArgs>
434
434
  * | `massType` | `string?` | Updated mass type (if changed) |
435
435
  * | `spaceType` | `string?` | Updated space type (if changed) |
436
436
  * | `departmentId` | `string \| null?` | Updated department ID (if changed) |
437
+ * | `rebuilt` | `boolean?` | `true` when a geometry update rebuilt the space's derived BIM — hosted children were re-created and the previous derived handles are retired (re-query them) |
437
438
  */
438
439
  export const PluginSpaceUpdateResult = z.object({
439
440
  spaceId: z.string(),
@@ -442,6 +443,7 @@ export const PluginSpaceUpdateResult = z.object({
442
443
  spaceType: z.string().optional(),
443
444
  areaClass: PluginAreaClass.optional(),
444
445
  departmentId: z.string().nullable().optional(),
446
+ rebuilt: z.boolean().optional(),
445
447
  })
446
448
 
447
449
  export type PluginSpaceUpdateResult = z.infer<typeof PluginSpaceUpdateResult>
@@ -1,6 +1,6 @@
1
1
  import * as z from "zod"
2
2
  import { PluginApiReturn } from "../../types"
3
- import { PluginSheetPosition } from "./sheets"
3
+ import { PluginSheetPosition, PluginViewLod } from "./sheets"
4
4
 
5
5
  /**
6
6
  * Placed views — the view shapes already laid out on the Present canvas.
@@ -613,6 +613,23 @@ export abstract class PluginPresentationPlacedViewsApi {
613
613
  shapeId: string,
614
614
  enabled: boolean,
615
615
  ): PluginApiReturn<void>
616
+
617
+ /**
618
+ * Set the level of detail a placed view renders at — `"design"` (the
619
+ * Design-mode massing representation) or `"bim"` (the detailed BIM
620
+ * representation). Views only. Undoable. Requires Present mode to be open.
621
+ *
622
+ * @param shapeId - The placed view shape.
623
+ * @param lod - Target level of detail.
624
+ * @throws If Present mode is not open or `shapeId` is not a placed view.
625
+ *
626
+ * @examplePrompt Switch this placed view to the BIM level of detail
627
+ * @examplePrompt Show the massing version of the placed plan
628
+ */
629
+ public abstract setLod(
630
+ shapeId: string,
631
+ lod: PluginViewLod,
632
+ ): PluginApiReturn<void>
616
633
  }
617
634
 
618
635
  /** A point in crop space — fractions (0–1) of the uncropped view. */
@@ -657,6 +674,8 @@ export type PluginPlacedViewCrop = z.infer<typeof PluginPlacedViewCrop>
657
674
  * | `rotation` | `number` | Rotation in radians, `[0, 2π)` (nonzero only for 3D views — 2D views cannot rotate; set with `setRotation`) |
658
675
  * | `crop` | {@linkcode PluginPlacedViewCrop}` \| null` | Crop window (`null` when uncropped) |
659
676
  * | `isUnlinked` | `boolean` | Whether the source proposal was removed (an unlinked view no longer refreshes) |
677
+ * | `lod` | {@linkcode PluginViewLod}? | Level of detail the view renders at (`"design"` massing / `"bim"` detail); absent on views that predate LOD variants (set with `setLod`) |
678
+ * | `inactiveBuildingMask` | `boolean`? | Whether inactive proposal buildings are masked (the `setMask` toggle); absent when never set (masked by default) |
660
679
  */
661
680
  export const PluginPlacedView = z.object({
662
681
  shapeId: z.string(),
@@ -670,6 +689,8 @@ export const PluginPlacedView = z.object({
670
689
  rotation: z.number(),
671
690
  crop: PluginPlacedViewCrop.nullable(),
672
691
  isUnlinked: z.boolean(),
692
+ lod: PluginViewLod.optional(),
693
+ inactiveBuildingMask: z.boolean().optional(),
673
694
  })
674
695
  export type PluginPlacedView = z.infer<typeof PluginPlacedView>
675
696
 
@@ -1118,3 +1139,10 @@ export const PluginPlacedViewsSetMaskArgs = z.object({
1118
1139
  enabled: z.boolean(),
1119
1140
  })
1120
1141
  export type PluginPlacedViewsSetMaskArgs = z.infer<typeof PluginPlacedViewsSetMaskArgs>
1142
+
1143
+ /** Arguments for {@link PluginPresentationPlacedViewsApi.setLod}. */
1144
+ export const PluginPlacedViewsSetLodArgs = z.object({
1145
+ shapeId: z.string().min(1),
1146
+ lod: PluginViewLod,
1147
+ })
1148
+ export type PluginPlacedViewsSetLodArgs = z.infer<typeof PluginPlacedViewsSetLodArgs>
@@ -172,9 +172,10 @@ export abstract class PluginPresentationSheetsApi {
172
172
  * @param sheetId - The id of the sheet to place onto.
173
173
  * @param viewId - The id of the saved view to place.
174
174
  * @param options - Optional `position` ({@linkcode PluginSheetPosition}) —
175
- * where to place it (sheet centre when omitted) — and `scale` — a standard
175
+ * where to place it (sheet centre when omitted) — `scale` — a standard
176
176
  * scale value for the project's unit system (2D/site-plan views only;
177
- * auto-fit when omitted).
177
+ * auto-fit when omitted) — and `lod` ({@linkcode PluginViewLod}) — the LOD
178
+ * of the placed view (default: the product's Design default).
178
179
  * @returns A {@linkcode PluginPresentationSheetsPlaceResult} with the created
179
180
  * `shapeId`.
180
181
  * @throws If Present mode is not open, the sheet/view id is invalid, `scale`
@@ -197,7 +198,11 @@ export abstract class PluginPresentationSheetsApi {
197
198
  public abstract place(
198
199
  sheetId: string,
199
200
  viewId: string,
200
- options?: { position?: PluginSheetPosition; scale?: number },
201
+ options?: {
202
+ position?: PluginSheetPosition
203
+ scale?: number
204
+ lod?: PluginViewLod
205
+ },
201
206
  ): PluginApiReturn<PluginPresentationSheetsPlaceResult>
202
207
 
203
208
  /**
@@ -408,6 +413,15 @@ export const PluginSheetPosition = z.object({
408
413
  })
409
414
  export type PluginSheetPosition = z.infer<typeof PluginSheetPosition>
410
415
 
416
+ /**
417
+ * The level of detail a placed view renders at: `"design"` (the Design-mode
418
+ * massing representation) or `"bim"` (the detailed BIM representation).
419
+ * Shared by `sheets.place` and `placedViews.*` (defined here because
420
+ * `placedViews` already imports from this module).
421
+ */
422
+ export const PluginViewLod = z.enum(["design", "bim"])
423
+ export type PluginViewLod = z.infer<typeof PluginViewLod>
424
+
411
425
  /** Result of {@linkcode PluginPresentationSheetsApi.list}. */
412
426
  export const PluginPresentationSheetsListResult = z.object({
413
427
  sheets: z.array(PluginPresentationSheet),
@@ -469,12 +483,14 @@ export type PluginPresentationSheetsSetMarginArgs = z.infer<
469
483
  * | `viewId` | `string` | The saved view to place |
470
484
  * | `position` | {@linkcode PluginSheetPosition}` \| undefined` | Where to place it (sheet centre when omitted) |
471
485
  * | `scale` | `number \| undefined` | Standard scale value for the project's unit system (2D/site-plan views only; auto-fit to the closest standard scale when omitted) |
486
+ * | `lod` | {@linkcode PluginViewLod}` \| undefined` | LOD of the placed view (default: the product's Design default) |
472
487
  */
473
488
  export const PluginPresentationSheetsPlaceArgs = z.object({
474
489
  sheetId: z.string(),
475
490
  viewId: z.string(),
476
491
  position: PluginSheetPosition.optional(),
477
492
  scale: z.number().positive().optional(),
493
+ lod: PluginViewLod.optional(),
478
494
  })
479
495
  export type PluginPresentationSheetsPlaceArgs = z.infer<
480
496
  typeof PluginPresentationSheetsPlaceArgs
@@ -5,8 +5,13 @@
5
5
  * APPEND-ONLY: codes are a published contract; never rename or remove one.
6
6
  * Handle-resolution failures deliberately collapse to ONE code
7
7
  * (`HANDLE_INVALID`) so error responses cannot be used as an existence /
8
- * ownership oracle (PLUGIN_HANDLE_MIGRATION_HLD §6). `HANDLE_KIND_MISMATCH`
9
- * stays distinct because the kind is information the caller already holds.
8
+ * ownership oracle (PLUGIN_HANDLE_MIGRATION_HLD §6) — with one deliberate
9
+ * exception: `HANDLE_STALE` marks a handle the caller legitimately held that a
10
+ * parametric resolution (merge / split / rebuild) has since retired — a
11
+ * lifetime fact about the caller's own write-scoped handle, not an oracle
12
+ * (forged / never-issued ids still collapse to `HANDLE_INVALID`).
13
+ * `HANDLE_KIND_MISMATCH` stays distinct because the kind is information the
14
+ * caller already holds.
10
15
  */
11
16
  export const PLUGIN_ERROR_CODES = [
12
17
  "VALIDATION",
@@ -32,6 +37,10 @@ export const PLUGIN_ERROR_CODES = [
32
37
  "NO_ACTIVE_STRUCTURE",
33
38
  "NO_ELIGIBLE_ELEMENTS",
34
39
  "PROPOSAL_SWITCH_BLOCKED",
40
+ "HANDLE_STALE",
41
+ "KIND_HIDDEN_IN_MODE",
42
+ "MERGED_INTO_EXISTING",
43
+ "BLOCKED_IN_BIM",
35
44
  "INTERNAL",
36
45
  "UNKNOWN",
37
46
  ] as const
@@ -123,6 +132,25 @@ export const CODE_META: Record<PluginErrorCode, CodeMeta> = {
123
132
  category: "execution",
124
133
  hintTemplate: "Wait for the in-canvas agent run to finish, then retry.",
125
134
  },
135
+ HANDLE_STALE: {
136
+ category: "handle",
137
+ hintTemplate:
138
+ "The entity was retired by a parametric resolution (merge/split/rebuild); re-query for its successor.",
139
+ },
140
+ KIND_HIDDEN_IN_MODE: {
141
+ category: "execution",
142
+ hintTemplate:
143
+ "This entity kind has no representation in the current mode/LOD; switch mode or target a visible kind.",
144
+ },
145
+ MERGED_INTO_EXISTING: {
146
+ category: "execution",
147
+ hintTemplate:
148
+ "The created geometry merged into an existing entity; use the surviving handles from details.",
149
+ },
150
+ BLOCKED_IN_BIM: {
151
+ category: "execution",
152
+ hintTemplate: "This operation is unavailable in BIM mode; switch to Design and retry.",
153
+ },
126
154
  INTERNAL: {
127
155
  category: "internal",
128
156
  hintTemplate: "Host-side fault. Report with errorId.",
package/src/handles.ts CHANGED
@@ -132,16 +132,8 @@ export type Vec3Handle = Handle<"vec3">
132
132
  export type QuatHandle = Handle<"quat">
133
133
  export type LineHandle = Handle<"line">
134
134
  export type ArcHandle = Handle<"arc">
135
- /**
136
- * A NURBS curve value handle (open B-spline curve). Minted by
137
- * `core.geom.create.splineFromPoints` / `splineFromControlPoints`, accepted everywhere a
138
- * {@linkcode CurveHandle} is (profileFromCurves, query.curve.*).
139
- * Closed spline loops never exist as a single handle — a closed run is built
140
- * directly as a profile via `core.geom.create.profileFromSplinePoints`.
141
- */
142
- export type SplineHandle = Handle<"spline">
143
- /** A curve is a line, an arc, or a spline — its handle is one of those kinds. */
144
- export type CurveHandle = LineHandle | ArcHandle | SplineHandle
135
+ /** A curve is a line or an arc — its handle is one of those kinds. */
136
+ export type CurveHandle = LineHandle | ArcHandle
145
137
  /**
146
138
  * A circle value handle. A circle is a CLOSED curve — it deliberately does NOT
147
139
  * join {@linkcode CurveHandle} (it has no stable start/end and would break the
@@ -246,11 +238,7 @@ export const Vec3Handle = handleSchema("vec3")
246
238
  export const QuatHandle = handleSchema("quat")
247
239
  export const LineHandle = handleSchema("line")
248
240
  export const ArcHandle = handleSchema("arc")
249
- export const SplineHandle = handleSchema("spline")
250
- // Explicitly typed (rather than inferred): the inferred union type prints its
251
- // three fully-expanded member schemas into handles.d.ts, which is served to
252
- // agents whole and has a size budget.
253
- export const CurveHandle: z.ZodType<CurveHandle> = z.union([LineHandle, ArcHandle, SplineHandle])
241
+ export const CurveHandle = z.union([LineHandle, ArcHandle])
254
242
  export const CircleHandle = handleSchema("circle")
255
243
 
256
244
  // BREP topology handle schemas (§2A.2.1). Prefix-shape validation only; existence,
package/src/index.ts CHANGED
@@ -2,5 +2,4 @@ export * from "./api"
2
2
  export * from "./types"
3
3
  export * from "./host-utils"
4
4
  export * from "./handles"
5
- export * from "./massParameters"
6
5
  export * from "./errors"
@@ -178,6 +178,10 @@ test("PLUGIN_ERROR_CODES matches the reviewed snapshot (append-only contract)",
178
178
  "NO_ACTIVE_STRUCTURE",
179
179
  "NO_ELIGIBLE_ELEMENTS",
180
180
  "PROPOSAL_SWITCH_BLOCKED",
181
+ "HANDLE_STALE",
182
+ "KIND_HIDDEN_IN_MODE",
183
+ "MERGED_INTO_EXISTING",
184
+ "BLOCKED_IN_BIM",
181
185
  "INTERNAL",
182
186
  "UNKNOWN",
183
187
  ])
@@ -1,319 +0,0 @@
1
- import * as z from "zod";
2
- /**
3
- * Mass **creation-parameter records** — the recipe a parametric mass was built
4
- * from, shared verbatim by plugin-core, the Snaptrude host, and the agent
5
- * runtime (one schema, three repos — no hand-mirrored DTOs).
6
- *
7
- * A record is present on a mass committed from a `core.geom.create` brep
8
- * constructor that carries a recipe (the four primitives, extrusion,
9
- * revolution, loft, sweep). A fillet, chamfer, shell or offset of a **recorded**
10
- * solid keeps the record: `kind` stays the base constructor and the step is
11
- * appended to the record's `operations` list (see {@linkcode OperationRecord}).
12
- * The record is absent — `null` — for everything
13
- * else: drawn masses, imported geometry, booleans, split parts,
14
- * `brepFromFaces`/`brepFromMesh`, and any operation on a solid that carried no
15
- * record. Geometry there is not a pure function of a legible parameter set, and
16
- * a record must never be a lie.
17
- *
18
- * Read one with `design.query.getParameters`.
19
- *
20
- * Everything here is **pure JSON** by construction — plain objects, numbers and
21
- * arrays only, one `{x, y, z}` point shape everywhere (no tuples, no class
22
- * instances): records are persisted by enumerable-field reflection, cloned with
23
- * `structuredClone`, and round-tripped through the collaboration wire.
24
- */
25
- /** A point in space. The single point shape used across every record. */
26
- export type XYZ = {
27
- x: number;
28
- y: number;
29
- z: number;
30
- };
31
- /**
32
- * One boundary curve of a profile record.
33
- *
34
- * The two spline forms are either/or, never both: a curve authored through
35
- * points carries `splineThrough` (patch the points and the fit re-runs), and a
36
- * curve with no through-point provenance — read back off an edge, or authored
37
- * from control vertices — carries `splinePoles` and is re-minted verbatim.
38
- * There is no variant holding both, so a `throughPoints` edit can never leave
39
- * stale poles behind.
40
- */
41
- export type CurveRecord = {
42
- type: "line";
43
- start: XYZ;
44
- end: XYZ;
45
- } | {
46
- type: "arc";
47
- start: XYZ;
48
- end: XYZ;
49
- centre: XYZ;
50
- axis: XYZ;
51
- } | {
52
- type: "circle";
53
- centre: XYZ;
54
- axis: XYZ;
55
- radius: number;
56
- }
57
- /** Authored via splineFromPoints / profileFromSplinePoints. The through-points
58
- * ARE the recipe; regeneration re-runs the versioned fit (fitVersion).
59
- * Chained runs in one contour re-fit as ONE loop; use splinePoles to keep tangents. */
60
- | {
61
- type: "splineThrough";
62
- fitVersion: 1;
63
- throughPoints: XYZ[];
64
- }
65
- /** No through-point provenance (authored from CVs, or read back off an edge).
66
- * Regenerable verbatim — re-mint the curve from these exact data. */
67
- | {
68
- type: "splinePoles";
69
- degree: number;
70
- knots: number[];
71
- mults: number[];
72
- poles: XYZ[];
73
- };
74
- /** A closed boundary loop, as an ordered list of curves. */
75
- export type ProfileRecord = {
76
- curves: CurveRecord[];
77
- };
78
- /** An outer loop plus its holes — the cross-section shape of a recipe. */
79
- export type ContourRecord = {
80
- outer: ProfileRecord;
81
- holes: ProfileRecord[];
82
- };
83
- /** Optional loft behaviour switches, mirroring `core.geom.create.brepFromLoft`. */
84
- export type LoftOptions = {
85
- compatibility?: "strict" | "auto";
86
- seamAlignment?: "authored" | "auto";
87
- };
88
- /** Optional sweep scale law and corner transition, mirroring `core.geom.create.brepFromSweep`. */
89
- export type SweepOptions = {
90
- startScale?: number;
91
- endScale?: number;
92
- scales?: number[];
93
- transition?: "miter" | "round" | {
94
- bevel: number;
95
- };
96
- };
97
- /** A face's surface kind — the vocabulary of `core.geom.query.face.getSurfaceKind`. */
98
- export type SurfaceKind = "plane" | "cylinder" | "cone" | "sphere" | "torus" | "spline";
99
- /** An edge's curve kind. Both spline forms of {@linkcode CurveRecord} report `"spline"`. */
100
- export type CurveKind = "line" | "arc" | "circle" | "spline";
101
- /**
102
- * Which EDGE of the input solid an operation used: its index in
103
- * `core.geom.query.brep.listEdges` order at authoring time, the indices of the
104
- * two faces it lies between, and its curve kind. This is topology, not
105
- * coordinates — it survives a scalar edit of the base recipe (which moves every
106
- * edge) and trips on a reorder or a topology change. Read-only: to blend a
107
- * different edge, re-select it on the new shape and re-apply the operation.
108
- */
109
- export type EdgeSelector = {
110
- index: number;
111
- faces: [number, number];
112
- curve: CurveKind;
113
- };
114
- /**
115
- * Which FACE of the input solid an operation used: its index in
116
- * `core.geom.query.brep.listFaces` order, its surface kind, and the number of
117
- * edges in its outer loop. Read-only, like {@linkcode EdgeSelector}.
118
- */
119
- export type FaceSelector = {
120
- index: number;
121
- kind: SurfaceKind;
122
- edgeCount: number;
123
- };
124
- /** The input solid's topology at authoring time — the counts a replay checks first. */
125
- export type TopologyCounts = {
126
- faceCount: number;
127
- edgeCount: number;
128
- };
129
- /**
130
- * One kernel operation applied to the base recipe's solid, in order. `input`
131
- * pins the topology the operation was authored against, so a base edit that
132
- * changes the topology is refused rather than mis-applied.
133
- *
134
- * Edit one by patching the whole list back:
135
- * `design.update.parameters(mass, { operations })`.
136
- */
137
- export type OperationRecord = {
138
- op: "fillet";
139
- edges: EdgeSelector[];
140
- radius: number;
141
- input: TopologyCounts;
142
- } | {
143
- op: "chamfer";
144
- edges: EdgeSelector[];
145
- distance: number;
146
- input: TopologyCounts;
147
- } | {
148
- op: "shell";
149
- openFaces: FaceSelector[];
150
- thickness: number;
151
- input: TopologyCounts;
152
- } | {
153
- op: "offset";
154
- distance: number;
155
- input: TopologyCounts;
156
- };
157
- /**
158
- * A mass's creation recipe: the constructor `kind`, a schema `version`, the
159
- * `values` that constructor was called with, and the kernel `operations`
160
- * (fillet / chamfer / shell / offset) applied on top, in order. Points and axes
161
- * are in the mass's own local frame when stored; `design.query.getParameters`
162
- * returns them in world coordinates. `operations` is frame-free. One variant
163
- * per constructor `kind`; its `values` are that constructor's own arguments.
164
- *
165
- * `kind` stays the base constructor even after operations: a shelled, filleted
166
- * sphere is still `{ kind: "sphere", operations: [shell, fillet] }`.
167
- */
168
- export type MassParametersRecord = {
169
- kind: "sphere";
170
- version: 1;
171
- values: {
172
- centre: XYZ;
173
- radius: number;
174
- };
175
- operations?: OperationRecord[];
176
- } | {
177
- kind: "cylinder";
178
- version: 1;
179
- values: {
180
- base: XYZ;
181
- axis: XYZ;
182
- radius: number;
183
- height: number;
184
- };
185
- operations?: OperationRecord[];
186
- } | {
187
- kind: "cone";
188
- version: 1;
189
- values: {
190
- base: XYZ;
191
- axis: XYZ;
192
- baseRadius: number;
193
- topRadius: number;
194
- height: number;
195
- };
196
- operations?: OperationRecord[];
197
- } | {
198
- kind: "torus";
199
- version: 1;
200
- values: {
201
- centre: XYZ;
202
- axis: XYZ;
203
- majorRadius: number;
204
- minorRadius: number;
205
- };
206
- operations?: OperationRecord[];
207
- } | {
208
- kind: "extrusion";
209
- version: 1;
210
- values: {
211
- contour: ContourRecord;
212
- direction: XYZ;
213
- amount: number;
214
- };
215
- operations?: OperationRecord[];
216
- } | {
217
- kind: "revolution";
218
- version: 1;
219
- values: {
220
- contour: ContourRecord;
221
- axisOrigin: XYZ;
222
- axisDirection: XYZ;
223
- angleInDegrees: number;
224
- };
225
- operations?: OperationRecord[];
226
- } | {
227
- kind: "loft";
228
- version: 1;
229
- values: {
230
- sections: ContourRecord[];
231
- options?: LoftOptions;
232
- };
233
- operations?: OperationRecord[];
234
- } | {
235
- kind: "sweep";
236
- version: 1;
237
- values: {
238
- profile: ContourRecord;
239
- path: XYZ[];
240
- options?: SweepOptions;
241
- };
242
- operations?: OperationRecord[];
243
- };
244
- /**
245
- * One value of a {@linkcode MassParametersPatch} — whatever a record's `values`
246
- * key (or `operations`) may hold. Scalars and points merge by key; every array
247
- * form replaces the list whole.
248
- */
249
- export type ParameterPatchValue = number | XYZ | XYZ[] | ContourRecord | ContourRecord[] | LoftOptions | SweepOptions | OperationRecord[];
250
- /**
251
- * The argument of `design.update.parameters`: either a **partial** of a
252
- * record's `values` (plus an optional `operations` list) — keys you leave out
253
- * stay as they are — or the **whole record** you read from
254
- * `design.query.getParameters`, edited. `kind` and `version` are immutable.
255
- */
256
- export type MassParametersPatch = MassParametersRecord | Record<string, ParameterPatchValue>;
257
- /** Maximum through-points in one authored spline curve record. */
258
- export declare const MAX_SPLINE_THROUGH_POINTS = 256;
259
- /** Maximum control points in one exact-NURBS spline curve record. */
260
- export declare const MAX_SPLINE_POLES = 512;
261
- /** Maximum path points in a sweep record. */
262
- export declare const MAX_SWEEP_PATH_POINTS = 512;
263
- /** Maximum cross-sections in a loft record. */
264
- export declare const MAX_LOFT_SECTIONS = 32;
265
- /** Maximum kernel operations chained onto one recipe. */
266
- export declare const MAX_OPERATIONS = 8;
267
- /** Maximum boundary curves in one profile loop record. */
268
- export declare const MAX_PROFILE_CURVES = 256;
269
- /** Maximum hole loops in one contour record. */
270
- export declare const MAX_CONTOUR_HOLES = 64;
271
- /** Maximum edges one fillet/chamfer operation may select. */
272
- export declare const MAX_OPERATION_EDGES = 64;
273
- /** Maximum faces one shell operation may open. */
274
- export declare const MAX_OPERATION_FACES = 32;
275
- /** A point in space — `{ x, y, z }`, all finite. */
276
- export declare const XYZ: z.ZodType<XYZ, XYZ>;
277
- /** One boundary curve of a profile record. See {@linkcode CurveRecord}. */
278
- export declare const CurveRecord: z.ZodType<CurveRecord, CurveRecord>;
279
- /** A closed boundary loop. See {@linkcode ProfileRecord}. */
280
- export declare const ProfileRecord: z.ZodType<ProfileRecord, ProfileRecord>;
281
- /** An outer loop plus its holes. See {@linkcode ContourRecord}. */
282
- export declare const ContourRecord: z.ZodType<ContourRecord, ContourRecord>;
283
- /** Optional loft behaviour switches. See {@linkcode LoftOptions}. */
284
- export declare const LoftOptions: z.ZodType<LoftOptions, LoftOptions>;
285
- /** Optional sweep scale law and corner transition. See {@linkcode SweepOptions}. */
286
- export declare const SweepOptions: z.ZodType<SweepOptions, SweepOptions>;
287
- /** See {@linkcode EdgeSelector}. */
288
- export declare const EdgeSelector: z.ZodType<EdgeSelector, EdgeSelector>;
289
- /** See {@linkcode FaceSelector}. */
290
- export declare const FaceSelector: z.ZodType<FaceSelector, FaceSelector>;
291
- /** See {@linkcode TopologyCounts}. */
292
- export declare const TopologyCounts: z.ZodType<TopologyCounts, TopologyCounts>;
293
- /** See {@linkcode OperationRecord}. */
294
- export declare const OperationRecord: z.ZodType<OperationRecord, OperationRecord>;
295
- /**
296
- * A mass's creation recipe. See {@linkcode MassParametersRecord}.
297
- *
298
- * `version` is a literal `1`: a restore that reads an unknown version fails
299
- * `safeParse` and the mass degrades to non-parametric — editability is lost,
300
- * geometry never is, and load is never blocked. Future versions add a migration
301
- * at the restore site.
302
- */
303
- export declare const MassParametersRecord: z.ZodType<MassParametersRecord, MassParametersRecord>;
304
- /**
305
- * One value of a parameter patch. See {@linkcode ParameterPatchValue}.
306
- *
307
- * Deliberately a CLOSED union of the shapes a record's `values` actually hold —
308
- * no `z.unknown()`, nothing recursive: an unrecognised value is a VALIDATION at
309
- * the wire, not a silent write of nonsense onto a mass.
310
- */
311
- export declare const ParameterPatchValue: z.ZodType<ParameterPatchValue, ParameterPatchValue>;
312
- /**
313
- * The argument of `design.update.parameters`. See {@linkcode MassParametersPatch}.
314
- * The full-record form is recognised by carrying both `kind` and `values`;
315
- * which keys a kind actually has is checked host-side, where the error can name
316
- * them.
317
- */
318
- export declare const MassParametersPatch: z.ZodType<MassParametersPatch, MassParametersPatch>;
319
- //# sourceMappingURL=massParameters.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"massParameters.d.ts","sourceRoot":"","sources":["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