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

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 (75) hide show
  1. package/CHANGELOG.md +25 -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/core/io/import/index.d.ts +3 -1
  15. package/dist/api/core/io/import/index.d.ts.map +1 -1
  16. package/dist/api/design/create/bulk-items.d.ts +185 -0
  17. package/dist/api/design/create/bulk-items.d.ts.map +1 -0
  18. package/dist/api/design/create/index.d.ts +310 -22
  19. package/dist/api/design/create/index.d.ts.map +1 -1
  20. package/dist/api/design/create/opening-fields.d.ts +37 -0
  21. package/dist/api/design/create/opening-fields.d.ts.map +1 -0
  22. package/dist/api/design/delete/index.d.ts +4 -0
  23. package/dist/api/design/delete/index.d.ts.map +1 -1
  24. package/dist/api/design/dimensions.d.ts +427 -0
  25. package/dist/api/design/dimensions.d.ts.map +1 -0
  26. package/dist/api/design/doors/index.d.ts +20 -13
  27. package/dist/api/design/doors/index.d.ts.map +1 -1
  28. package/dist/api/design/index.d.ts +5 -0
  29. package/dist/api/design/index.d.ts.map +1 -1
  30. package/dist/api/design/query/geometry/index.d.ts +1 -27
  31. package/dist/api/design/query/geometry/index.d.ts.map +1 -1
  32. package/dist/api/design/query/index.d.ts +0 -47
  33. package/dist/api/design/query/index.d.ts.map +1 -1
  34. package/dist/api/design/query/spaces.d.ts +5 -5
  35. package/dist/api/design/update/index.d.ts +0 -87
  36. package/dist/api/design/update/index.d.ts.map +1 -1
  37. package/dist/api/entity/referenceLine.d.ts +2 -2
  38. package/dist/api/entity/referenceLine.d.ts.map +1 -1
  39. package/dist/api/entity/space.d.ts +4 -5
  40. package/dist/api/entity/space.d.ts.map +1 -1
  41. package/dist/api/entity/story.d.ts +4 -4
  42. package/dist/api/presentation/annotate.d.ts +2 -2
  43. package/dist/api/presentation/shapes.d.ts +2 -2
  44. package/dist/api/program/spreadsheet.d.ts +4 -4
  45. package/dist/handles.d.ts +22 -12
  46. package/dist/handles.d.ts.map +1 -1
  47. package/dist/index.cjs +2867 -3040
  48. package/dist/index.cjs.map +1 -1
  49. package/dist/index.d.ts +0 -1
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +2844 -3006
  52. package/dist/index.js.map +1 -1
  53. package/package.json +1 -1
  54. package/src/api/core/geom/create/index.ts +84 -588
  55. package/src/api/core/geom/query/brep.ts +0 -51
  56. package/src/api/core/geom/query/curve.ts +2 -25
  57. package/src/api/core/geom/query/edge.ts +2 -2
  58. package/src/api/core/geom/query/face.ts +0 -49
  59. package/src/api/core/io/import/index.ts +11 -3
  60. package/src/api/design/create/bulk-items.ts +186 -0
  61. package/src/api/design/create/index.ts +335 -38
  62. package/src/api/design/create/opening-fields.ts +37 -0
  63. package/src/api/design/delete/index.ts +4 -0
  64. package/src/api/design/dimensions.ts +453 -0
  65. package/src/api/design/doors/index.ts +20 -13
  66. package/src/api/design/index.ts +5 -0
  67. package/src/api/design/query/geometry/index.ts +0 -29
  68. package/src/api/design/query/index.ts +0 -50
  69. package/src/api/design/update/index.ts +0 -94
  70. package/src/handles.ts +27 -15
  71. package/src/index.ts +0 -1
  72. package/dist/massParameters.d.ts +0 -319
  73. package/dist/massParameters.d.ts.map +0 -1
  74. package/src/massParameters.ts +0 -472
  75. package/test/massParameters.test.mjs +0 -500
