@code3d/core 0.0.1-alpha.0 → 0.0.1-alpha.11

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 (154) hide show
  1. package/README.md +43 -807
  2. package/THIRD_PARTY.md +40 -0
  3. package/bld/THIRD_PARTY_NOTICES.txt +182 -0
  4. package/bld/chunks/chunk-7FIFPADJ.js +1 -0
  5. package/bld/chunks/chunk-7FIFPADJ.js.map +7 -0
  6. package/bld/chunks/chunk-CL3E2DE4.js +19 -0
  7. package/bld/chunks/chunk-CL3E2DE4.js.map +7 -0
  8. package/bld/chunks/chunk-HZRQUHM2.js +30 -0
  9. package/bld/chunks/chunk-HZRQUHM2.js.map +7 -0
  10. package/bld/chunks/chunk-JBVIAMJ6.js +26474 -0
  11. package/bld/chunks/chunk-JBVIAMJ6.js.map +7 -0
  12. package/bld/chunks/chunk-QK6ZET47.js +31 -0
  13. package/bld/chunks/chunk-QK6ZET47.js.map +7 -0
  14. package/bld/library/bound-solver.d.ts +29 -5
  15. package/bld/library/bound-solver.d.ts.map +1 -1
  16. package/bld/library/cached.d.ts +35 -0
  17. package/bld/library/cached.d.ts.map +1 -0
  18. package/bld/library/font.d.ts +39 -0
  19. package/bld/library/font.d.ts.map +1 -0
  20. package/bld/library/google-font.d.ts +14 -0
  21. package/bld/library/google-font.d.ts.map +1 -0
  22. package/bld/library/index.d.ts +10 -2
  23. package/bld/library/index.d.ts.map +1 -1
  24. package/bld/library/index.js +94 -3
  25. package/bld/library/index.js.map +7 -1
  26. package/bld/library/inspect.d.ts +100 -0
  27. package/bld/library/inspect.d.ts.map +1 -0
  28. package/bld/library/kernel-artifact-codec.d.ts.map +1 -1
  29. package/bld/library/kernel-cache.d.ts +28 -7
  30. package/bld/library/kernel-cache.d.ts.map +1 -1
  31. package/bld/library/loft.d.ts.map +1 -1
  32. package/bld/library/material.d.ts +1 -1
  33. package/bld/library/material.d.ts.map +1 -1
  34. package/bld/library/open-cascade.d.ts +4 -0
  35. package/bld/library/open-cascade.d.ts.map +1 -0
  36. package/bld/library/relation-solver.d.ts +19 -8
  37. package/bld/library/relation-solver.d.ts.map +1 -1
  38. package/bld/library/replicad.d.ts +3 -2
  39. package/bld/library/replicad.d.ts.map +1 -1
  40. package/bld/library/replicad.js +10 -24
  41. package/bld/library/replicad.js.map +7 -1
  42. package/bld/library/retained-memory.d.ts.map +1 -1
  43. package/bld/library/runtime.d.ts +518 -155
  44. package/bld/library/runtime.d.ts.map +1 -1
  45. package/bld/library/sketch-solver.d.ts +1 -1
  46. package/bld/library/sketch-solver.d.ts.map +1 -1
  47. package/bld/library/sketch.d.ts +21 -1
  48. package/bld/library/sketch.d.ts.map +1 -1
  49. package/bld/library/text.d.ts +53 -0
  50. package/bld/library/text.d.ts.map +1 -0
  51. package/bld/library/three.js +3 -3
  52. package/bld/library/three.js.map +7 -1
  53. package/bld/library/topology.d.ts +6 -2
  54. package/bld/library/topology.d.ts.map +1 -1
  55. package/bld/node/index.d.ts.map +1 -1
  56. package/bld/node/index.js +96 -14
  57. package/bld/node/index.js.map +7 -1
  58. package/bld/node/replicad.js +13 -3
  59. package/bld/node/replicad.js.map +7 -1
  60. package/bld/tooling/index.d.ts +18 -15
  61. package/bld/tooling/index.d.ts.map +1 -1
  62. package/bld/tooling/index.js +165 -19
  63. package/bld/tooling/index.js.map +7 -1
  64. package/docs/api.md +764 -0
  65. package/docs/custom-primitives.mdx +58 -0
  66. package/docs/local-coordinates.md +187 -0
  67. package/docs/origins-and-rotation.mdx +105 -0
  68. package/docs/relations.mdx +450 -0
  69. package/docs/runtime.md +297 -0
  70. package/docs/shells.mdx +70 -0
  71. package/docs/sketches.md +83 -0
  72. package/docs/text.md +23 -0
  73. package/docs/topology.md +152 -0
  74. package/docs/values.md +119 -0
  75. package/package.json +20 -7
  76. package/src/library/bound-solver.ts +103 -73
  77. package/src/library/cached.ts +153 -0
  78. package/src/library/font.ts +186 -0
  79. package/src/library/google-font.ts +97 -0
  80. package/src/library/index.ts +53 -5
  81. package/src/library/inspect.ts +178 -0
  82. package/src/library/kernel-artifact-codec.ts +129 -20
  83. package/src/library/kernel-cache.ts +175 -39
  84. package/src/library/loft.ts +9 -1
  85. package/src/library/material.ts +3 -4
  86. package/src/library/open-cascade.ts +13 -0
  87. package/src/library/relation-solver.ts +230 -113
  88. package/src/library/replicad.ts +5 -5
  89. package/src/library/retained-memory.ts +6 -1
  90. package/src/library/runtime.ts +3769 -1178
  91. package/src/library/shell.ts +3 -3
  92. package/src/library/sketch-solver.ts +3 -1
  93. package/src/library/sketch.ts +112 -13
  94. package/src/library/text.ts +477 -0
  95. package/src/library/topology.ts +61 -17
  96. package/src/library/tsconfig.json +2 -1
  97. package/src/node/index.ts +14 -3
  98. package/src/node/tsconfig.json +2 -1
  99. package/src/tooling/index.ts +64 -51
  100. package/src/tooling/tsconfig.json +2 -1
  101. package/bld/library/alignment-geometry.js +0 -322
  102. package/bld/library/alignment-geometry.js.map +0 -1
  103. package/bld/library/bound-solver.js +0 -252
  104. package/bld/library/bound-solver.js.map +0 -1
  105. package/bld/library/extrude.js +0 -28
  106. package/bld/library/extrude.js.map +0 -1
  107. package/bld/library/kernel-artifact-codec.js +0 -148
  108. package/bld/library/kernel-artifact-codec.js.map +0 -1
  109. package/bld/library/kernel-cache.js +0 -245
  110. package/bld/library/kernel-cache.js.map +0 -1
  111. package/bld/library/kernel-shapes.js +0 -108
  112. package/bld/library/kernel-shapes.js.map +0 -1
  113. package/bld/library/loft.js +0 -161
  114. package/bld/library/loft.js.map +0 -1
  115. package/bld/library/material.js +0 -176
  116. package/bld/library/material.js.map +0 -1
  117. package/bld/library/model-color.js +0 -36
  118. package/bld/library/model-color.js.map +0 -1
  119. package/bld/library/open-cascade-error.js +0 -22
  120. package/bld/library/open-cascade-error.js.map +0 -1
  121. package/bld/library/relation-solver.js +0 -258
  122. package/bld/library/relation-solver.js.map +0 -1
  123. package/bld/library/retained-memory.js +0 -27
  124. package/bld/library/retained-memory.js.map +0 -1
  125. package/bld/library/runtime.js +0 -2954
  126. package/bld/library/runtime.js.map +0 -1
  127. package/bld/library/shell.js +0 -221
  128. package/bld/library/shell.js.map +0 -1
  129. package/bld/library/sketch-curve-intersections.js +0 -117
  130. package/bld/library/sketch-curve-intersections.js.map +0 -1
  131. package/bld/library/sketch-curves.js +0 -89
  132. package/bld/library/sketch-curves.js.map +0 -1
  133. package/bld/library/sketch-drag-rules.js +0 -522
  134. package/bld/library/sketch-drag-rules.js.map +0 -1
  135. package/bld/library/sketch-face.js +0 -72
  136. package/bld/library/sketch-face.js.map +0 -1
  137. package/bld/library/sketch-incidence.js +0 -114
  138. package/bld/library/sketch-incidence.js.map +0 -1
  139. package/bld/library/sketch-precision.js +0 -55
  140. package/bld/library/sketch-precision.js.map +0 -1
  141. package/bld/library/sketch-regions.js +0 -193
  142. package/bld/library/sketch-regions.js.map +0 -1
  143. package/bld/library/sketch-solver.js +0 -578
  144. package/bld/library/sketch-solver.js.map +0 -1
  145. package/bld/library/sketch.js +0 -650
  146. package/bld/library/sketch.js.map +0 -1
  147. package/bld/library/spatial.js +0 -195
  148. package/bld/library/spatial.js.map +0 -1
  149. package/bld/library/topology-id.js +0 -67
  150. package/bld/library/topology-id.js.map +0 -1
  151. package/bld/library/topology-inspection.js +0 -267
  152. package/bld/library/topology-inspection.js.map +0 -1
  153. package/bld/library/topology.js +0 -455
  154. package/bld/library/topology.js.map +0 -1
