@code3d/core 0.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +824 -0
- package/THIRD_PARTY.md +28 -0
- package/bld/library/alignment-geometry.d.ts +50 -0
- package/bld/library/alignment-geometry.d.ts.map +1 -0
- package/bld/library/alignment-geometry.js +322 -0
- package/bld/library/alignment-geometry.js.map +1 -0
- package/bld/library/bound-solver.d.ts +33 -0
- package/bld/library/bound-solver.d.ts.map +1 -0
- package/bld/library/bound-solver.js +252 -0
- package/bld/library/bound-solver.js.map +1 -0
- package/bld/library/extrude.d.ts +8 -0
- package/bld/library/extrude.d.ts.map +1 -0
- package/bld/library/extrude.js +28 -0
- package/bld/library/extrude.js.map +1 -0
- package/bld/library/index.d.ts +7 -0
- package/bld/library/index.d.ts.map +1 -0
- package/bld/library/index.js +3 -0
- package/bld/library/index.js.map +1 -0
- package/bld/library/kernel-artifact-codec.d.ts +3 -0
- package/bld/library/kernel-artifact-codec.d.ts.map +1 -0
- package/bld/library/kernel-artifact-codec.js +148 -0
- package/bld/library/kernel-artifact-codec.js.map +1 -0
- package/bld/library/kernel-cache.d.ts +63 -0
- package/bld/library/kernel-cache.d.ts.map +1 -0
- package/bld/library/kernel-cache.js +245 -0
- package/bld/library/kernel-cache.js.map +1 -0
- package/bld/library/kernel-shapes.d.ts +20 -0
- package/bld/library/kernel-shapes.d.ts.map +1 -0
- package/bld/library/kernel-shapes.js +108 -0
- package/bld/library/kernel-shapes.js.map +1 -0
- package/bld/library/loft.d.ts +7 -0
- package/bld/library/loft.d.ts.map +1 -0
- package/bld/library/loft.js +161 -0
- package/bld/library/loft.js.map +1 -0
- package/bld/library/material.d.ts +12 -0
- package/bld/library/material.d.ts.map +1 -0
- package/bld/library/material.js +176 -0
- package/bld/library/material.js.map +1 -0
- package/bld/library/model-color.d.ts +8 -0
- package/bld/library/model-color.d.ts.map +1 -0
- package/bld/library/model-color.js +36 -0
- package/bld/library/model-color.js.map +1 -0
- package/bld/library/open-cascade-error.d.ts +2 -0
- package/bld/library/open-cascade-error.d.ts.map +1 -0
- package/bld/library/open-cascade-error.js +22 -0
- package/bld/library/open-cascade-error.js.map +1 -0
- package/bld/library/relation-solver.d.ts +29 -0
- package/bld/library/relation-solver.d.ts.map +1 -0
- package/bld/library/relation-solver.js +258 -0
- package/bld/library/relation-solver.js.map +1 -0
- package/bld/library/replicad.d.ts +17 -0
- package/bld/library/replicad.d.ts.map +1 -0
- package/bld/library/replicad.js +24 -0
- package/bld/library/replicad.js.map +1 -0
- package/bld/library/retained-memory.d.ts +7 -0
- package/bld/library/retained-memory.d.ts.map +1 -0
- package/bld/library/retained-memory.js +27 -0
- package/bld/library/retained-memory.js.map +1 -0
- package/bld/library/runtime.d.ts +775 -0
- package/bld/library/runtime.d.ts.map +1 -0
- package/bld/library/runtime.js +2954 -0
- package/bld/library/runtime.js.map +1 -0
- package/bld/library/shell.d.ts +7 -0
- package/bld/library/shell.d.ts.map +1 -0
- package/bld/library/shell.js +221 -0
- package/bld/library/shell.js.map +1 -0
- package/bld/library/sketch-curve-intersections.d.ts +13 -0
- package/bld/library/sketch-curve-intersections.d.ts.map +1 -0
- package/bld/library/sketch-curve-intersections.js +117 -0
- package/bld/library/sketch-curve-intersections.js.map +1 -0
- package/bld/library/sketch-curves.d.ts +31 -0
- package/bld/library/sketch-curves.d.ts.map +1 -0
- package/bld/library/sketch-curves.js +89 -0
- package/bld/library/sketch-curves.js.map +1 -0
- package/bld/library/sketch-drag-rules.d.ts +35 -0
- package/bld/library/sketch-drag-rules.d.ts.map +1 -0
- package/bld/library/sketch-drag-rules.js +522 -0
- package/bld/library/sketch-drag-rules.js.map +1 -0
- package/bld/library/sketch-face.d.ts +4 -0
- package/bld/library/sketch-face.d.ts.map +1 -0
- package/bld/library/sketch-face.js +72 -0
- package/bld/library/sketch-face.js.map +1 -0
- package/bld/library/sketch-incidence.d.ts +26 -0
- package/bld/library/sketch-incidence.d.ts.map +1 -0
- package/bld/library/sketch-incidence.js +114 -0
- package/bld/library/sketch-incidence.js.map +1 -0
- package/bld/library/sketch-precision.d.ts +19 -0
- package/bld/library/sketch-precision.d.ts.map +1 -0
- package/bld/library/sketch-precision.js +55 -0
- package/bld/library/sketch-precision.js.map +1 -0
- package/bld/library/sketch-regions.d.ts +12 -0
- package/bld/library/sketch-regions.d.ts.map +1 -0
- package/bld/library/sketch-regions.js +193 -0
- package/bld/library/sketch-regions.js.map +1 -0
- package/bld/library/sketch-solver.d.ts +97 -0
- package/bld/library/sketch-solver.d.ts.map +1 -0
- package/bld/library/sketch-solver.js +578 -0
- package/bld/library/sketch-solver.js.map +1 -0
- package/bld/library/sketch.d.ts +142 -0
- package/bld/library/sketch.d.ts.map +1 -0
- package/bld/library/sketch.js +650 -0
- package/bld/library/sketch.js.map +1 -0
- package/bld/library/spatial.d.ts +28 -0
- package/bld/library/spatial.d.ts.map +1 -0
- package/bld/library/spatial.js +195 -0
- package/bld/library/spatial.js.map +1 -0
- package/bld/library/three.d.ts +3 -0
- package/bld/library/three.d.ts.map +1 -0
- package/bld/library/three.js +3 -0
- package/bld/library/three.js.map +1 -0
- package/bld/library/topology-id.d.ts +24 -0
- package/bld/library/topology-id.d.ts.map +1 -0
- package/bld/library/topology-id.js +67 -0
- package/bld/library/topology-id.js.map +1 -0
- package/bld/library/topology-inspection.d.ts +64 -0
- package/bld/library/topology-inspection.d.ts.map +1 -0
- package/bld/library/topology-inspection.js +267 -0
- package/bld/library/topology-inspection.js.map +1 -0
- package/bld/library/topology.d.ts +94 -0
- package/bld/library/topology.d.ts.map +1 -0
- package/bld/library/topology.js +455 -0
- package/bld/library/topology.js.map +1 -0
- package/bld/node/index.d.ts +2 -0
- package/bld/node/index.d.ts.map +1 -0
- package/bld/node/index.js +14 -0
- package/bld/node/index.js.map +1 -0
- package/bld/node/replicad.d.ts +3 -0
- package/bld/node/replicad.d.ts.map +1 -0
- package/bld/node/replicad.js +3 -0
- package/bld/node/replicad.js.map +1 -0
- package/bld/tooling/index.d.ts +26 -0
- package/bld/tooling/index.d.ts.map +1 -0
- package/bld/tooling/index.js +19 -0
- package/bld/tooling/index.js.map +1 -0
- package/package.json +53 -0
- package/src/library/alignment-geometry.ts +431 -0
- package/src/library/bound-solver.ts +410 -0
- package/src/library/extrude.ts +38 -0
- package/src/library/index.ts +88 -0
- package/src/library/kernel-artifact-codec.ts +166 -0
- package/src/library/kernel-cache.ts +337 -0
- package/src/library/kernel-shapes.ts +135 -0
- package/src/library/loft.ts +196 -0
- package/src/library/material.ts +228 -0
- package/src/library/model-color.ts +47 -0
- package/src/library/open-cascade-error.ts +26 -0
- package/src/library/relation-solver.ts +479 -0
- package/src/library/replicad.ts +40 -0
- package/src/library/retained-memory.ts +23 -0
- package/src/library/runtime.ts +5146 -0
- package/src/library/shell.ts +281 -0
- package/src/library/sketch-curve-intersections.ts +154 -0
- package/src/library/sketch-curves.ts +161 -0
- package/src/library/sketch-drag-rules.ts +767 -0
- package/src/library/sketch-face.ts +89 -0
- package/src/library/sketch-incidence.ts +204 -0
- package/src/library/sketch-precision.ts +81 -0
- package/src/library/sketch-regions.ts +271 -0
- package/src/library/sketch-solver.ts +973 -0
- package/src/library/sketch.ts +977 -0
- package/src/library/spatial.ts +254 -0
- package/src/library/three.ts +2 -0
- package/src/library/topology-id.ts +81 -0
- package/src/library/topology-inspection.ts +368 -0
- package/src/library/topology.ts +776 -0
- package/src/library/tsconfig.json +11 -0
- package/src/node/index.ts +20 -0
- package/src/node/replicad.ts +3 -0
- package/src/node/tsconfig.json +16 -0
- package/src/tooling/index.ts +160 -0
- package/src/tooling/tsconfig.json +15 -0
|
@@ -0,0 +1,775 @@
|
|
|
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
|
+
import { type AnyShape } from 'replicad';
|
|
5
|
+
import { type Quaternion, type RigidTransform, type Vec3 } from './spatial.js';
|
|
6
|
+
import { type KernelOperationKey } from './kernel-cache.js';
|
|
7
|
+
import type { SketchRegion } from './sketch-regions.js';
|
|
8
|
+
import { type TopologyId } from './topology-id.js';
|
|
9
|
+
import { type EdgeId, type ShapeTopology, type SurfaceId, type TopologyKind, type TopologySelection, type VertexId } from './topology.js';
|
|
10
|
+
import { sketch } from './sketch.js';
|
|
11
|
+
export type { Quaternion, Vec3 } from './spatial.js';
|
|
12
|
+
export type { EdgeId, SurfaceId, TopologyKind, VertexId } from './topology.js';
|
|
13
|
+
export type SourceRef = Readonly<{
|
|
14
|
+
file: string;
|
|
15
|
+
start: number;
|
|
16
|
+
end: number;
|
|
17
|
+
}>;
|
|
18
|
+
export type ParameterKind = 'length' | 'angle' | 'ratio' | 'count' | 'scalar';
|
|
19
|
+
export type ParameterTarget = Readonly<{
|
|
20
|
+
id: string;
|
|
21
|
+
label: string;
|
|
22
|
+
kind: ParameterKind;
|
|
23
|
+
value: number;
|
|
24
|
+
sourceRef: SourceRef;
|
|
25
|
+
}>;
|
|
26
|
+
export type ParameterUsage = Readonly<{
|
|
27
|
+
operation: string;
|
|
28
|
+
argument: string;
|
|
29
|
+
value: number;
|
|
30
|
+
operationRef: SourceRef;
|
|
31
|
+
expressionRef: SourceRef;
|
|
32
|
+
target: ParameterTarget;
|
|
33
|
+
sensitivity: number;
|
|
34
|
+
}>;
|
|
35
|
+
export type Transform = Readonly<{
|
|
36
|
+
position: Vec3;
|
|
37
|
+
quaternion: Quaternion;
|
|
38
|
+
scale: Vec3;
|
|
39
|
+
}>;
|
|
40
|
+
export type ElementKind = 'point' | 'line' | 'face' | 'frame';
|
|
41
|
+
export type ElementSnapshot = Readonly<{
|
|
42
|
+
name: string;
|
|
43
|
+
kind: ElementKind;
|
|
44
|
+
transform: Transform;
|
|
45
|
+
bound?: Readonly<{
|
|
46
|
+
size: readonly [number, number];
|
|
47
|
+
facing: 1 | -1;
|
|
48
|
+
}>;
|
|
49
|
+
facing?: 1 | -1;
|
|
50
|
+
direction?: 1 | -1;
|
|
51
|
+
arrow?: RigidTransform;
|
|
52
|
+
topology?: Readonly<{
|
|
53
|
+
geometryNodeId: string;
|
|
54
|
+
transform: Transform;
|
|
55
|
+
}> & TopologySelection;
|
|
56
|
+
}>;
|
|
57
|
+
export type ConstraintAnchorSnapshot = Readonly<{
|
|
58
|
+
nodeId: string;
|
|
59
|
+
name: string;
|
|
60
|
+
kind: ElementKind;
|
|
61
|
+
}>;
|
|
62
|
+
export type ConstraintSnapshot = Readonly<{
|
|
63
|
+
id: string;
|
|
64
|
+
source: ConstraintAnchorSnapshot;
|
|
65
|
+
target: ConstraintAnchorSnapshot;
|
|
66
|
+
sourceElement: ElementSnapshot;
|
|
67
|
+
targetElement: ElementSnapshot;
|
|
68
|
+
offsetDirection: 1 | -1;
|
|
69
|
+
offset: Vec3;
|
|
70
|
+
offsetFrame: Transform;
|
|
71
|
+
sourceRefs: readonly SourceRef[];
|
|
72
|
+
parameters: readonly ParameterUsage[];
|
|
73
|
+
}> & (Readonly<{
|
|
74
|
+
kind: 'on';
|
|
75
|
+
/** Finite source extent in the contact frame, local to the source node. */
|
|
76
|
+
sourceBounds: Readonly<{
|
|
77
|
+
size: Vec3;
|
|
78
|
+
transform: Transform;
|
|
79
|
+
}>;
|
|
80
|
+
}> | Readonly<{
|
|
81
|
+
kind: 'align';
|
|
82
|
+
}>);
|
|
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';
|
|
84
|
+
export type ModelOperationInputRole = 'source' | 'receiver' | 'operand' | 'tool' | 'child' | 'collection' | 'reference' | 'section' | 'spine';
|
|
85
|
+
export type ModelGeometryKind = 'solid' | 'face' | 'edge' | 'vertex';
|
|
86
|
+
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
|
+
export type ModelOperationSelectionSnapshot = Readonly<{
|
|
95
|
+
kind: TopologyKind;
|
|
96
|
+
inputNodeId: string;
|
|
97
|
+
ids: readonly TopologyId[];
|
|
98
|
+
/** Input geometry coordinates expressed in the operation output's frame. */
|
|
99
|
+
transform: Transform;
|
|
100
|
+
}>;
|
|
101
|
+
export type ModelOperationSnapshot = Readonly<{
|
|
102
|
+
id: string;
|
|
103
|
+
siteId?: string;
|
|
104
|
+
execution?: number;
|
|
105
|
+
kind: ModelOperationKind;
|
|
106
|
+
order?: number;
|
|
107
|
+
outputNodeId: string;
|
|
108
|
+
inputs: readonly Readonly<{
|
|
109
|
+
nodeId: string;
|
|
110
|
+
role: ModelOperationInputRole;
|
|
111
|
+
index: number;
|
|
112
|
+
}>[];
|
|
113
|
+
regions: readonly ModelOperationRegionSnapshot[];
|
|
114
|
+
selections: readonly ModelOperationSelectionSnapshot[];
|
|
115
|
+
sourceRef?: SourceRef;
|
|
116
|
+
spatial?: ModelSpatialOperation;
|
|
117
|
+
/** Authored dimensions in the operation output's local geometry frame. */
|
|
118
|
+
dimensions?: Readonly<Record<string, ModelParameterDimension>>;
|
|
119
|
+
}>;
|
|
120
|
+
export type ModelParameterDimension = Readonly<{
|
|
121
|
+
origin: Vec3;
|
|
122
|
+
vector: Vec3;
|
|
123
|
+
}>;
|
|
124
|
+
/** Local geometry coordinates; vector is the authored coordinates, offset, or angles. */
|
|
125
|
+
export type ModelSpatialOperation = Readonly<{
|
|
126
|
+
origin: Vec3;
|
|
127
|
+
vector: Vec3;
|
|
128
|
+
/** Relation edits use self's frame at this authored operation. */
|
|
129
|
+
frame?: RigidTransform;
|
|
130
|
+
rotation?: Vec3;
|
|
131
|
+
axisOnly?: boolean;
|
|
132
|
+
}>;
|
|
133
|
+
export type ConstraintSpatialReference = Readonly<{
|
|
134
|
+
nodeId: string;
|
|
135
|
+
kind: 'pivot' | 'pivotVertex' | 'around' | 'rotate';
|
|
136
|
+
spatial: ModelSpatialOperation;
|
|
137
|
+
}>;
|
|
138
|
+
export type ConstraintPreview = Readonly<{
|
|
139
|
+
object: Pick<ModelSnapshotObject, 'nodeId' | 'compositionTransform' | 'constraints'>;
|
|
140
|
+
spatial?: ConstraintSpatialReference;
|
|
141
|
+
}>;
|
|
142
|
+
export type RenderMesh = Readonly<{
|
|
143
|
+
/** Tessellation vertices used by the triangle mesh. */
|
|
144
|
+
vertices: Float32Array;
|
|
145
|
+
normals: Float32Array;
|
|
146
|
+
/** Native face UVs normalized to each tessellated face's range. */
|
|
147
|
+
uvs?: Float32Array;
|
|
148
|
+
triangles: Uint32Array;
|
|
149
|
+
edges: Float32Array;
|
|
150
|
+
/** OpenCascade topology vertices, aligned with vertexIds. */
|
|
151
|
+
topologyVertices: Float32Array;
|
|
152
|
+
vertexIds: readonly VertexId[];
|
|
153
|
+
surfaceGroups: readonly Readonly<{
|
|
154
|
+
start: number;
|
|
155
|
+
count: number;
|
|
156
|
+
surfaceId: SurfaceId;
|
|
157
|
+
}>[];
|
|
158
|
+
edgeGroups: readonly Readonly<{
|
|
159
|
+
start: number;
|
|
160
|
+
count: number;
|
|
161
|
+
edgeId: EdgeId;
|
|
162
|
+
}>[];
|
|
163
|
+
}>;
|
|
164
|
+
export type ModelSnapshotObject = Readonly<{
|
|
165
|
+
nodeId: string;
|
|
166
|
+
kind: ModelKind;
|
|
167
|
+
name: string;
|
|
168
|
+
/** Effective material, including recursive overrides from enclosing groups. */
|
|
169
|
+
material?: ModelMaterialSnapshot;
|
|
170
|
+
children: readonly ModelSnapshotObject[];
|
|
171
|
+
/** Placement used when this snapshot participates in a composition. */
|
|
172
|
+
compositionTransform: Transform;
|
|
173
|
+
/** Placement in this snapshot tree; a root value uses model-local coordinates. */
|
|
174
|
+
transform: Transform;
|
|
175
|
+
constraints: readonly ConstraintSnapshot[];
|
|
176
|
+
elements: readonly ElementSnapshot[];
|
|
177
|
+
origin: Vec3;
|
|
178
|
+
sourceRefs: readonly SourceRef[];
|
|
179
|
+
parameters: readonly ParameterUsage[];
|
|
180
|
+
operation: ModelOperationSnapshot;
|
|
181
|
+
mesh?: RenderMesh;
|
|
182
|
+
}>;
|
|
183
|
+
type StoredElement = Readonly<{
|
|
184
|
+
kind: ElementKind;
|
|
185
|
+
transform: RigidTransform;
|
|
186
|
+
whole?: boolean;
|
|
187
|
+
bound?: Readonly<{
|
|
188
|
+
size: readonly [number, number];
|
|
189
|
+
facing: 1 | -1;
|
|
190
|
+
}>;
|
|
191
|
+
facing?: 1 | -1;
|
|
192
|
+
direction?: 1 | -1;
|
|
193
|
+
topology?: StoredTopology;
|
|
194
|
+
members?: StoredElements;
|
|
195
|
+
}>;
|
|
196
|
+
type StoredTopology = Readonly<{
|
|
197
|
+
source: ModelObject;
|
|
198
|
+
selection: TopologySelection;
|
|
199
|
+
transform: RigidTransform;
|
|
200
|
+
scale: number;
|
|
201
|
+
}>;
|
|
202
|
+
type StoredElements = Readonly<Record<string, StoredElement>>;
|
|
203
|
+
type StoredAnchor = StoredElement & Readonly<{
|
|
204
|
+
name: string;
|
|
205
|
+
}>;
|
|
206
|
+
type AnchorReference = StoredAnchor & Readonly<{
|
|
207
|
+
model: ModelObject;
|
|
208
|
+
}>;
|
|
209
|
+
export type ModelElementReference = Readonly<{
|
|
210
|
+
model: ModelObject;
|
|
211
|
+
name: string;
|
|
212
|
+
kind: ElementKind;
|
|
213
|
+
transform: Transform;
|
|
214
|
+
bound?: ElementSnapshot['bound'];
|
|
215
|
+
facing?: 1 | -1;
|
|
216
|
+
direction?: 1 | -1;
|
|
217
|
+
}>;
|
|
218
|
+
export type ModelTopologyReference = Readonly<{
|
|
219
|
+
model: ModelObject;
|
|
220
|
+
geometry: ModelObject;
|
|
221
|
+
transform: Transform;
|
|
222
|
+
}> & TopologySelection;
|
|
223
|
+
export type ConstraintTraceReference = Readonly<{
|
|
224
|
+
constraintId: string;
|
|
225
|
+
source: ModelObject;
|
|
226
|
+
target: ModelObject;
|
|
227
|
+
self?: ModelObject;
|
|
228
|
+
}>;
|
|
229
|
+
export type ModelOperationInstrumentation = Readonly<{
|
|
230
|
+
siteId: string;
|
|
231
|
+
execution: number;
|
|
232
|
+
order: number;
|
|
233
|
+
sourceRef: SourceRef;
|
|
234
|
+
parameters: readonly ParameterUsage[];
|
|
235
|
+
}>;
|
|
236
|
+
export type ModelObjectRuntimeInfo = Readonly<{
|
|
237
|
+
nodeId: string;
|
|
238
|
+
name: string;
|
|
239
|
+
sourceRefs: readonly SourceRef[];
|
|
240
|
+
}>;
|
|
241
|
+
type StoredConstraint = Readonly<{
|
|
242
|
+
id: string;
|
|
243
|
+
kind: 'on' | 'align';
|
|
244
|
+
source: RelationReference;
|
|
245
|
+
target: RelationReference;
|
|
246
|
+
rotations: readonly ConstraintRotation[];
|
|
247
|
+
offset: Vec3 | undefined;
|
|
248
|
+
}>;
|
|
249
|
+
type RelationReference = StoredAnchor & Readonly<{
|
|
250
|
+
model?: ModelObject;
|
|
251
|
+
}>;
|
|
252
|
+
type PivotSelection = Readonly<{
|
|
253
|
+
kind: 'pivot';
|
|
254
|
+
point: Vec3;
|
|
255
|
+
}> | Readonly<{
|
|
256
|
+
kind: 'pivotVertex';
|
|
257
|
+
id: VertexId;
|
|
258
|
+
}> | Readonly<{
|
|
259
|
+
kind: 'around';
|
|
260
|
+
axis: RelationReference;
|
|
261
|
+
}>;
|
|
262
|
+
type ConstraintRotation = Readonly<{
|
|
263
|
+
pivot: PivotSelection;
|
|
264
|
+
angles: Vec3 | number;
|
|
265
|
+
}>;
|
|
266
|
+
type ConstraintSpatialSelection = Readonly<{
|
|
267
|
+
kind: ConstraintSpatialReference['kind'];
|
|
268
|
+
pivot: PivotSelection;
|
|
269
|
+
}>;
|
|
270
|
+
type RelateContext = Readonly<{
|
|
271
|
+
self: ModelObject;
|
|
272
|
+
original: ModelObject;
|
|
273
|
+
}>;
|
|
274
|
+
/**
|
|
275
|
+
* Start a fresh, serial tooling evaluation without invalidating model geometry.
|
|
276
|
+
* Finish in finally after snapshotting to retain this evaluation's kernel work.
|
|
277
|
+
* An optional cancellation check may throw before any kernel operation starts;
|
|
278
|
+
* complete results survive cancellation, and cleanup removes the check.
|
|
279
|
+
*/
|
|
280
|
+
export declare function beginModelEvaluation(checkCancelled?: () => void): () => void;
|
|
281
|
+
type LocalBounds = readonly [minimum: Vec3, maximum: Vec3];
|
|
282
|
+
declare const anchorKind: unique symbol;
|
|
283
|
+
declare const modelFamily: unique symbol;
|
|
284
|
+
declare const modelNamedElements: unique symbol;
|
|
285
|
+
export interface Anchor<Kind extends ElementKind = ElementKind> {
|
|
286
|
+
readonly [anchorKind]: Kind;
|
|
287
|
+
/** Translate this geometry's matching bound onto the directed target bound. */
|
|
288
|
+
on(target: Bound): Constraint;
|
|
289
|
+
/** Align the underlying geometry, retaining unconstrained position and orientation. */
|
|
290
|
+
align(this: Anchor<'point' | 'line' | 'face'>, target: Anchor<'point' | 'line' | 'face'>): Constraint;
|
|
291
|
+
}
|
|
292
|
+
export interface PointAnchor extends Anchor<'point'> {
|
|
293
|
+
}
|
|
294
|
+
export interface LineAnchor extends Anchor<'line'> {
|
|
295
|
+
/** Reverse direction without changing geometry or the reference coordinate axes. */
|
|
296
|
+
reverse(): this;
|
|
297
|
+
}
|
|
298
|
+
export interface FaceAnchor extends Anchor<'face'> {
|
|
299
|
+
/** Reverse facing without changing geometry, position, or the reference axes. */
|
|
300
|
+
flip(): this;
|
|
301
|
+
}
|
|
302
|
+
declare const boundKind: unique symbol;
|
|
303
|
+
export interface Bound extends FaceAnchor {
|
|
304
|
+
readonly [boundKind]: true;
|
|
305
|
+
}
|
|
306
|
+
export interface DirectionalBounds {
|
|
307
|
+
readonly up: Bound;
|
|
308
|
+
readonly down: Bound;
|
|
309
|
+
readonly left: Bound;
|
|
310
|
+
readonly right: Bound;
|
|
311
|
+
readonly front: Bound;
|
|
312
|
+
readonly back: Bound;
|
|
313
|
+
}
|
|
314
|
+
export interface GeometryQueryCapabilities extends DirectionalBounds {
|
|
315
|
+
/** Local bounding-box center, carried through geometry transforms. */
|
|
316
|
+
readonly center: PointAnchor;
|
|
317
|
+
}
|
|
318
|
+
export interface Vertex extends PointAnchor, GeometryQueryCapabilities, VertexTopologyCapabilities {
|
|
319
|
+
readonly kind: 'vertex';
|
|
320
|
+
readonly id: VertexId;
|
|
321
|
+
}
|
|
322
|
+
export interface Edge extends LineAnchor, GeometryQueryCapabilities, EdgeTopologyCapabilities {
|
|
323
|
+
readonly kind: 'edge';
|
|
324
|
+
readonly id: EdgeId;
|
|
325
|
+
readonly start: PointAnchor;
|
|
326
|
+
readonly midpoint: PointAnchor;
|
|
327
|
+
readonly end: PointAnchor;
|
|
328
|
+
}
|
|
329
|
+
export interface Surface extends FaceAnchor, GeometryQueryCapabilities, SurfaceTopologyCapabilities {
|
|
330
|
+
readonly kind: 'surface';
|
|
331
|
+
readonly id: SurfaceId;
|
|
332
|
+
}
|
|
333
|
+
export interface Solid extends Anchor<'frame'>, GeometryQueryCapabilities, SurfaceTopologyCapabilities {
|
|
334
|
+
readonly kind: 'solid';
|
|
335
|
+
}
|
|
336
|
+
export type ElementSources = Readonly<Record<string, Anchor>>;
|
|
337
|
+
export type NamedElements = Readonly<Record<string, Anchor>>;
|
|
338
|
+
export type ExposedValue<Value> = Value extends {
|
|
339
|
+
readonly [modelFamily]: infer Family;
|
|
340
|
+
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;
|
|
342
|
+
export type ExposedElements<Sources extends ElementSources> = Readonly<{
|
|
343
|
+
[Name in keyof Sources]: ExposedValue<Sources[Name]>;
|
|
344
|
+
}>;
|
|
345
|
+
export type MergedElements<Existing extends NamedElements, Added extends NamedElements> = Omit<Existing, keyof Added> & Added;
|
|
346
|
+
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;
|
|
352
|
+
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>;
|
|
355
|
+
/**
|
|
356
|
+
* 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'}
|
|
360
|
+
*/
|
|
361
|
+
originOffset(dx: number, dy: number, dz: number): ModelForFamily<Elements, Family>;
|
|
362
|
+
/** Re-express the model with this point reference at local zero. */
|
|
363
|
+
originPoint(point: PointAnchor): ModelForFamily<Elements, Family>;
|
|
364
|
+
/**
|
|
365
|
+
* 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'}
|
|
369
|
+
*/
|
|
370
|
+
rotate(x: number, y: number, z: number): ModelForFamily<Elements, Family>;
|
|
371
|
+
/**
|
|
372
|
+
* Return a value with its entire material replaced, including every group descendant.
|
|
373
|
+
* Capture a Three.js material at assignment, or use a CSS color for the default material.
|
|
374
|
+
*/
|
|
375
|
+
material(material: Material | string): ModelForFamily<Elements, Family>;
|
|
376
|
+
}
|
|
377
|
+
export interface GeometryCapabilities<Elements extends NamedElements, Family extends ModelGeometryKind> extends GeometryQueryCapabilities {
|
|
378
|
+
/** Re-express the model with its geometric center at local zero. */
|
|
379
|
+
originCenter(): ModelForFamily<Elements, Family>;
|
|
380
|
+
/**
|
|
381
|
+
* Re-express the model with the selected vertex at local zero.
|
|
382
|
+
* @code3d.param id {kind: 'vertex', label: 'Origin vertex'}
|
|
383
|
+
*/
|
|
384
|
+
originVertex(id: VertexId): ModelForFamily<Elements, Family>;
|
|
385
|
+
/** @code3d.param factor {kind: 'ratio', label: 'Scale'} */
|
|
386
|
+
scaled(factor: number): ModelForFamily<Elements, Family>;
|
|
387
|
+
}
|
|
388
|
+
export interface VertexTopologyCapabilities {
|
|
389
|
+
/** @code3d.param id {kind: 'vertex', label: 'Vertex'} */
|
|
390
|
+
vertex(id: VertexId): Vertex;
|
|
391
|
+
/** @code3d.param ids {kind: 'vertex', label: 'Vertices', actions: [{label: 'Use all', action: 'remove-argument'}]} */
|
|
392
|
+
vertices(ids?: readonly VertexId[]): readonly Vertex[];
|
|
393
|
+
}
|
|
394
|
+
export interface EdgeTopologyCapabilities extends VertexTopologyCapabilities {
|
|
395
|
+
/** @code3d.param id {kind: 'edge', label: 'Edge'} */
|
|
396
|
+
edge(id: EdgeId): Edge;
|
|
397
|
+
/** @code3d.param ids {kind: 'edge', label: 'Edges', actions: [{label: 'Use all', action: 'remove-argument'}]} */
|
|
398
|
+
edges(ids?: readonly EdgeId[]): readonly Edge[];
|
|
399
|
+
}
|
|
400
|
+
export interface SurfaceTopologyCapabilities extends EdgeTopologyCapabilities {
|
|
401
|
+
/** @code3d.param id {kind: 'surface', label: 'Surface'} */
|
|
402
|
+
surface(id: SurfaceId): Surface;
|
|
403
|
+
/** @code3d.param ids {kind: 'surface', label: 'Surfaces', actions: [{label: 'Use all', action: 'remove-argument'}]} */
|
|
404
|
+
surfaces(ids?: readonly SurfaceId[]): readonly Surface[];
|
|
405
|
+
}
|
|
406
|
+
export interface SolidModificationCapabilities<Elements extends NamedElements> {
|
|
407
|
+
/** Subtracts all tools in one boolean operation, equivalent to cut(stock, tools). */
|
|
408
|
+
cut(tools: readonly SolidModel<{}>[]): SolidModel;
|
|
409
|
+
/**
|
|
410
|
+
* @code3d.param radius {kind: 'length', label: 'Fillet radius', constraints: {exclusiveMin: 0}}
|
|
411
|
+
* @code3d.param edgeIds {kind: 'edge', actions: [{label: 'Use all', action: 'remove-argument'}]}
|
|
412
|
+
*/
|
|
413
|
+
fillet(radius: number, edgeIds?: readonly EdgeId[]): SolidModel<Elements>;
|
|
414
|
+
/**
|
|
415
|
+
* @code3d.param distance {kind: 'length', label: 'Chamfer distance', constraints: {exclusiveMin: 0}}
|
|
416
|
+
* @code3d.param edgeIds {kind: 'edge', actions: [{label: 'Use all', action: 'remove-argument'}]}
|
|
417
|
+
*/
|
|
418
|
+
chamfer(distance: number, edgeIds?: readonly EdgeId[]): SolidModel<Elements>;
|
|
419
|
+
/**
|
|
420
|
+
* Hollow a solid with uniform walls. Positive thickness offsets inward;
|
|
421
|
+
* negative thickness offsets outward. Selected surfaces become openings.
|
|
422
|
+
* Omit the selection, or use [], for a fully enclosed cavity.
|
|
423
|
+
* @code3d.param thickness {kind: 'length', label: 'Wall thickness'}
|
|
424
|
+
* @code3d.param removedSurfaceIds {kind: 'surface', label: 'Openings', actions: [{label: 'Close all openings', action: 'remove-argument'}]}
|
|
425
|
+
*/
|
|
426
|
+
shell(thickness: number, removedSurfaceIds?: readonly SurfaceId[]): SolidModel<Elements>;
|
|
427
|
+
}
|
|
428
|
+
export type Model<Elements extends NamedElements = {}> = ModelCapabilities<Elements, 'model'> & Elements;
|
|
429
|
+
export type GroupModel<Elements extends NamedElements = {}> = ModelCapabilities<Elements, 'group'> & Elements;
|
|
430
|
+
export type VertexModel<Elements extends NamedElements = {}> = ModelCapabilities<Elements, 'vertex'> & GeometryCapabilities<Elements, 'vertex'> & VertexTopologyCapabilities & Elements;
|
|
431
|
+
export type EdgeModel<Elements extends NamedElements = CurveElements> = ModelCapabilities<Elements, 'edge'> & GeometryCapabilities<Elements, 'edge'> & EdgeTopologyCapabilities & {
|
|
432
|
+
reverse(): Edge;
|
|
433
|
+
} & Elements;
|
|
434
|
+
export type FaceModel<Elements extends NamedElements = PlanarElements> = ModelCapabilities<Elements, 'face'> & GeometryCapabilities<Elements, 'face'> & SurfaceTopologyCapabilities & {
|
|
435
|
+
flip(): Surface;
|
|
436
|
+
/**
|
|
437
|
+
* Extrudes along the face's local plane normal. Signed distance; no recentering.
|
|
438
|
+
* @code3d.param distance {kind: 'length', label: 'Extrusion distance'}
|
|
439
|
+
*/
|
|
440
|
+
extrude(distance: number): SolidModel;
|
|
441
|
+
} & Elements;
|
|
442
|
+
export type SolidModel<Elements extends NamedElements = CanonicalElements> = ModelCapabilities<Elements, 'solid'> & GeometryCapabilities<Elements, 'solid'> & SurfaceTopologyCapabilities & SolidModificationCapabilities<Elements> & Elements;
|
|
443
|
+
type RuntimeModel<Elements extends NamedElements, Kind extends ModelKind> = ModelObject<Elements, Kind> & Elements;
|
|
444
|
+
export type CanonicalElements = Readonly<{
|
|
445
|
+
center: PointAnchor;
|
|
446
|
+
axis: LineAnchor;
|
|
447
|
+
}>;
|
|
448
|
+
export type PlanarElements = Readonly<{
|
|
449
|
+
center: PointAnchor;
|
|
450
|
+
plane: FaceAnchor;
|
|
451
|
+
}>;
|
|
452
|
+
export type CurveElements = Readonly<{
|
|
453
|
+
start: PointAnchor;
|
|
454
|
+
midpoint: PointAnchor;
|
|
455
|
+
end: PointAnchor;
|
|
456
|
+
}>;
|
|
457
|
+
export declare function modelElementReference(value: unknown): ModelElementReference | undefined;
|
|
458
|
+
export declare function modelTopologyReference(value: unknown): ModelTopologyReference | undefined;
|
|
459
|
+
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[];
|
|
467
|
+
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);
|
|
473
|
+
}
|
|
474
|
+
export declare class Constraint extends ConstraintExpression {
|
|
475
|
+
private constructor();
|
|
476
|
+
/**
|
|
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'}
|
|
483
|
+
*/
|
|
484
|
+
offset(x: number, y: number, z: number): Constraint;
|
|
485
|
+
/**
|
|
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'}
|
|
490
|
+
*/
|
|
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;
|
|
496
|
+
/**
|
|
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'}
|
|
501
|
+
*/
|
|
502
|
+
rotate(x: number, y: number, z: number): Constraint;
|
|
503
|
+
}
|
|
504
|
+
export declare class ConstraintPivotChain extends ConstraintExpression {
|
|
505
|
+
private readonly constraint;
|
|
506
|
+
private readonly selection;
|
|
507
|
+
/**
|
|
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'}
|
|
511
|
+
*/
|
|
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;
|
|
519
|
+
}
|
|
520
|
+
declare const referenceBounds: unique symbol;
|
|
521
|
+
declare const referenceBoundsParts: unique symbol;
|
|
522
|
+
declare const modelSnapshotQueries: unique symbol;
|
|
523
|
+
export declare class ModelObject<Elements extends NamedElements = {}, Kind extends ModelKind = ModelKind> implements Anchor<ModelElementKind<Kind>> {
|
|
524
|
+
readonly [anchorKind]: ModelElementKind<Kind>;
|
|
525
|
+
readonly [modelFamily]: Kind;
|
|
526
|
+
readonly [modelNamedElements]: Elements;
|
|
527
|
+
private readonly geometry?;
|
|
528
|
+
private readonly assembly?;
|
|
529
|
+
private readonly meshTolerance;
|
|
530
|
+
private readonly geometryAnchor;
|
|
531
|
+
private readonly elements;
|
|
532
|
+
private constraints;
|
|
533
|
+
private readonly operation;
|
|
534
|
+
private constructor();
|
|
535
|
+
get up(): Bound;
|
|
536
|
+
get down(): Bound;
|
|
537
|
+
get left(): Bound;
|
|
538
|
+
get right(): Bound;
|
|
539
|
+
get front(): Bound;
|
|
540
|
+
get back(): Bound;
|
|
541
|
+
on(target: Bound): Constraint;
|
|
542
|
+
align(target: Anchor<'point' | 'line' | 'face'>): Constraint;
|
|
543
|
+
reverse(): Edge;
|
|
544
|
+
flip(): Surface;
|
|
545
|
+
relate(build: (self: RuntimeModel<Elements, Kind>) => Constraint | readonly Constraint[]): RuntimeModel<Elements, Kind>;
|
|
546
|
+
expose<const Sources extends ElementSources>(sources: Sources): RuntimeModel<MergedElements<Elements, ExposedElements<Sources>>, Kind>;
|
|
547
|
+
/** Resolve both own and occurrence references into this model's local frame. */
|
|
548
|
+
private localElements;
|
|
549
|
+
vertex(id: VertexId): Vertex;
|
|
550
|
+
vertices(ids?: readonly VertexId[]): readonly Vertex[];
|
|
551
|
+
edge(id: EdgeId): Edge;
|
|
552
|
+
edges(ids?: readonly EdgeId[]): readonly Edge[];
|
|
553
|
+
surface(id: SurfaceId): Surface;
|
|
554
|
+
surfaces(ids?: readonly SurfaceId[]): readonly Surface[];
|
|
555
|
+
private selectTopology;
|
|
556
|
+
material(material: Material | string): RuntimeModel<Elements, Kind>;
|
|
557
|
+
originOffset(dx: number, dy: number, dz: number): RuntimeModel<Elements, Kind>;
|
|
558
|
+
originPoint(point: PointAnchor): RuntimeModel<Elements, Kind>;
|
|
559
|
+
originVertex(id: VertexId): RuntimeModel<Elements, Kind>;
|
|
560
|
+
originCenter(): RuntimeModel<Elements, Kind>;
|
|
561
|
+
private withOrigin;
|
|
562
|
+
rotate(x: number, y: number, z: number): RuntimeModel<Elements, Kind>;
|
|
563
|
+
private transformed;
|
|
564
|
+
private mapConstraintGeometry;
|
|
565
|
+
scaled(factor: number): RuntimeModel<Elements, Kind>;
|
|
566
|
+
extrude(this: ModelObject<Elements, 'face'>, distance: number): SolidModel;
|
|
567
|
+
cut(this: ModelObject<Elements, 'solid'>, tools: readonly SolidModel<{}>[]): SolidModel;
|
|
568
|
+
fillet(this: ModelObject<Elements, 'solid'>, radius: number, edgeIds?: readonly EdgeId[]): SolidModel<Elements>;
|
|
569
|
+
chamfer(this: ModelObject<Elements, 'solid'>, distance: number, edgeIds?: readonly EdgeId[]): SolidModel<Elements>;
|
|
570
|
+
shell(this: ModelObject<Elements, 'solid'>, thickness: number, removedSurfaceIds?: readonly SurfaceId[]): SolidModel<Elements>;
|
|
571
|
+
private snapshotNode;
|
|
572
|
+
private evaluateBoolean;
|
|
573
|
+
private allParameters;
|
|
574
|
+
private solvePose;
|
|
575
|
+
private memberPoses;
|
|
576
|
+
/** Bounds of the selected finite geometry after a rigid transform. */
|
|
577
|
+
private [referenceBoundsParts];
|
|
578
|
+
/** Bounds of the selected finite geometry after a rigid transform. */
|
|
579
|
+
[referenceBounds](reference: StoredAnchor, transform: RigidTransform): LocalBounds;
|
|
580
|
+
/** Pure query collection: it never substitutes geometry or runs author code. */
|
|
581
|
+
[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. */
|
|
587
|
+
private static createAssembly;
|
|
588
|
+
private static createSolveContext;
|
|
589
|
+
private constraintSnapshot;
|
|
590
|
+
private requireGeometry;
|
|
591
|
+
private requireSolidGeometry;
|
|
592
|
+
private operationSnapshot;
|
|
593
|
+
private copyWithGeometry;
|
|
594
|
+
private copy;
|
|
595
|
+
}
|
|
596
|
+
/** @code3d.param radius {kind: 'length', default: 5, constraints: {exclusiveMin: 0}} */
|
|
597
|
+
export declare function circle(radius: number): FaceModel;
|
|
598
|
+
/**
|
|
599
|
+
* @code3d.param xRadius {kind: 'length', default: 5, label: 'X radius', constraints: {exclusiveMin: 0}}
|
|
600
|
+
* @code3d.param zRadius {kind: 'length', default: 3, label: 'Z radius', constraints: {exclusiveMin: 0}}
|
|
601
|
+
*/
|
|
602
|
+
export declare function ellipse(xRadius: number, zRadius: number): FaceModel;
|
|
603
|
+
/**
|
|
604
|
+
* @code3d.param x {kind: 'length', default: 10, constraints: {exclusiveMin: 0}}
|
|
605
|
+
* @code3d.param z {kind: 'length', default: 10, constraints: {exclusiveMin: 0}}
|
|
606
|
+
*/
|
|
607
|
+
export declare function rectangle(x: number, z: number): FaceModel;
|
|
608
|
+
/**
|
|
609
|
+
* @code3d.param radius {kind: 'length', default: 5, constraints: {exclusiveMin: 0}}
|
|
610
|
+
* @code3d.param sides {kind: 'count', default: 6, constraints: {min: 3}}
|
|
611
|
+
* @code3d.param rotation {kind: 'angle', default: 0}
|
|
612
|
+
*/
|
|
613
|
+
export declare function regularPolygon(radius: number, sides: number, rotation?: number): FaceModel;
|
|
614
|
+
/**
|
|
615
|
+
* @code3d.param x {kind: 'length', label: 'X'}
|
|
616
|
+
* @code3d.param y {kind: 'length', label: 'Y'}
|
|
617
|
+
* @code3d.param z {kind: 'length', label: 'Z'}
|
|
618
|
+
*/
|
|
619
|
+
export declare function point([x, y, z]?: Vec3): VertexModel;
|
|
620
|
+
/**
|
|
621
|
+
* @code3d.param x {kind: 'length', label: 'End X'}
|
|
622
|
+
* @code3d.param y {kind: 'length', label: 'End Y'}
|
|
623
|
+
* @code3d.param z {kind: 'length', label: 'End Z'}
|
|
624
|
+
*/
|
|
625
|
+
export declare function line([x, y, z]: Vec3): EdgeModel;
|
|
626
|
+
/**
|
|
627
|
+
* @code3d.param startX {kind: 'length', label: 'Start X'}
|
|
628
|
+
* @code3d.param startY {kind: 'length', label: 'Start Y'}
|
|
629
|
+
* @code3d.param startZ {kind: 'length', label: 'Start Z'}
|
|
630
|
+
* @code3d.param endX {kind: 'length', label: 'End X'}
|
|
631
|
+
* @code3d.param endY {kind: 'length', label: 'End Y'}
|
|
632
|
+
* @code3d.param endZ {kind: 'length', label: 'End Z'}
|
|
633
|
+
*/
|
|
634
|
+
export declare function line([startX, startY, startZ]: Vec3, [endX, endY, endZ]: Vec3): EdgeModel;
|
|
635
|
+
export declare function arc(start: Vec3, middle: Vec3, end: Vec3): EdgeModel;
|
|
636
|
+
export declare function bezier(points: readonly Vec3[]): EdgeModel;
|
|
637
|
+
export declare function spline(points: readonly Vec3[]): EdgeModel;
|
|
638
|
+
export type LoftOptions = Readonly<{
|
|
639
|
+
spine?: EdgeModel<{}>;
|
|
640
|
+
ruled?: boolean;
|
|
641
|
+
}>;
|
|
642
|
+
export declare function loft(sections: readonly FaceModel<{}>[], { spine, ruled }?: LoftOptions): SolidModel;
|
|
643
|
+
/**
|
|
644
|
+
* @code3d.param x {kind: 'length', default: 10, constraints: {exclusiveMin: 0}}
|
|
645
|
+
* @code3d.param y {kind: 'length', default: 10, constraints: {exclusiveMin: 0}}
|
|
646
|
+
* @code3d.param z {kind: 'length', default: 10, constraints: {exclusiveMin: 0}}
|
|
647
|
+
*/
|
|
648
|
+
export declare function box(x: number, y: number, z: number): SolidModel;
|
|
649
|
+
/**
|
|
650
|
+
* @code3d.param radius {kind: 'length', default: 5, constraints: {exclusiveMin: 0}}
|
|
651
|
+
* @code3d.param y {kind: 'length', default: 10, constraints: {exclusiveMin: 0}}
|
|
652
|
+
*/
|
|
653
|
+
export declare function cylinder(radius: number, y: number): SolidModel;
|
|
654
|
+
/**
|
|
655
|
+
* A concentric, constant-section tube, open at both ends and centered on Y.
|
|
656
|
+
* @code3d.param outerRadius {kind: 'length', default: 5, label: 'Outer radius', constraints: {exclusiveMin: 0}}
|
|
657
|
+
* @code3d.param innerRadius {kind: 'length', default: 3, label: 'Inner radius', constraints: {exclusiveMin: 0}}
|
|
658
|
+
* @code3d.param y {kind: 'length', default: 10, constraints: {exclusiveMin: 0}}
|
|
659
|
+
*/
|
|
660
|
+
export declare function tube(outerRadius: number, innerRadius: number, y: number): SolidModel;
|
|
661
|
+
/**
|
|
662
|
+
* A right-handed, constant-pitch coil with a circular wire section and plain ends.
|
|
663
|
+
* coilRadius measures to the wire centerline; pitch is the Y advance per turn.
|
|
664
|
+
* The centerline spans -pitch * turns / 2 to +pitch * turns / 2 on the Y axis.
|
|
665
|
+
* Fractional turns are supported. No spring-specific end treatments are applied.
|
|
666
|
+
* @code3d.param coilRadius {kind: 'length', default: 5, label: 'Coil radius', constraints: {exclusiveMin: 0}}
|
|
667
|
+
* @code3d.param wireRadius {kind: 'length', default: 1, label: 'Wire radius', constraints: {exclusiveMin: 0}}
|
|
668
|
+
* @code3d.param pitch {kind: 'length', default: 3, constraints: {exclusiveMin: 0}}
|
|
669
|
+
* @code3d.param turns {kind: 'scalar', default: 3, constraints: {exclusiveMin: 0}}
|
|
670
|
+
*/
|
|
671
|
+
export declare function coil(coilRadius: number, wireRadius: number, pitch: number, turns: number): SolidModel;
|
|
672
|
+
/** @code3d.param radius {kind: 'length', default: 5, constraints: {exclusiveMin: 0}} */
|
|
673
|
+
export declare function sphere(radius: number): SolidModel;
|
|
674
|
+
/**
|
|
675
|
+
* @code3d.param bottomRadius {kind: 'length', default: 5, label: 'Bottom radius', constraints: {exclusiveMin: 0}}
|
|
676
|
+
* @code3d.param topRadius {kind: 'length', default: 3, label: 'Top radius', constraints: {exclusiveMin: 0}}
|
|
677
|
+
* @code3d.param y {kind: 'length', default: 10, constraints: {exclusiveMin: 0}}
|
|
678
|
+
*/
|
|
679
|
+
export declare function frustum(bottomRadius: number, topRadius: number, y: number): SolidModel;
|
|
680
|
+
/**
|
|
681
|
+
* @code3d.param radius {kind: 'length', default: 5, constraints: {exclusiveMin: 0}}
|
|
682
|
+
* @code3d.param y {kind: 'length', default: 10, constraints: {exclusiveMin: 0}}
|
|
683
|
+
* @code3d.param sides {kind: 'count', default: 6, constraints: {min: 3}}
|
|
684
|
+
* @code3d.param rotation {kind: 'angle', default: 0}
|
|
685
|
+
*/
|
|
686
|
+
export declare function regularPrism(radius: number, y: number, sides: number, rotation?: number): SolidModel;
|
|
687
|
+
export declare function group(children: readonly Model[], name?: string): GroupModel;
|
|
688
|
+
export declare function union(operands: readonly SolidModel<{}>[]): SolidModel;
|
|
689
|
+
/**
|
|
690
|
+
* Extrudes a single face; use faces.map(face => extrude(face, distance)) for multiple regions.
|
|
691
|
+
* @code3d.param distance {kind: 'length', label: 'Extrusion distance'}
|
|
692
|
+
*/
|
|
693
|
+
export declare function extrude(face: FaceModel<{}>, distance: number): SolidModel;
|
|
694
|
+
export declare function cut(stock: SolidModel<{}>, tools: readonly SolidModel<{}>[]): SolidModel;
|
|
695
|
+
export declare function intersect(operands: readonly SolidModel<{}>[]): SolidModel;
|
|
696
|
+
export declare function isModelObject(value: unknown): value is ModelObject;
|
|
697
|
+
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[];
|
|
705
|
+
export type SnapshotQuery = Readonly<{
|
|
706
|
+
key: KernelOperationKey;
|
|
707
|
+
}> & (Readonly<{
|
|
708
|
+
kind: 'bounds';
|
|
709
|
+
transform: RigidTransform;
|
|
710
|
+
selection: TopologySelection;
|
|
711
|
+
scale: number;
|
|
712
|
+
}> | Readonly<{
|
|
713
|
+
kind: 'mesh';
|
|
714
|
+
tolerance: number;
|
|
715
|
+
topology: boolean;
|
|
716
|
+
}>);
|
|
717
|
+
export type SnapshotQueryResult = LocalBounds | RenderMesh;
|
|
718
|
+
type SnapshotQueryInput = {
|
|
719
|
+
inputId: string;
|
|
720
|
+
geometry: {
|
|
721
|
+
shape: AnyShape;
|
|
722
|
+
topology?: ShapeTopology;
|
|
723
|
+
};
|
|
724
|
+
query: SnapshotQuery;
|
|
725
|
+
};
|
|
726
|
+
/** Host-owned native input and result admission. Only encode() bytes cross runtimes. */
|
|
727
|
+
export type SnapshotQueryBatch = Readonly<{
|
|
728
|
+
id: string;
|
|
729
|
+
queries: readonly SnapshotQuery[];
|
|
730
|
+
weight: number;
|
|
731
|
+
sourceRef?: SourceRef;
|
|
732
|
+
encode(): Uint8Array;
|
|
733
|
+
accept(query: SnapshotQuery, value: SnapshotQueryResult): void;
|
|
734
|
+
}>;
|
|
735
|
+
export declare function planModelSnapshotQueries(objects: readonly ModelObject[]): SnapshotQueryBatch[];
|
|
736
|
+
/** 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;
|
|
740
|
+
/** Worker-owned native geometry, independent of the author's object lifetime. */
|
|
741
|
+
export type ModelGeometrySnapshot = Readonly<{
|
|
742
|
+
/** Borrowed shapes; clone before passing them to consuming operations. */
|
|
743
|
+
shapes: ReadonlyMap<string, AnyShape>;
|
|
744
|
+
inspect(nodeId: string, options?: TopologyInspectionOptions): TopologyInspection;
|
|
745
|
+
dispose(): void;
|
|
746
|
+
}>;
|
|
747
|
+
export declare function retainModelGeometry(objects: Iterable<ModelObject>): ModelGeometrySnapshot;
|
|
748
|
+
export declare const authoringApi: Readonly<{
|
|
749
|
+
sketch: typeof sketch;
|
|
750
|
+
circle: typeof circle;
|
|
751
|
+
ellipse: typeof ellipse;
|
|
752
|
+
extrude: typeof extrude;
|
|
753
|
+
rectangle: typeof rectangle;
|
|
754
|
+
regularPolygon: typeof regularPolygon;
|
|
755
|
+
point: typeof point;
|
|
756
|
+
line: typeof line;
|
|
757
|
+
arc: typeof arc;
|
|
758
|
+
bezier: typeof bezier;
|
|
759
|
+
spline: typeof spline;
|
|
760
|
+
loft: typeof loft;
|
|
761
|
+
box: typeof box;
|
|
762
|
+
cylinder: typeof cylinder;
|
|
763
|
+
tube: typeof tube;
|
|
764
|
+
coil: typeof coil;
|
|
765
|
+
sphere: typeof sphere;
|
|
766
|
+
frustum: typeof frustum;
|
|
767
|
+
regularPrism: typeof regularPrism;
|
|
768
|
+
group: typeof group;
|
|
769
|
+
union: typeof union;
|
|
770
|
+
cut: typeof cut;
|
|
771
|
+
intersect: typeof intersect;
|
|
772
|
+
}>;
|
|
773
|
+
/** Internal bridge from the kernel-independent sketch definition to model geometry. */
|
|
774
|
+
export declare function sketchFaceModel(region: SketchRegion): FaceModel;
|
|
775
|
+
//# sourceMappingURL=runtime.d.ts.map
|