@@ -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,
@@ -1015,55 +1014,6 @@ export abstract class PluginDesignQueryApi {
1015
1014
  staircase: ComponentHandle,
1016
1015
  ): PluginApiReturn<PluginStaircaseParams | null>
1017
1016
 
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
1017
  /**
1068
1018
  * Get the **union** axis-aligned bounding box enclosing a set of entities.
1069
1019
  *
@@ -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**
package/src/handles.ts CHANGED
@@ -115,6 +115,19 @@ export type UnderlayHandle = EntityId<"underlay">
115
115
  */
116
116
  export type TerrainHandle = EntityId<"terrain">
117
117
 
118
+ /**
119
+ * A **dimension line** — one measurement annotation left behind by the Measuring
120
+ * Tape tool (NOT a width/height/depth property; see `design.dimensions`).
121
+ * Entity-style: the token IS the raw engine dimension id (`dim_…`), resolved live
122
+ * host-side from the dimension-line registry (`getDimensionLineMap()`) — not via
123
+ * `ComponentUtility.FindComponentById`, which does not index dimension lines (a
124
+ * dimension line is not a Component). No arena, no quota, stable across
125
+ * undo/redo and across reloads (the record persists with the project). Returned
126
+ * by `design.dimensions.create` and consumed by every other
127
+ * `design.dimensions.*` method.
128
+ */
129
+ export type DimensionHandle = EntityId<"dimension">
130
+
118
131
  /**
119
132
  * A handle to an **asynchronous import job** (today: a DWG → Forge conversion, which
120
133
  * can take minutes). Returned immediately by `core.io.import.dwg`; poll it via
@@ -132,16 +145,8 @@ export type Vec3Handle = Handle<"vec3">
132
145
  export type QuatHandle = Handle<"quat">
133
146
  export type LineHandle = Handle<"line">
134
147
  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
148
+ /** A curve is a line or an arc — its handle is one of those kinds. */
149
+ export type CurveHandle = LineHandle | ArcHandle
145
150
  /**
146
151
  * A circle value handle. A circle is a CLOSED curve — it deliberately does NOT
147
152
  * join {@linkcode CurveHandle} (it has no stable start/end and would break the
@@ -241,16 +246,23 @@ export const ImportJobHandle = z
241
246
  .min(1)
242
247
  .transform((s) => s as ImportJobHandle)
243
248
 
249
+ /**
250
+ * {@linkcode DimensionHandle} is an entity-style handle — the raw `dim_…` engine
251
+ * id, validated only as a non-empty string (no `"<kind>_"` prefix enforcement),
252
+ * resolved live host-side against the dimension-line registry (existence
253
+ * enforced there, as `HANDLE_INVALID`).
254
+ */
255
+ export const DimensionHandle = z
256
+ .string()
257
+ .min(1)
258
+ .transform((s) => s as DimensionHandle)
259
+
244
260
  // Value-kind handle schemas (all-handle model, §11).
245
261
  export const Vec3Handle = handleSchema("vec3")
246
262
  export const QuatHandle = handleSchema("quat")
247
263
  export const LineHandle = handleSchema("line")
248
264
  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])
265
+ export const CurveHandle = z.union([LineHandle, ArcHandle])
254
266
  export const CircleHandle = handleSchema("circle")
255
267
 
256
268
  // 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"
@@ -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":["../src/massParameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,yEAAyE;AACzE,MAAM,MAAM,GAAG,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC;IAAC,GAAG,EAAE,GAAG,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC;IAAC,GAAG,EAAE,GAAG,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,GAAG,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,GAAG,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AAC5D;;wFAEwF;GACtF;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,UAAU,EAAE,CAAC,CAAC;IAAC,aAAa,EAAE,GAAG,EAAE,CAAA;CAAE;AAChE;sEACsE;GACpE;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,GAAG,EAAE,CAAA;CAAE,CAAA;AAE3F,4DAA4D;AAC5D,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