@@ -1,11 +1,16 @@
1
- import type { Material } from './three.js';
2
- import { type ModelMaterialSnapshot } from './material.js';
3
- import { type TopologyInspection, type TopologyInspectionOptions } from './topology-inspection.js';
4
1
  import { type AnyShape } from 'replicad';
5
- import { type Quaternion, type RigidTransform, type Vec3 } from './spatial.js';
2
+ import { type AlignmentGeometry } from './alignment-geometry.js';
3
+ import { cache } from './cached.js';
4
+ import { font, googleFont, type Font } from './font.js';
5
+ import { anchorAnnotation, boundsAnnotation, captureInspectData, dimension } from './inspect.js';
6
6
  import { type KernelOperationKey } from './kernel-cache.js';
7
+ import { type ModelMaterialSnapshot } from './material.js';
7
8
  import type { SketchRegion } from './sketch-regions.js';
9
+ import { type Quaternion, type RigidTransform, type Vec3 } from './spatial.js';
10
+ import { type TextOptions } from './text.js';
11
+ import { type Material } from 'three';
8
12
  import { type TopologyId } from './topology-id.js';
13
+ import { type TopologyInspection, type TopologyInspectionOptions } from './topology-inspection.js';
9
14
  import { type EdgeId, type ShapeTopology, type SurfaceId, type TopologyKind, type TopologySelection, type VertexId } from './topology.js';
10
15
  import { sketch } from './sketch.js';
11
16
  export type { Quaternion, Vec3 } from './spatial.js';
@@ -48,7 +53,7 @@ export type ElementSnapshot = Readonly<{
48
53
  }>;
49
54
  facing?: 1 | -1;
50
55
  direction?: 1 | -1;
51
- arrow?: RigidTransform;
56
+ arrows?: readonly RigidTransform[];
52
57
  topology?: Readonly<{
53
58
  geometryNodeId: string;
54
59
  transform: Transform;
@@ -65,9 +70,6 @@ export type ConstraintSnapshot = Readonly<{
65
70
  target: ConstraintAnchorSnapshot;
66
71
  sourceElement: ElementSnapshot;
67
72
  targetElement: ElementSnapshot;
68
- offsetDirection: 1 | -1;
69
- offset: Vec3;
70
- offsetFrame: Transform;
71
73
  sourceRefs: readonly SourceRef[];
72
74
  parameters: readonly ParameterUsage[];
73
75
  }> & (Readonly<{
@@ -80,17 +82,10 @@ export type ConstraintSnapshot = Readonly<{
80
82
  }> | Readonly<{
81
83
  kind: 'align';
82
84
  }>);
83
- export type ModelOperationKind = 'box' | 'cylinder' | 'tube' | 'coil' | 'sphere' | 'frustum' | 'regularPrism' | 'circle' | 'ellipse' | 'rectangle' | 'regularPolygon' | 'point' | 'line' | 'arc' | 'bezier' | 'spline' | 'loft' | 'sketchFace' | 'extrude' | 'primitive' | 'material' | 'scaled' | 'originOffset' | 'originVertex' | 'originPoint' | 'originCenter' | 'rotate' | 'fillet' | 'chamfer' | 'shell' | 'relate' | 'expose' | 'group' | 'union' | 'cut' | 'intersect';
85
+ export type ModelOperationKind = 'sketch' | 'box' | 'cylinder' | 'tube' | 'coil' | 'sphere' | 'frustum' | 'regularPrism' | 'circle' | 'ellipse' | 'rectangle' | 'regularPolygon' | 'point' | 'line' | 'arc' | 'bezier' | 'spline' | 'loft' | 'sketchFace' | 'text' | 'extrude' | 'primitive' | 'material' | 'scaled' | 'originOffset' | 'originVertex' | 'originPoint' | 'originCenter' | 'rotate' | 'fillet' | 'chamfer' | 'shell' | 'relate' | 'expose' | 'group' | 'union' | 'cut' | 'intersect';
84
86
  export type ModelOperationInputRole = 'source' | 'receiver' | 'operand' | 'tool' | 'child' | 'collection' | 'reference' | 'section' | 'spine';
85
87
  export type ModelGeometryKind = 'solid' | 'face' | 'edge' | 'vertex';
86
88
  export type ModelKind = ModelGeometryKind | 'group';
87
- export type ModelOperationRegionSnapshot = Readonly<{
88
- kind: 'intersection' | 'section';
89
- inputNodeId: string;
90
- /** The model whose local coordinates contain this region mesh. */
91
- frameNodeId: string;
92
- mesh: RenderMesh;
93
- }>;
94
89
  export type ModelOperationSelectionSnapshot = Readonly<{
95
90
  kind: TopologyKind;
96
91
  inputNodeId: string;
@@ -110,7 +105,6 @@ export type ModelOperationSnapshot = Readonly<{
110
105
  role: ModelOperationInputRole;
111
106
  index: number;
112
107
  }>[];
113
- regions: readonly ModelOperationRegionSnapshot[];
114
108
  selections: readonly ModelOperationSelectionSnapshot[];
115
109
  sourceRef?: SourceRef;
116
110
  spatial?: ModelSpatialOperation;
@@ -121,6 +115,28 @@ export type ModelParameterDimension = Readonly<{
121
115
  origin: Vec3;
122
116
  vector: Vec3;
123
117
  }>;
118
+ export type RotationReferenceSnapshot = Readonly<{
119
+ offset: Vec3;
120
+ offsetExplicit: boolean;
121
+ explicit: boolean;
122
+ /** Rotation in the displacement frame, including reversed axes. */
123
+ rotation: Vec3;
124
+ /** Reference displacement axes, in the result model's local coordinates. */
125
+ frame: RigidTransform;
126
+ }> & (Readonly<{
127
+ kind: 'pivot';
128
+ point: Vec3;
129
+ }> | Readonly<{
130
+ kind: 'pivotVertex';
131
+ id: VertexId;
132
+ }> | Readonly<{
133
+ kind: 'axisEdge';
134
+ id: EdgeId;
135
+ }> | Readonly<{
136
+ kind: 'pivotPoint' | 'axisLine';
137
+ nodeId: string;
138
+ name: string;
139
+ }>);
124
140
  /** Local geometry coordinates; vector is the authored coordinates, offset, or angles. */
125
141
  export type ModelSpatialOperation = Readonly<{
126
142
  origin: Vec3;
@@ -129,15 +145,16 @@ export type ModelSpatialOperation = Readonly<{
129
145
  frame?: RigidTransform;
130
146
  rotation?: Vec3;
131
147
  axisOnly?: boolean;
148
+ reference?: RotationReferenceSnapshot;
132
149
  }>;
133
- export type ConstraintSpatialReference = Readonly<{
150
+ export type RelationSpatialReference = Readonly<{
134
151
  nodeId: string;
135
- kind: 'pivot' | 'pivotVertex' | 'around' | 'rotate';
152
+ kind: 'pivot' | 'pivotVertex' | 'pivotPoint' | 'axisEdge' | 'pivotOffset' | 'axisLine' | 'axisOffset' | 'rotate' | 'offset';
136
153
  spatial: ModelSpatialOperation;
137
154
  }>;
138
- export type ConstraintPreview = Readonly<{
139
- object: Pick<ModelSnapshotObject, 'nodeId' | 'compositionTransform' | 'constraints'>;
140
- spatial?: ConstraintSpatialReference;
155
+ export type RelationPreview = Readonly<{
156
+ object: Pick<ModelSnapshotObject, 'nodeId' | 'compositionTransform' | 'constraints' | 'transformations' | 'relationStages'>;
157
+ spatial?: RelationSpatialReference;
141
158
  }>;
142
159
  export type RenderMesh = Readonly<{
143
160
  /** Tessellation vertices used by the triangle mesh. */
@@ -159,11 +176,14 @@ export type RenderMesh = Readonly<{
159
176
  start: number;
160
177
  count: number;
161
178
  edgeId: EdgeId;
179
+ /** True for native straight edges, suitable as rotation references. */
180
+ linear?: boolean;
162
181
  }>[];
163
182
  }>;
164
183
  export type ModelSnapshotObject = Readonly<{
165
184
  nodeId: string;
166
- kind: ModelKind;
185
+ /** Original author geometry retained in an inspection frame, for tool binding. */
186
+ sourceNodeId?: string;
167
187
  name: string;
168
188
  /** Effective material, including recursive overrides from enclosing groups. */
169
189
  material?: ModelMaterialSnapshot;
@@ -173,13 +193,20 @@ export type ModelSnapshotObject = Readonly<{
173
193
  /** Placement in this snapshot tree; a root value uses model-local coordinates. */
174
194
  transform: Transform;
175
195
  constraints: readonly ConstraintSnapshot[];
196
+ transformations?: readonly TransformationSnapshot[];
197
+ relationStages?: readonly RelationStageSnapshot[];
176
198
  elements: readonly ElementSnapshot[];
177
199
  origin: Vec3;
178
200
  sourceRefs: readonly SourceRef[];
179
201
  parameters: readonly ParameterUsage[];
180
202
  operation: ModelOperationSnapshot;
203
+ }> & (Readonly<{
204
+ kind: ModelKind;
181
205
  mesh?: RenderMesh;
182
- }>;
206
+ }> | Readonly<{
207
+ kind: 'reference';
208
+ mesh?: never;
209
+ }>);
183
210
  type StoredElement = Readonly<{
184
211
  kind: ElementKind;
185
212
  transform: RigidTransform;
@@ -191,6 +218,7 @@ type StoredElement = Readonly<{
191
218
  facing?: 1 | -1;
192
219
  direction?: 1 | -1;
193
220
  topology?: StoredTopology;
221
+ parts?: readonly StoredTopology[];
194
222
  members?: StoredElements;
195
223
  }>;
196
224
  type StoredTopology = Readonly<{
@@ -204,10 +232,10 @@ type StoredAnchor = StoredElement & Readonly<{
204
232
  name: string;
205
233
  }>;
206
234
  type AnchorReference = StoredAnchor & Readonly<{
207
- model: ModelObject;
235
+ model: RelationObject;
208
236
  }>;
209
237
  export type ModelElementReference = Readonly<{
210
- model: ModelObject;
238
+ model: RelationObject;
211
239
  name: string;
212
240
  kind: ElementKind;
213
241
  transform: Transform;
@@ -216,19 +244,27 @@ export type ModelElementReference = Readonly<{
216
244
  direction?: 1 | -1;
217
245
  }>;
218
246
  export type ModelTopologyReference = Readonly<{
219
- model: ModelObject;
247
+ model: RelationObject;
220
248
  geometry: ModelObject;
221
249
  transform: Transform;
222
250
  }> & TopologySelection;
223
251
  export type ConstraintTraceReference = Readonly<{
252
+ kind: 'constraint';
224
253
  constraintId: string;
225
- source: ModelObject;
226
- target: ModelObject;
227
- self?: ModelObject;
254
+ source: RelationObject;
255
+ target: RelationObject;
256
+ self?: RelationObject;
257
+ }>;
258
+ export type RelationTraceReference = ConstraintTraceReference | Readonly<{
259
+ kind: 'transformation';
260
+ transformationId: string;
261
+ self?: RelationObject;
228
262
  }>;
229
263
  export type ModelOperationInstrumentation = Readonly<{
230
264
  siteId: string;
231
265
  execution: number;
266
+ /** Distinguishes operation results produced by the same call execution. */
267
+ outputIndex?: number;
232
268
  order: number;
233
269
  sourceRef: SourceRef;
234
270
  parameters: readonly ParameterUsage[];
@@ -238,38 +274,87 @@ export type ModelObjectRuntimeInfo = Readonly<{
238
274
  name: string;
239
275
  sourceRefs: readonly SourceRef[];
240
276
  }>;
277
+ type RelationDefinition = Readonly<{
278
+ kind: 'on' | 'align';
279
+ source: AnchorReference;
280
+ target: AnchorReference;
281
+ }> | Readonly<{
282
+ kind: 'transformation';
283
+ actions: readonly TransformationAction[];
284
+ }>;
285
+ type StoredTransformation = Readonly<{
286
+ id: string;
287
+ kind: 'transformation';
288
+ actions: readonly TransformationAction[];
289
+ }>;
290
+ export type RelationStageSnapshot = Readonly<{
291
+ constraintIds: readonly string[];
292
+ transformationIds: readonly string[];
293
+ compositionTransform: Transform;
294
+ offsetFrame: Transform;
295
+ }>;
296
+ export type TransformationSnapshot = Readonly<{
297
+ id: string;
298
+ sourceRefs: readonly SourceRef[];
299
+ parameters: readonly ParameterUsage[];
300
+ offsets: readonly Readonly<{
301
+ value: Vec3;
302
+ frame: Transform;
303
+ sourceRefs: readonly SourceRef[];
304
+ }>[];
305
+ rotations: readonly Readonly<{
306
+ spatial: ModelSpatialOperation;
307
+ sourceRefs: readonly SourceRef[];
308
+ }>[];
309
+ offsetFrame: Transform;
310
+ }>;
311
+ type StoredPlacement = StoredConstraint | StoredTransformation;
241
312
  type StoredConstraint = Readonly<{
242
313
  id: string;
243
314
  kind: 'on' | 'align';
244
315
  source: RelationReference;
245
316
  target: RelationReference;
246
- rotations: readonly ConstraintRotation[];
247
- offset: Vec3 | undefined;
248
317
  }>;
249
318
  type RelationReference = StoredAnchor & Readonly<{
250
- model?: ModelObject;
319
+ model?: RelationObject;
251
320
  }>;
252
- type PivotSelection = Readonly<{
321
+ type PivotSelection = (Readonly<{
253
322
  kind: 'pivot';
254
323
  point: Vec3;
255
324
  }> | Readonly<{
256
325
  kind: 'pivotVertex';
257
326
  id: VertexId;
258
327
  }> | Readonly<{
259
- kind: 'around';
328
+ kind: 'pivotPoint';
329
+ point: RelationReference;
330
+ }> | Readonly<{
331
+ kind: 'axisEdge';
332
+ id: EdgeId;
333
+ }> | Readonly<{
334
+ kind: 'axisLine';
260
335
  axis: RelationReference;
336
+ }>) & Readonly<{
337
+ offset?: Vec3;
338
+ implicit?: true;
261
339
  }>;
262
- type ConstraintRotation = Readonly<{
340
+ type AxisSelection = Extract<PivotSelection, {
341
+ kind: 'axisLine' | 'axisEdge';
342
+ }>;
343
+ type PointSelection = Exclude<PivotSelection, AxisSelection>;
344
+ type TransformationRotationAction = Readonly<{
263
345
  pivot: PivotSelection;
264
346
  angles: Vec3 | number;
265
347
  }>;
266
- type ConstraintSpatialSelection = Readonly<{
267
- kind: ConstraintSpatialReference['kind'];
348
+ type TransformationAction = TransformationRotationAction | Readonly<{
349
+ offset: Vec3;
350
+ }>;
351
+ type TransformationSpatialSelection = Readonly<{
352
+ kind: RelationSpatialReference['kind'];
268
353
  pivot: PivotSelection;
269
354
  }>;
270
355
  type RelateContext = Readonly<{
271
- self: ModelObject;
272
- original: ModelObject;
356
+ self: RelationObject;
357
+ inheritedPlacements: readonly StoredPlacement[];
273
358
  }>;
274
359
  /**
275
360
  * Start a fresh, serial tooling evaluation without invalidating model geometry.
@@ -278,19 +363,49 @@ type RelateContext = Readonly<{
278
363
  * complete results survive cancellation, and cleanup removes the check.
279
364
  */
280
365
  export declare function beginModelEvaluation(checkCancelled?: () => void): () => void;
366
+ /** Inspectors share the kernel but must retain the model's trace and cache scope. */
367
+ export declare function beginModelInspection(checkCancelled?: () => void): () => void;
281
368
  type LocalBounds = readonly [minimum: Vec3, maximum: Vec3];
369
+ type SolveContext = {
370
+ poses: ReadonlyMap<RelationObject, RigidTransform>;
371
+ frame: RigidTransform;
372
+ };
282
373
  declare const anchorKind: unique symbol;
283
- declare const modelFamily: unique symbol;
374
+ declare const coordinateFrame: unique symbol;
375
+ declare const modelKind: unique symbol;
284
376
  declare const modelNamedElements: unique symbol;
285
377
  export interface Anchor<Kind extends ElementKind = ElementKind> {
286
378
  readonly [anchorKind]: Kind;
287
- /** Translate this geometry's matching bound onto the directed target bound. */
379
+ /**
380
+ * Translate this geometry's matching bound onto the directed target bound.
381
+ * @code3d.inspect on.inspect
382
+ * @code3d.inspect this on.inspect
383
+ * @code3d.inspect target on.inspect
384
+ */
288
385
  on(target: Bound): Constraint;
289
- /** Align the underlying geometry, retaining unconstrained position and orientation. */
386
+ /**
387
+ * Align the underlying geometry, retaining unconstrained position and orientation.
388
+ * @code3d.inspect align.inspect
389
+ * @code3d.inspect this align.inspect
390
+ * @code3d.inspect target align.inspect
391
+ */
290
392
  align(this: Anchor<'point' | 'line' | 'face'>, target: Anchor<'point' | 'line' | 'face'>): Constraint;
393
+ /**
394
+ * Coincide origins and all coordinate axes.
395
+ * @code3d.inspect align.inspect
396
+ * @code3d.inspect this align.inspect
397
+ * @code3d.inspect target align.inspect
398
+ */
399
+ align(this: FrameAnchor, target: FrameAnchor): Constraint;
291
400
  }
292
401
  export interface PointAnchor extends Anchor<'point'> {
293
402
  }
403
+ /** A coordinate-system reference, independent of model geometry. */
404
+ export interface FrameAnchor extends Anchor<'frame'> {
405
+ readonly [coordinateFrame]: true;
406
+ /** The frame's zero-point reference; it has no model geometry. */
407
+ readonly origin: PointAnchor;
408
+ }
294
409
  export interface LineAnchor extends Anchor<'line'> {
295
410
  /** Reverse direction without changing geometry or the reference coordinate axes. */
296
411
  reverse(): this;
@@ -299,6 +414,8 @@ export interface FaceAnchor extends Anchor<'face'> {
299
414
  /** Reverse facing without changing geometry, position, or the reference axes. */
300
415
  flip(): this;
301
416
  }
417
+ /** Fixed solve-frame direction, or the solved direction of a straight edge/axis. */
418
+ export type DistanceAxis = 'x' | 'y' | 'z' | Vec3 | LineAnchor;
302
419
  declare const boundKind: unique symbol;
303
420
  export interface Bound extends FaceAnchor {
304
421
  readonly [boundKind]: true;
@@ -336,83 +453,125 @@ export interface Solid extends Anchor<'frame'>, GeometryQueryCapabilities, Surfa
336
453
  export type ElementSources = Readonly<Record<string, Anchor>>;
337
454
  export type NamedElements = Readonly<Record<string, Anchor>>;
338
455
  export type ExposedValue<Value> = Value extends {
339
- readonly [modelFamily]: infer Family;
456
+ readonly [modelKind]: infer Kind;
340
457
  readonly [modelNamedElements]: infer Elements;
341
- } ? (Family extends 'solid' ? Solid : Family extends 'face' ? Surface : Family extends 'edge' ? Edge : Family extends 'vertex' ? Vertex : Family extends 'group' ? Anchor<'frame'> : Anchor) & Elements : Value extends Anchor ? Value : never;
458
+ } ? (Kind extends 'solid' ? Solid : Kind extends 'face' ? Surface : Kind extends 'edge' ? Edge : Kind extends 'vertex' ? Vertex : Kind extends 'group' ? Anchor<'frame'> & DirectionalBounds : Anchor) & Elements : Value extends Anchor ? Value : never;
342
459
  export type ExposedElements<Sources extends ElementSources> = Readonly<{
343
460
  [Name in keyof Sources]: ExposedValue<Sources[Name]>;
344
461
  }>;
345
462
  export type MergedElements<Existing extends NamedElements, Added extends NamedElements> = Omit<Existing, keyof Added> & Added;
346
463
  export type ModelElementKind<Kind extends ModelKind> = Kind extends 'face' ? 'face' : Kind extends 'edge' ? 'line' : Kind extends 'vertex' ? 'point' : 'frame';
347
- export type ModelFamily = ModelKind | 'model';
348
- export type ModelFamilyElementKind<Family extends ModelFamily> = Family extends ModelKind ? ModelElementKind<Family> : ElementKind;
349
- export type ModelForFamily<Elements extends NamedElements, Family extends ModelFamily> = Family extends 'solid' ? SolidModel<Elements> : Family extends 'face' ? FaceModel<Elements> : Family extends 'edge' ? EdgeModel<Elements> : Family extends 'vertex' ? VertexModel<Elements> : Family extends 'group' ? GroupModel<Elements> : Model<Elements>;
350
- export interface ModelCapabilities<Elements extends NamedElements, Family extends ModelFamily> extends Anchor<ModelFamilyElementKind<Family>>, DirectionalBounds {
351
- readonly [modelFamily]: Family extends ModelKind ? Family : ModelKind;
464
+ export type ModelForKind<Elements extends NamedElements, Kind extends ModelKind> = Kind extends 'solid' ? SolidModel<Elements> : Kind extends 'face' ? FaceModel<Elements> : Kind extends 'edge' ? EdgeModel<Elements> : Kind extends 'vertex' ? VertexModel<Elements> : Kind extends 'group' ? GroupModel<Elements> : never;
465
+ /** Tight axis-aligned bounds in the selected model coordinate frame. */
466
+ export type ModelBounds = Readonly<{
467
+ minimum: Vec3;
468
+ maximum: Vec3;
469
+ size: Vec3;
470
+ }>;
471
+ export interface ModelCapabilities<Elements extends NamedElements, Kind extends ModelKind> extends Anchor<ModelElementKind<Kind>>, DirectionalBounds {
472
+ readonly [modelKind]: Kind;
352
473
  readonly [modelNamedElements]: Elements;
353
- relate(build: (self: ModelForFamily<Elements, Family>) => Constraint | readonly Constraint[]): ModelForFamily<Elements, Family>;
354
- expose<const Sources extends ElementSources>(sources: Sources): ModelForFamily<MergedElements<Elements, ExposedElements<Sources>>, Family>;
474
+ /** The same reference as frame.origin; not a point model or geometry center. */
475
+ readonly origin: PointAnchor;
476
+ /** Reference to the model's local zero and XYZ axes, independent of geometry. */
477
+ readonly frame: FrameAnchor;
478
+ /** Measure finite geometry in this model's local frame, or in relativeTo's frame. */
479
+ bounds(relativeTo?: Model): ModelBounds;
480
+ /** Model-origin coordinates in relativeTo's local frame, including placement. */
481
+ position(relativeTo: Model): Vec3;
482
+ /**
483
+ * Place a new value represented by callback self; each constraint must involve it.
484
+ * External model and element references retain their original identity.
485
+ * @code3d.inspect relate.inspectCall
486
+ * @code3d.inspect.context build relate.inspectContext
487
+ * @code3d.inspect.closure build relate.inspectBody
488
+ */
489
+ relate(build: (self: ModelForKind<Elements, Kind>) => Relation | readonly Relation[]): ModelForKind<Elements, Kind>;
490
+ /** @code3d.inspect sources expose.inspectSources */
491
+ expose<const Sources extends ElementSources>(sources: Sources): ModelForKind<MergedElements<Elements, ExposedElements<Sources>>, Kind>;
355
492
  /**
356
493
  * Shift the origin by this displacement: every local point becomes p - d.
357
- * @code3d.param dx {kind: 'length', label: 'Origin ΔX'}
358
- * @code3d.param dy {kind: 'length', label: 'Origin ΔY'}
359
- * @code3d.param dz {kind: 'length', label: 'Origin ΔZ'}
494
+ * @code3d.param dx {kind: 'length', default: 0, label: 'Origin ΔX'}
495
+ * @code3d.param dy {kind: 'length', default: 0, label: 'Origin ΔY'}
496
+ * @code3d.param dz {kind: 'length', default: 0, label: 'Origin ΔZ'}
360
497
  */
361
- originOffset(dx: number, dy: number, dz: number): ModelForFamily<Elements, Family>;
498
+ originOffset(dx: number, dy: number, dz: number): ModelForKind<Elements, Kind>;
362
499
  /** Re-express the model with this point reference at local zero. */
363
- originPoint(point: PointAnchor): ModelForFamily<Elements, Family>;
500
+ originPoint(point: PointAnchor): ModelForKind<Elements, Kind>;
364
501
  /**
365
502
  * Rotate about the current origin, in degrees, about fixed local X, Y, then Z axes.
366
- * @code3d.param x {kind: 'angle', label: 'Rotate X'}
367
- * @code3d.param y {kind: 'angle', label: 'Rotate Y'}
368
- * @code3d.param z {kind: 'angle', label: 'Rotate Z'}
503
+ * @code3d.param x {kind: 'angle', default: 0, label: 'Rotate X'}
504
+ * @code3d.param y {kind: 'angle', default: 0, label: 'Rotate Y'}
505
+ * @code3d.param z {kind: 'angle', default: 0, label: 'Rotate Z'}
369
506
  */
370
- rotate(x: number, y: number, z: number): ModelForFamily<Elements, Family>;
507
+ rotate(x: number, y: number, z: number): ModelForKind<Elements, Kind>;
371
508
  /**
372
509
  * Return a value with its entire material replaced, including every group descendant.
373
510
  * Capture a Three.js material at assignment, or use a CSS color for the default material.
374
511
  */
375
- material(material: Material | string): ModelForFamily<Elements, Family>;
512
+ material(material: Material | string): ModelForKind<Elements, Kind>;
376
513
  }
377
- export interface GeometryCapabilities<Elements extends NamedElements, Family extends ModelGeometryKind> extends GeometryQueryCapabilities {
514
+ export interface GeometryCapabilities<Elements extends NamedElements, Kind extends ModelGeometryKind> extends GeometryQueryCapabilities {
378
515
  /** Re-express the model with its geometric center at local zero. */
379
- originCenter(): ModelForFamily<Elements, Family>;
516
+ originCenter(): ModelForKind<Elements, Kind>;
380
517
  /**
381
518
  * Re-express the model with the selected vertex at local zero.
382
519
  * @code3d.param id {kind: 'vertex', label: 'Origin vertex'}
383
520
  */
384
- originVertex(id: VertexId): ModelForFamily<Elements, Family>;
385
- /** @code3d.param factor {kind: 'ratio', label: 'Scale'} */
386
- scaled(factor: number): ModelForFamily<Elements, Family>;
521
+ originVertex(id: VertexId): ModelForKind<Elements, Kind>;
522
+ /** @code3d.param factor {kind: 'ratio', default: 1, label: 'Scale'} */
523
+ scaled(factor: number): ModelForKind<Elements, Kind>;
387
524
  }
388
525
  export interface VertexTopologyCapabilities {
389
- /** @code3d.param id {kind: 'vertex', label: 'Vertex'} */
526
+ /**
527
+ * @code3d.param id {kind: 'vertex', label: 'Vertex'}
528
+ * @code3d.inspect inspectTopologyReference
529
+ */
390
530
  vertex(id: VertexId): Vertex;
391
- /** @code3d.param ids {kind: 'vertex', label: 'Vertices', actions: [{label: 'Use all', action: 'remove-argument'}]} */
531
+ /**
532
+ * @code3d.param ids {kind: 'vertex', label: 'Vertices', actions: [{label: 'Use all', action: 'remove-argument'}]}
533
+ * @code3d.inspect inspectTopologyReference
534
+ */
392
535
  vertices(ids?: readonly VertexId[]): readonly Vertex[];
393
536
  }
394
537
  export interface EdgeTopologyCapabilities extends VertexTopologyCapabilities {
395
- /** @code3d.param id {kind: 'edge', label: 'Edge'} */
538
+ /**
539
+ * @code3d.param id {kind: 'edge', label: 'Edge'}
540
+ * @code3d.inspect inspectTopologyReference
541
+ */
396
542
  edge(id: EdgeId): Edge;
397
- /** @code3d.param ids {kind: 'edge', label: 'Edges', actions: [{label: 'Use all', action: 'remove-argument'}]} */
543
+ /**
544
+ * @code3d.param ids {kind: 'edge', label: 'Edges', actions: [{label: 'Use all', action: 'remove-argument'}]}
545
+ * @code3d.inspect inspectTopologyReference
546
+ */
398
547
  edges(ids?: readonly EdgeId[]): readonly Edge[];
399
548
  }
400
549
  export interface SurfaceTopologyCapabilities extends EdgeTopologyCapabilities {
401
- /** @code3d.param id {kind: 'surface', label: 'Surface'} */
550
+ /**
551
+ * @code3d.param id {kind: 'surface', label: 'Surface'}
552
+ * @code3d.inspect inspectTopologyReference
553
+ */
402
554
  surface(id: SurfaceId): Surface;
403
- /** @code3d.param ids {kind: 'surface', label: 'Surfaces', actions: [{label: 'Use all', action: 'remove-argument'}]} */
555
+ /**
556
+ * @code3d.param ids {kind: 'surface', label: 'Surfaces', actions: [{label: 'Use all', action: 'remove-argument'}]}
557
+ * @code3d.inspect inspectTopologyReference
558
+ */
404
559
  surfaces(ids?: readonly SurfaceId[]): readonly Surface[];
405
560
  }
406
561
  export interface SolidModificationCapabilities<Elements extends NamedElements> {
407
562
  /** Subtracts all tools in one boolean operation, equivalent to cut(stock, tools). */
563
+ /**
564
+ * @code3d.inspect this cut.inspectReceiver
565
+ * @code3d.inspect tools cut.inspectMethodTools
566
+ */
408
567
  cut(tools: readonly SolidModel<{}>[]): SolidModel;
409
568
  /**
410
- * @code3d.param radius {kind: 'length', label: 'Fillet radius', constraints: {exclusiveMin: 0}}
569
+ * @code3d.param radius {kind: 'length', default: 1, label: 'Fillet radius', constraints: {exclusiveMin: 0}}
411
570
  * @code3d.param edgeIds {kind: 'edge', actions: [{label: 'Use all', action: 'remove-argument'}]}
412
571
  */
413
572
  fillet(radius: number, edgeIds?: readonly EdgeId[]): SolidModel<Elements>;
414
573
  /**
415
- * @code3d.param distance {kind: 'length', label: 'Chamfer distance', constraints: {exclusiveMin: 0}}
574
+ * @code3d.param distance {kind: 'length', default: 1, label: 'Chamfer distance', constraints: {exclusiveMin: 0}}
416
575
  * @code3d.param edgeIds {kind: 'edge', actions: [{label: 'Use all', action: 'remove-argument'}]}
417
576
  */
418
577
  chamfer(distance: number, edgeIds?: readonly EdgeId[]): SolidModel<Elements>;
@@ -420,12 +579,12 @@ export interface SolidModificationCapabilities<Elements extends NamedElements> {
420
579
  * Hollow a solid with uniform walls. Positive thickness offsets inward;
421
580
  * negative thickness offsets outward. Selected surfaces become openings.
422
581
  * Omit the selection, or use [], for a fully enclosed cavity.
423
- * @code3d.param thickness {kind: 'length', label: 'Wall thickness'}
582
+ * @code3d.param thickness {kind: 'length', default: 1, label: 'Wall thickness'}
424
583
  * @code3d.param removedSurfaceIds {kind: 'surface', label: 'Openings', actions: [{label: 'Close all openings', action: 'remove-argument'}]}
425
584
  */
426
585
  shell(thickness: number, removedSurfaceIds?: readonly SurfaceId[]): SolidModel<Elements>;
427
586
  }
428
- export type Model<Elements extends NamedElements = {}> = ModelCapabilities<Elements, 'model'> & Elements;
587
+ export type Model<Elements extends NamedElements = {}> = ModelCapabilities<Elements, ModelKind> & Elements;
429
588
  export type GroupModel<Elements extends NamedElements = {}> = ModelCapabilities<Elements, 'group'> & Elements;
430
589
  export type VertexModel<Elements extends NamedElements = {}> = ModelCapabilities<Elements, 'vertex'> & GeometryCapabilities<Elements, 'vertex'> & VertexTopologyCapabilities & Elements;
431
590
  export type EdgeModel<Elements extends NamedElements = CurveElements> = ModelCapabilities<Elements, 'edge'> & GeometryCapabilities<Elements, 'edge'> & EdgeTopologyCapabilities & {
@@ -435,7 +594,9 @@ export type FaceModel<Elements extends NamedElements = PlanarElements> = ModelCa
435
594
  flip(): Surface;
436
595
  /**
437
596
  * Extrudes along the face's local plane normal. Signed distance; no recentering.
438
- * @code3d.param distance {kind: 'length', label: 'Extrusion distance'}
597
+ * @code3d.inspect this extrude.inspectMethod
598
+ * @code3d.inspect distance extrude.inspectMethod
599
+ * @code3d.param distance {kind: 'length', default: 10, label: 'Extrusion distance'}
439
600
  */
440
601
  extrude(distance: number): SolidModel;
441
602
  } & Elements;
@@ -457,81 +618,204 @@ export type CurveElements = Readonly<{
457
618
  export declare function modelElementReference(value: unknown): ModelElementReference | undefined;
458
619
  export declare function modelTopologyReference(value: unknown): ModelTopologyReference | undefined;
459
620
  export declare function modelTopologyIds(value: unknown, kind: TopologyKind): readonly TopologyId[] | undefined;
460
- /** Traceable relation values, including unfinished pivot and axis selections. */
461
- export declare abstract class ConstraintExpression {
462
- protected readonly kind: StoredConstraint['kind'];
463
- protected readonly source: AnchorReference;
464
- protected readonly target: AnchorReference;
465
- protected readonly displacement: Vec3 | undefined;
466
- protected readonly rotations: readonly ConstraintRotation[];
621
+ /** Snapshot the actual referenced geometry, including an exposed group's parts. */
622
+ export declare function previewAnchorReference(value: unknown, direction?: 'none' | 'forward' | 'both'): Readonly<{
623
+ model: RelationObject;
624
+ geometries: readonly ModelObject[];
625
+ elements: readonly ElementSnapshot[];
626
+ }> | undefined;
627
+ /** Traceable placement values, including unfinished pivot and axis selections. */
628
+ export declare abstract class RelationExpression {
629
+ protected readonly definition: RelationDefinition;
467
630
  protected readonly context: RelateContext | undefined;
468
- protected readonly constraintId: string;
469
- private get sourceRefs();
470
- private get parameters();
471
- protected spatialOperation?: ConstraintSpatialSelection;
472
- protected constructor(kind: StoredConstraint['kind'], source: AnchorReference, target: AnchorReference, displacement: Vec3 | undefined, rotations: readonly ConstraintRotation[], context: RelateContext | undefined, constraintId: string, previous?: ConstraintExpression);
631
+ protected readonly relationId: string;
632
+ protected readonly spatialOperation?: TransformationSpatialSelection | undefined;
633
+ protected constructor(definition: RelationDefinition, context: RelateContext | undefined, relationId: string, previous?: RelationExpression, spatialOperation?: TransformationSpatialSelection | undefined);
473
634
  }
474
- export declare class Constraint extends ConstraintExpression {
635
+ export declare class Constraint extends RelationExpression {
636
+ protected readonly definition: Exclude<RelationDefinition, {
637
+ kind: 'transformation';
638
+ }>;
475
639
  private constructor();
640
+ }
641
+ /** One completed relative placement step. Array order composes transformations. */
642
+ export declare class Transformation extends RelationExpression {
643
+ protected readonly definition: Extract<RelationDefinition, {
644
+ kind: 'transformation';
645
+ }>;
646
+ }
647
+ /** Carries the reference selection until its independent rotation is complete. */
648
+ declare class TransformationRotation extends RelationExpression {
649
+ constructor();
650
+ withRotation(pivot: PivotSelection, angles: Vec3 | number, previous: RelationExpression): Transformation;
651
+ }
652
+ export type Relation = Constraint | Transformation;
653
+ export declare class PivotRotation extends RelationExpression {
654
+ protected readonly chain: TransformationRotation;
655
+ protected readonly selection: PointSelection;
476
656
  /**
477
- * In the target reference axes, on() pins matching bound centers; align()
478
- * translates self after alignment, retaining the relation's free modes.
479
- * Explicit zero pins tangential coordinates for on() only.
480
- * @code3d.param x {kind: 'length', label: 'ΔX'}
481
- * @code3d.param y {kind: 'length', label: 'ΔY'}
482
- * @code3d.param z {kind: 'length', label: 'ΔZ'}
657
+ * @code3d.inspect relate.inspectRelation
658
+ * @code3d.param x {kind: 'angle', default: 0, label: 'Rotate X'}
659
+ * @code3d.param y {kind: 'angle', default: 0, label: 'Rotate Y'}
660
+ * @code3d.param z {kind: 'angle', default: 0, label: 'Rotate Z'}
483
661
  */
484
- offset(x: number, y: number, z: number): Constraint;
662
+ rotate(x: number, y: number, z: number): Transformation;
663
+ }
664
+ export declare class PivotChain extends PivotRotation {
485
665
  /**
486
- * Select this rotation's pivot in self's local coordinates.
487
- * @code3d.param x {kind: 'length', label: 'Pivot X'}
488
- * @code3d.param y {kind: 'length', label: 'Pivot Y'}
489
- * @code3d.param z {kind: 'length', label: 'Pivot Z'}
666
+ * Offset the selected pivot along self's local axes, retaining its reference.
667
+ * @code3d.inspect relate.inspectRelation
668
+ * @code3d.param x {kind: 'length', default: 0, label: 'Pivot ΔX'}
669
+ * @code3d.param y {kind: 'length', default: 0, label: 'Pivot ΔY'}
670
+ * @code3d.param z {kind: 'length', default: 0, label: 'Pivot ΔZ'}
490
671
  */
491
- pivot([x, y, z]: Vec3): ConstraintPivotChain;
492
- /** @code3d.param id {kind: 'vertex', label: 'Pivot vertex'} */
493
- pivotVertex(id: VertexId): ConstraintPivotChain;
494
- /** Select a positioned axis in the composition. */
495
- around(axis: LineAnchor): ConstraintAroundChain;
672
+ pivotOffset(x: number, y: number, z: number): PivotRotation;
673
+ }
674
+ export declare class AxisRotation extends RelationExpression {
675
+ protected readonly chain: TransformationRotation;
676
+ protected readonly selection: AxisSelection;
496
677
  /**
497
- * Rotate about self's origin and local X, Y, then Z axes, in degrees.
498
- * @code3d.param x {kind: 'angle', label: 'Rotate X'}
499
- * @code3d.param y {kind: 'angle', label: 'Rotate Y'}
500
- * @code3d.param z {kind: 'angle', label: 'Rotate Z'}
678
+ * @code3d.inspect relate.inspectRelation
679
+ * @code3d.param angle {kind: 'angle', default: 0, label: 'Rotate'}
501
680
  */
502
- rotate(x: number, y: number, z: number): Constraint;
681
+ rotate(angle: number): Transformation;
503
682
  }
504
- export declare class ConstraintPivotChain extends ConstraintExpression {
505
- private readonly constraint;
506
- private readonly selection;
683
+ export declare class AxisChain extends AxisRotation {
507
684
  /**
508
- * @code3d.param x {kind: 'angle', label: 'Rotate X'}
509
- * @code3d.param y {kind: 'angle', label: 'Rotate Y'}
510
- * @code3d.param z {kind: 'angle', label: 'Rotate Z'}
685
+ * Offset the selected axis in its reference frame, retaining its direction.
686
+ * @code3d.inspect relate.inspectRelation
687
+ * @code3d.param x {kind: 'length', default: 0, label: 'Axis ΔX'}
688
+ * @code3d.param y {kind: 'length', default: 0, label: 'Axis ΔY'}
689
+ * @code3d.param z {kind: 'length', default: 0, label: 'Axis ΔZ'}
511
690
  */
512
- rotate(x: number, y: number, z: number): Constraint;
513
- }
514
- export declare class ConstraintAroundChain extends ConstraintExpression {
515
- private readonly constraint;
516
- private readonly selection;
517
- /** @code3d.param angle {kind: 'angle', label: 'Rotate'} */
518
- rotate(angle: number): Constraint;
691
+ axisOffset(x: number, y: number, z: number): AxisRotation;
519
692
  }
693
+ /**
694
+ * Move the joint result along the fixed axes of its composition.
695
+ * @code3d.inspect relate.inspectRelation
696
+ * @code3d.param x {kind: 'length', default: 0, label: 'ΔX'}
697
+ * @code3d.param y {kind: 'length', default: 0, label: 'ΔY'}
698
+ * @code3d.param z {kind: 'length', default: 0, label: 'ΔZ'}
699
+ */
700
+ export declare function offset(x: number, y: number, z: number): Transformation;
701
+ /**
702
+ * Rotate about self's current origin and local X, Y, then Z axes.
703
+ * @code3d.inspect relate.inspectRelation
704
+ * @code3d.param x {kind: 'angle', default: 0, label: 'Rotate X'}
705
+ * @code3d.param y {kind: 'angle', default: 0, label: 'Rotate Y'}
706
+ * @code3d.param z {kind: 'angle', default: 0, label: 'Rotate Z'}
707
+ */
708
+ export declare function rotate(x: number, y: number, z: number): Transformation;
709
+ /**
710
+ * Select a pivot in self's local coordinates for the next rotation.
711
+ * @code3d.inspect relate.inspectRelation
712
+ * @code3d.param x {kind: 'length', default: 0, label: 'Pivot X'}
713
+ * @code3d.param y {kind: 'length', default: 0, label: 'Pivot Y'}
714
+ * @code3d.param z {kind: 'length', default: 0, label: 'Pivot Z'}
715
+ */
716
+ export declare function pivot([x, y, z]: Vec3): PivotChain;
717
+ /**
718
+ * @code3d.inspect relate.inspectRelation
719
+ * @code3d.param id {kind: 'vertex', label: 'Pivot vertex'}
720
+ */
721
+ export declare function pivotVertex(id: VertexId): PivotChain;
722
+ /**
723
+ * Select a point reference as the center; rotation axes remain self local.
724
+ * @code3d.tool
725
+ * @code3d.inspect relate.inspectRelation
726
+ */
727
+ export declare function pivotPoint(point: PointAnchor): PivotChain;
728
+ /**
729
+ * @code3d.inspect relate.inspectRelation
730
+ * @code3d.param id {kind: 'edge', label: 'Rotation edge'}
731
+ */
732
+ export declare function axisEdge(id: EdgeId): AxisChain;
733
+ /**
734
+ * Select a positioned axis in the composition for the next rotation.
735
+ * @code3d.inspect relate.inspectRelation
736
+ * @code3d.tool
737
+ */
738
+ export declare function axisLine(axis: LineAnchor): AxisChain;
520
739
  declare const referenceBounds: unique symbol;
521
740
  declare const referenceBoundsParts: unique symbol;
522
741
  declare const modelSnapshotQueries: unique symbol;
523
- export declare class ModelObject<Elements extends NamedElements = {}, Kind extends ModelKind = ModelKind> implements Anchor<ModelElementKind<Kind>> {
742
+ type RelationObjectInit = Readonly<{
743
+ nodeId?: string;
744
+ placements?: readonly StoredPlacement[];
745
+ sourceRefs?: readonly SourceRef[];
746
+ parameters?: readonly ParameterUsage[];
747
+ }>;
748
+ /** A local reference frame and its relations, independent of finite geometry. */
749
+ export declare abstract class RelationObject {
750
+ readonly nodeId: string;
751
+ protected placements: StoredPlacement[];
752
+ protected get initialPose(): RigidTransform;
753
+ protected get constraints(): StoredConstraint[];
754
+ protected constructor(init?: RelationObjectInit);
755
+ get sourceRefs(): SourceRef[];
756
+ get parameters(): ParameterUsage[];
757
+ protected abstract copyRelations(init: RelationObjectInit): RelationObject;
758
+ protected edgeReference(_id: EdgeId): RelationReference;
759
+ private rotationAxis;
760
+ private rotationPoint;
761
+ protected vertexPosition(_id: VertexId): Vec3;
762
+ /** Store relations only after the complete callback has returned. */
763
+ protected addRelations(build: () => Relation | readonly Relation[]): readonly RelationObject[];
764
+ [referenceBounds](reference: StoredAnchor, transform: RigidTransform): LocalBounds;
765
+ protected alignmentGeometry(reference: StoredAnchor): AlignmentGeometry;
766
+ solvePose(context: SolveContext): RigidTransform;
767
+ private bodyActions;
768
+ private relationSpatial;
769
+ private placementActions;
770
+ /** Pose at the end of this segment; later constraints have their own input pose. */
771
+ private placementStageContext;
772
+ private followingActions;
773
+ protected relationStageSnapshots(context: SolveContext): readonly RelationStageSnapshot[] | undefined;
774
+ protected transformationSnapshots(context: SolveContext): readonly TransformationSnapshot[] | undefined;
775
+ private followingReferenceFrame;
776
+ private transformationSnapshot;
777
+ private transformationOffsetSpatial;
778
+ static createSolveContext(roots: readonly RelationObject[], overrides?: Map<RelationObject, readonly StoredPlacement[]>): SolveContext;
779
+ protected constraintSnapshot(constraint: StoredConstraint, context: SolveContext): ConstraintSnapshot;
780
+ }
781
+ /** Plane-only spatial value used by sketches before a B-Rep face exists. */
782
+ export declare class SketchFrame extends RelationObject {
783
+ private readonly retainedPose?;
784
+ readonly name = "Sketch";
785
+ readonly plane: FaceAnchor;
786
+ private readonly source?;
787
+ private readonly operation;
788
+ constructor(source?: SketchFrame, init?: RelationObjectInit, retainedPose?: RigidTransform | undefined);
789
+ protected get initialPose(): RigidTransform;
790
+ /** Snapshot the plane's placement without retaining its mutable relation program. */
791
+ retained(pose: RigidTransform): SketchFrame;
792
+ protected copyRelations(init: RelationObjectInit): SketchFrame;
793
+ relatedObjects(): readonly RelationObject[];
794
+ attachOperationTrace(siteId: string, execution: number, order: number, sourceRef: SourceRef, outputIndex?: number): void;
795
+ toSnapshot(): ModelSnapshotObject;
796
+ relate(build: (frame: SketchFrame) => Relation | readonly Relation[]): SketchFrame;
797
+ face(region: SketchRegion): FaceModel;
798
+ snapshot(): RelationPreview['object'];
799
+ /** Related finite models, expressed in this sketch's local editing plane. */
800
+ context(): readonly Readonly<{
801
+ nodeId: string;
802
+ transform: Transform;
803
+ }>[];
804
+ }
805
+ export declare class ModelObject<Elements extends NamedElements = {}, Kind extends ModelKind = ModelKind> extends RelationObject implements Anchor<ModelElementKind<Kind>> {
806
+ #private;
524
807
  readonly [anchorKind]: ModelElementKind<Kind>;
525
- readonly [modelFamily]: Kind;
808
+ readonly [modelKind]: Kind;
526
809
  readonly [modelNamedElements]: Elements;
527
810
  private readonly geometry?;
528
811
  private readonly assembly?;
529
812
  private readonly meshTolerance;
530
813
  private readonly geometryAnchor;
531
814
  private readonly elements;
532
- private constraints;
533
815
  private readonly operation;
534
816
  private constructor();
817
+ get origin(): PointAnchor;
818
+ get frame(): FrameAnchor;
535
819
  get up(): Bound;
536
820
  get down(): Bound;
537
821
  get left(): Bound;
@@ -539,11 +823,24 @@ export declare class ModelObject<Elements extends NamedElements = {}, Kind exten
539
823
  get front(): Bound;
540
824
  get back(): Bound;
541
825
  on(target: Bound): Constraint;
542
- align(target: Anchor<'point' | 'line' | 'face'>): Constraint;
826
+ align(target: Anchor): Constraint;
543
827
  reverse(): Edge;
544
828
  flip(): Surface;
545
- relate(build: (self: RuntimeModel<Elements, Kind>) => Constraint | readonly Constraint[]): RuntimeModel<Elements, Kind>;
829
+ relate(build: (self: RuntimeModel<Elements, Kind>) => Relation | readonly Relation[]): RuntimeModel<Elements, Kind>;
546
830
  expose<const Sources extends ElementSources>(sources: Sources): RuntimeModel<MergedElements<Elements, ExposedElements<Sources>>, Kind>;
831
+ /**
832
+ * Measure finite geometry in this model's local frame, or in relativeTo's frame.
833
+ * An explicit reference includes solved placement and nested group occurrences.
834
+ * Empty groups have no finite bounds.
835
+ */
836
+ bounds(relativeTo?: Model): ModelBounds;
837
+ /**
838
+ * Model-origin coordinates in relativeTo's local frame, including placement.
839
+ * This model's origin in its own frame is always [0, 0, 0], even for point models.
840
+ */
841
+ position(relativeTo: Model): Vec3;
842
+ /** Resolve source frames without losing nested occurrence positions. */
843
+ private localFrames;
547
844
  /** Resolve both own and occurrence references into this model's local frame. */
548
845
  private localElements;
549
846
  vertex(id: VertexId): Vertex;
@@ -571,22 +868,28 @@ export declare class ModelObject<Elements extends NamedElements = {}, Kind exten
571
868
  private snapshotNode;
572
869
  private evaluateBoolean;
573
870
  private allParameters;
574
- private solvePose;
575
871
  private memberPoses;
872
+ /** Finite members in this value's saved local assembly, without re-solving children. */
873
+ private geometryParts;
874
+ private static readonly inspectionSources;
875
+ private static readonly inspectionFrames;
876
+ /** Retain identities across focus changes; the call owns the saved frame's lifetime. */
877
+ private static inspectionFrame;
878
+ private static readonly dimensionSegments;
879
+ private static recordCompositionInspection;
576
880
  /** Bounds of the selected finite geometry after a rigid transform. */
577
881
  private [referenceBoundsParts];
578
882
  /** Bounds of the selected finite geometry after a rigid transform. */
579
883
  [referenceBounds](reference: StoredAnchor, transform: RigidTransform): LocalBounds;
580
884
  /** Pure query collection: it never substitutes geometry or runs author code. */
581
885
  [modelSnapshotQueries](): SnapshotQueryInput[];
582
- private alignmentGeometry;
583
- private relationElement;
584
- private bodyRotations;
585
- private constraintSpatial;
586
- /** Fix the assembly frame once, using only its direct member origins. */
886
+ protected alignmentGeometry(reference: StoredAnchor): AlignmentGeometry;
887
+ previewElement(reference: StoredAnchor, direction?: 'forward' | 'both'): ElementSnapshot;
888
+ protected edgeReference(id: EdgeId): RelationReference;
889
+ protected vertexPosition(id: VertexId): Vec3;
890
+ protected copyRelations(init: RelationObjectInit): ModelObject;
891
+ /** Fix the assembly frame once in the first member's solved local coordinates. */
587
892
  private static createAssembly;
588
- private static createSolveContext;
589
- private constraintSnapshot;
590
893
  private requireGeometry;
591
894
  private requireSolidGeometry;
592
895
  private operationSnapshot;
@@ -639,8 +942,15 @@ export type LoftOptions = Readonly<{
639
942
  spine?: EdgeModel<{}>;
640
943
  ruled?: boolean;
641
944
  }>;
945
+ /**
946
+ * @code3d.inspect sections loft.inspectSections
947
+ * @code3d.inspect spine loft.inspectSpine
948
+ */
642
949
  export declare function loft(sections: readonly FaceModel<{}>[], { spine, ruled }?: LoftOptions): SolidModel;
643
950
  /**
951
+ * @code3d.inspect x box.inspectDimension
952
+ * @code3d.inspect y box.inspectDimension
953
+ * @code3d.inspect z box.inspectDimension
644
954
  * @code3d.param x {kind: 'length', default: 10, constraints: {exclusiveMin: 0}}
645
955
  * @code3d.param y {kind: 'length', default: 10, constraints: {exclusiveMin: 0}}
646
956
  * @code3d.param z {kind: 'length', default: 10, constraints: {exclusiveMin: 0}}
@@ -684,24 +994,63 @@ export declare function frustum(bottomRadius: number, topRadius: number, y: numb
684
994
  * @code3d.param rotation {kind: 'angle', default: 0}
685
995
  */
686
996
  export declare function regularPrism(radius: number, y: number, sides: number, rotation?: number): SolidModel;
997
+ /** Compose members in the first member's local frame; empty groups use the default frame. */
998
+ /** @code3d.inspect children group.inspectChildren */
687
999
  export declare function group(children: readonly Model[], name?: string): GroupModel;
1000
+ /**
1001
+ * Measure finite models, topology, bounds or point references in their solved placement.
1002
+ * Without axis, returns the shortest geometric distance. With axis, returns the
1003
+ * gap between projected intervals (zero when they overlap). The result is a
1004
+ * non-negative number computed now; later relations do not update it.
1005
+ * @code3d.inspect distance.inspect
1006
+ * @code3d.inspect a distance.inspect
1007
+ * @code3d.inspect b distance.inspect
1008
+ * @code3d.inspect axis distance.inspect
1009
+ */
1010
+ export declare function distance(a: Anchor, b: Anchor, axis?: DistanceAxis): number;
1011
+ /** @code3d.inspect operands union.inspectOperands */
688
1012
  export declare function union(operands: readonly SolidModel<{}>[]): SolidModel;
689
1013
  /**
690
- * Extrudes a single face; use faces.map(face => extrude(face, distance)) for multiple regions.
691
- * @code3d.param distance {kind: 'length', label: 'Extrusion distance'}
1014
+ * Extrudes each face independently, preserving array order and placement.
1015
+ * @code3d.inspect face extrude.inspectFaces
1016
+ * @code3d.inspect distance extrude.inspectFaces
1017
+ * @code3d.param distance {kind: 'length', default: 10, label: 'Extrusion distance'}
692
1018
  */
693
1019
  export declare function extrude(face: FaceModel<{}>, distance: number): SolidModel;
1020
+ /**
1021
+ * Extrudes each face independently.
1022
+ * @code3d.inspect faces extrude.inspectFaces
1023
+ * @code3d.inspect distance extrude.inspectFaces
1024
+ * @code3d.param distance {kind: 'length', default: 10, label: 'Extrusion distance'}
1025
+ */
1026
+ export declare function extrude(faces: readonly FaceModel<{}>[], distance: number): readonly SolidModel[];
1027
+ /**
1028
+ * Creates connected text faces on the XZ plane: +X right, -Z up, normal +Y.
1029
+ * All faces share the baseline origin. Size is the font em in model units.
1030
+ * @code3d.param size {kind: 'length', label: 'Text size'}
1031
+ */
1032
+ export declare function text(content: string, font: Font, size: number, options?: TextOptions): readonly FaceModel[];
1033
+ /**
1034
+ * @code3d.inspect stock cut.inspectStock
1035
+ * @code3d.inspect tools cut.inspectTools
1036
+ */
694
1037
  export declare function cut(stock: SolidModel<{}>, tools: readonly SolidModel<{}>[]): SolidModel;
1038
+ /** @code3d.inspect operands intersect.inspectOperands */
695
1039
  export declare function intersect(operands: readonly SolidModel<{}>[]): SolidModel;
696
1040
  export declare function isModelObject(value: unknown): value is ModelObject;
1041
+ export declare function isSolidModel(value: unknown): value is SolidModel<{}>;
697
1042
  export declare function isConstraint(value: unknown): value is Constraint;
698
- export declare function isConstraintExpression(value: unknown): value is ConstraintExpression;
699
- export declare function constraintPreview(value: ConstraintExpression): ConstraintPreview | undefined;
700
- export declare function instrumentConstraint(constraint: ConstraintExpression, sourceRef: SourceRef, parameters: readonly ParameterUsage[]): void;
701
- export declare function instrumentModelOperation(object: ModelObject, instrumentation: ModelOperationInstrumentation): void;
702
- export declare function constraintTraceReference(constraint: ConstraintExpression): ConstraintTraceReference;
703
- export declare function modelObjectRuntimeInfo(object: ModelObject): ModelObjectRuntimeInfo;
704
- export declare function relatedModelObjects(object: ModelObject): readonly ModelObject[];
1043
+ export declare function isRelationExpression(value: unknown): value is RelationExpression;
1044
+ export declare function relationPreview(value: RelationExpression, preceding?: readonly RelationExpression[]): RelationPreview | undefined;
1045
+ /** The current authoring receiver remains available when a free selector throws. */
1046
+ export declare function currentRelationSelf(): RelationObject | undefined;
1047
+ /** Preview an insertion/selector prefix, retaining only placements inherited by its callback. */
1048
+ export declare function relationSelectionPreview(self: RelationObject, preceding: readonly RelationExpression[], context?: RelationExpression): RelationPreview;
1049
+ export declare function instrumentRelation(constraint: RelationExpression, sourceRef: SourceRef, parameters: readonly ParameterUsage[]): void;
1050
+ export declare function instrumentModelOperation(object: RelationObject, instrumentation: ModelOperationInstrumentation): void;
1051
+ export declare function relationTraceReference(constraint: RelationExpression): RelationTraceReference;
1052
+ export declare function modelObjectRuntimeInfo(object: RelationObject): ModelObjectRuntimeInfo;
1053
+ export declare function relatedModelObjects(object: RelationObject): readonly RelationObject[];
705
1054
  export type SnapshotQuery = Readonly<{
706
1055
  key: KernelOperationKey;
707
1056
  }> & (Readonly<{
@@ -730,13 +1079,13 @@ export type SnapshotQueryBatch = Readonly<{
730
1079
  weight: number;
731
1080
  sourceRef?: SourceRef;
732
1081
  encode(): Uint8Array;
733
- accept(query: SnapshotQuery, value: SnapshotQueryResult): void;
1082
+ accept(query: SnapshotQuery, value: SnapshotQueryResult, milliseconds: number): void;
734
1083
  }>;
735
- export declare function planModelSnapshotQueries(objects: readonly ModelObject[]): SnapshotQueryBatch[];
1084
+ export declare function planModelSnapshotQueries(objects: readonly RelationObject[]): SnapshotQueryBatch[];
736
1085
  /** Each batch owns its restored shape; completed results leave before cancellation checks. */
737
- export declare function executeSnapshotQueryBatch(id: string, bytes: Uint8Array, queries: readonly SnapshotQuery[], checkCancelled: () => void, onResult: (query: SnapshotQuery, value: SnapshotQueryResult) => void, onRestore?: (milliseconds: number) => void): void;
738
- export declare function createModelSnapshotter(): (object: ModelObject) => ModelSnapshotObject;
739
- export declare function disposeModelObjects(objects: Iterable<ModelObject>): void;
1086
+ export declare function executeSnapshotQueryBatch(id: string, bytes: Uint8Array, queries: readonly SnapshotQuery[], checkCancelled: () => void, onResult: (query: SnapshotQuery, value: SnapshotQueryResult, milliseconds: number) => void, onRestore?: (milliseconds: number) => void): void;
1087
+ export declare function createModelSnapshotter(): (object: RelationObject) => ModelSnapshotObject;
1088
+ export declare function disposeModelObjects(objects: Iterable<RelationObject>): void;
740
1089
  /** Worker-owned native geometry, independent of the author's object lifetime. */
741
1090
  export type ModelGeometrySnapshot = Readonly<{
742
1091
  /** Borrowed shapes; clone before passing them to consuming operations. */
@@ -744,8 +1093,23 @@ export type ModelGeometrySnapshot = Readonly<{
744
1093
  inspect(nodeId: string, options?: TopologyInspectionOptions): TopologyInspection;
745
1094
  dispose(): void;
746
1095
  }>;
747
- export declare function retainModelGeometry(objects: Iterable<ModelObject>): ModelGeometrySnapshot;
1096
+ export declare function retainModelGeometry(objects: Iterable<RelationObject>): ModelGeometrySnapshot;
748
1097
  export declare const authoringApi: Readonly<{
1098
+ dimension: typeof dimension;
1099
+ boundsAnnotation: typeof boundsAnnotation;
1100
+ anchorAnnotation: typeof anchorAnnotation;
1101
+ captureInspectData: typeof captureInspectData;
1102
+ offset: typeof offset;
1103
+ rotate: typeof rotate;
1104
+ pivot: typeof pivot;
1105
+ pivotVertex: typeof pivotVertex;
1106
+ pivotPoint: typeof pivotPoint;
1107
+ axisEdge: typeof axisEdge;
1108
+ axisLine: typeof axisLine;
1109
+ cache: typeof cache;
1110
+ font: typeof font;
1111
+ googleFont: typeof googleFont;
1112
+ text: typeof text;
749
1113
  sketch: typeof sketch;
750
1114
  circle: typeof circle;
751
1115
  ellipse: typeof ellipse;
@@ -766,10 +1130,9 @@ export declare const authoringApi: Readonly<{
766
1130
  frustum: typeof frustum;
767
1131
  regularPrism: typeof regularPrism;
768
1132
  group: typeof group;
1133
+ distance: typeof distance;
769
1134
  union: typeof union;
770
1135
  cut: typeof cut;
771
1136
  intersect: typeof intersect;
772
1137
  }>;
773
- /** Internal bridge from the kernel-independent sketch definition to model geometry. */
774
- export declare function sketchFaceModel(region: SketchRegion): FaceModel;
775
1138
  //# sourceMappingURL=runtime.d.ts.map