@faicad/brepkit2-wasm 2.129.15
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/brepkit_wasm.d.ts +2368 -0
- package/brepkit_wasm.js +9 -0
- package/brepkit_wasm_bg.js +5495 -0
- package/brepkit_wasm_bg.wasm +0 -0
- package/brepkit_wasm_node.cjs +5509 -0
- package/package.json +40 -0
|
@@ -0,0 +1,2368 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Typed result for `boundingBox`.
|
|
5
|
+
*/
|
|
6
|
+
export interface BoundingBoxResult {
|
|
7
|
+
min_x: number;
|
|
8
|
+
min_y: number;
|
|
9
|
+
min_z: number;
|
|
10
|
+
max_x: number;
|
|
11
|
+
max_y: number;
|
|
12
|
+
max_z: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Typed result for `sketchSolve`.
|
|
17
|
+
*/
|
|
18
|
+
export interface SketchSolveResult {
|
|
19
|
+
converged: boolean;
|
|
20
|
+
points: number[];
|
|
21
|
+
residual: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Typed result for `tessellateSolidGrouped`.
|
|
26
|
+
*/
|
|
27
|
+
export interface GroupedMeshResult {
|
|
28
|
+
positions: number[];
|
|
29
|
+
normals: number[];
|
|
30
|
+
indices: number[];
|
|
31
|
+
faceOffsets: number[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Typed result for `tessellateSolidUV`.
|
|
36
|
+
*/
|
|
37
|
+
export interface UvMeshResult {
|
|
38
|
+
positions: number[];
|
|
39
|
+
normals: number[];
|
|
40
|
+
indices: number[];
|
|
41
|
+
uvs: number[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Typed result for boolean operations with evolution tracking.
|
|
46
|
+
*/
|
|
47
|
+
export interface EvolutionResult {
|
|
48
|
+
solid: number;
|
|
49
|
+
generated: number[];
|
|
50
|
+
modified: number[];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The B-Rep modeling kernel.
|
|
56
|
+
*
|
|
57
|
+
* Owns all topological state. JavaScript holds this reference and
|
|
58
|
+
* invokes methods to create, transform, and query geometry.
|
|
59
|
+
*/
|
|
60
|
+
export class BrepKernel {
|
|
61
|
+
free(): void;
|
|
62
|
+
[Symbol.dispose](): void;
|
|
63
|
+
/**
|
|
64
|
+
* Add hole wires to an existing face, creating a new face with the same
|
|
65
|
+
* surface but additional inner wires.
|
|
66
|
+
*
|
|
67
|
+
* Returns a new face handle (`u32`).
|
|
68
|
+
*/
|
|
69
|
+
addHolesToFace(face: number, hole_wire_handles: Uint32Array): number;
|
|
70
|
+
/**
|
|
71
|
+
* Get faces adjacent to a given face within a solid.
|
|
72
|
+
*
|
|
73
|
+
* Returns an array of face handles.
|
|
74
|
+
*/
|
|
75
|
+
adjacentFaces(solid: number, face: number): Uint32Array;
|
|
76
|
+
/**
|
|
77
|
+
* Approximate a curve through points using LSPIA (progressive iteration).
|
|
78
|
+
*
|
|
79
|
+
* Returns an edge handle.
|
|
80
|
+
*/
|
|
81
|
+
approximateCurveLspia(coords: Float64Array, degree: number, num_control_points: number, tolerance: number, max_iterations: number): number;
|
|
82
|
+
/**
|
|
83
|
+
* Approximate a curve through points (least-squares).
|
|
84
|
+
*
|
|
85
|
+
* Returns an edge handle.
|
|
86
|
+
*/
|
|
87
|
+
approximateCurve(coords: Float64Array, degree: number, num_control_points: number): number;
|
|
88
|
+
/**
|
|
89
|
+
* Approximate a grid of points into a NURBS surface using LSPIA.
|
|
90
|
+
*
|
|
91
|
+
* Returns a face handle.
|
|
92
|
+
*/
|
|
93
|
+
approximateSurfaceLspia(coords: Float64Array, rows: number, cols: number, degree_u: number, degree_v: number, num_cps_u: number, num_cps_v: number, tolerance: number, max_iterations: number): number;
|
|
94
|
+
/**
|
|
95
|
+
* Add a child component to a parent in an assembly.
|
|
96
|
+
*
|
|
97
|
+
* Returns the component ID.
|
|
98
|
+
*/
|
|
99
|
+
assemblyAddChild(assembly: number, parent: number, name: string, solid: number, matrix: Float64Array): number;
|
|
100
|
+
/**
|
|
101
|
+
* Add a root component to an assembly.
|
|
102
|
+
*
|
|
103
|
+
* Returns the component ID.
|
|
104
|
+
*/
|
|
105
|
+
assemblyAddRoot(assembly: number, name: string, solid: number, matrix: Float64Array): number;
|
|
106
|
+
/**
|
|
107
|
+
* Get the bill of materials for an assembly.
|
|
108
|
+
*
|
|
109
|
+
* Returns a JSON string: `[{"name": "...", "solidIndex": n, "instanceCount": n}, ...]`.
|
|
110
|
+
*/
|
|
111
|
+
assemblyBom(assembly: number): string;
|
|
112
|
+
/**
|
|
113
|
+
* Flatten an assembly into `[(solid, matrix), ...]`.
|
|
114
|
+
*
|
|
115
|
+
* Returns a JSON string: `[{"solid": u32, "matrix": [16 floats]}, ...]`.
|
|
116
|
+
*/
|
|
117
|
+
assemblyFlatten(assembly: number): string;
|
|
118
|
+
/**
|
|
119
|
+
* Create a new empty assembly. Returns an assembly index.
|
|
120
|
+
*/
|
|
121
|
+
assemblyNew(name: string): number;
|
|
122
|
+
/**
|
|
123
|
+
* Compute the axis-aligned bounding box of a solid.
|
|
124
|
+
*
|
|
125
|
+
* Returns `[min_x, min_y, min_z, max_x, max_y, max_z]`.
|
|
126
|
+
*
|
|
127
|
+
* # Errors
|
|
128
|
+
*
|
|
129
|
+
* Returns an error if the solid handle is invalid or has no vertices.
|
|
130
|
+
*/
|
|
131
|
+
boundingBox(solid: number): Float64Array;
|
|
132
|
+
/**
|
|
133
|
+
* Compute the center of mass of a solid (uniform density).
|
|
134
|
+
*
|
|
135
|
+
* Returns `[x, y, z]`.
|
|
136
|
+
*
|
|
137
|
+
* # Errors
|
|
138
|
+
*
|
|
139
|
+
* Returns an error if the solid has zero volume or tessellation fails.
|
|
140
|
+
*/
|
|
141
|
+
centerOfMass(solid: number, deflection: number): Float64Array;
|
|
142
|
+
/**
|
|
143
|
+
* Cut corners of a 2D polygon with flat bevels.
|
|
144
|
+
*
|
|
145
|
+
* `coords` is a flat array `[x,y, x,y, ...]`.
|
|
146
|
+
* `distance` is the chamfer distance from each corner.
|
|
147
|
+
* Returns a flat array of the chamfered polygon coordinates.
|
|
148
|
+
*/
|
|
149
|
+
chamfer2d(coords: Float64Array, distance: number): Float64Array;
|
|
150
|
+
/**
|
|
151
|
+
* Chamfer edges with distance and angle using the v2 blend engine.
|
|
152
|
+
*
|
|
153
|
+
* Returns a new solid handle.
|
|
154
|
+
*
|
|
155
|
+
* # Errors
|
|
156
|
+
*
|
|
157
|
+
* Returns an error if the solid or edge handles are invalid, or the
|
|
158
|
+
* blend computation fails.
|
|
159
|
+
*/
|
|
160
|
+
chamferDistanceAngle(solid: number, edge_handles: Uint32Array, distance: number, angle: number): number;
|
|
161
|
+
/**
|
|
162
|
+
* Chamfer edges with two distances using the v2 blend engine.
|
|
163
|
+
*
|
|
164
|
+
* Returns a new solid handle.
|
|
165
|
+
*
|
|
166
|
+
* # Errors
|
|
167
|
+
*
|
|
168
|
+
* Returns an error if the solid or edge handles are invalid, or the
|
|
169
|
+
* blend computation fails.
|
|
170
|
+
*/
|
|
171
|
+
chamferV2(solid: number, edge_handles: Uint32Array, d1: number, d2: number): number;
|
|
172
|
+
/**
|
|
173
|
+
* Chamfer edges of a solid.
|
|
174
|
+
*
|
|
175
|
+
* `edge_handles` is an array of edge handles. Returns a solid handle.
|
|
176
|
+
*
|
|
177
|
+
* # Errors
|
|
178
|
+
*
|
|
179
|
+
* Returns an error if distance is non-positive or edges are invalid.
|
|
180
|
+
*/
|
|
181
|
+
chamfer(solid: number, edge_handles: Uint32Array, distance: number): number;
|
|
182
|
+
/**
|
|
183
|
+
* Returns the number of saved checkpoints.
|
|
184
|
+
*/
|
|
185
|
+
checkpointCount(): number;
|
|
186
|
+
/**
|
|
187
|
+
* Save a snapshot of the current kernel state.
|
|
188
|
+
*
|
|
189
|
+
* Returns a checkpoint ID (zero-based index) that can be passed to
|
|
190
|
+
* `restore` or `discardCheckpoint`.
|
|
191
|
+
*
|
|
192
|
+
* The snapshot is a clone of all topology, assembly, and sketch state.
|
|
193
|
+
* Existing entity handles remain valid after restore.
|
|
194
|
+
*/
|
|
195
|
+
checkpoint(): number;
|
|
196
|
+
/**
|
|
197
|
+
* Create a circular pattern of a solid around an axis.
|
|
198
|
+
*
|
|
199
|
+
* Returns a compound handle.
|
|
200
|
+
*/
|
|
201
|
+
circularPattern(solid: number, ax: number, ay: number, az: number, count: number): number;
|
|
202
|
+
/**
|
|
203
|
+
* Classify a point using robust dual-method (winding + ray casting).
|
|
204
|
+
*
|
|
205
|
+
* Returns "inside", "outside", or "boundary".
|
|
206
|
+
*/
|
|
207
|
+
classifyPointRobust(solid: number, x: number, y: number, z: number, tolerance: number): string;
|
|
208
|
+
/**
|
|
209
|
+
* Classify a point relative to a solid using generalized winding numbers.
|
|
210
|
+
*
|
|
211
|
+
* Returns "inside", "outside", or "boundary".
|
|
212
|
+
*/
|
|
213
|
+
classifyPointWinding(solid: number, x: number, y: number, z: number, tolerance: number): string;
|
|
214
|
+
/**
|
|
215
|
+
* Classify a point relative to a solid: inside, outside, or on boundary.
|
|
216
|
+
*
|
|
217
|
+
* Returns `"inside"`, `"outside"`, or `"boundary"`.
|
|
218
|
+
*
|
|
219
|
+
* # Errors
|
|
220
|
+
*
|
|
221
|
+
* Returns an error if the solid handle is invalid.
|
|
222
|
+
*/
|
|
223
|
+
classifyPoint(solid: number, x: number, y: number, z: number, tolerance: number): string;
|
|
224
|
+
/**
|
|
225
|
+
* Find common (shared) edges between two adjacent 2D polygons.
|
|
226
|
+
*
|
|
227
|
+
* Both polygons are flat arrays `[x,y, x,y, ...]`.
|
|
228
|
+
* Returns a flat array of common segment endpoints `[x1,y1, x2,y2, ...]`,
|
|
229
|
+
* or an empty array if no common segments exist.
|
|
230
|
+
*/
|
|
231
|
+
commonSegment2d(coords_a: Float64Array, coords_b: Float64Array): Float64Array;
|
|
232
|
+
/**
|
|
233
|
+
* Compose (multiply) two 4x4 transformation matrices.
|
|
234
|
+
*
|
|
235
|
+
* Returns the composed matrix as a flat 16-element array (row-major).
|
|
236
|
+
* This computes `a * b`, meaning `b` is applied first, then `a`.
|
|
237
|
+
*
|
|
238
|
+
* # Errors
|
|
239
|
+
*
|
|
240
|
+
* Returns an error if either matrix doesn't have 16 elements.
|
|
241
|
+
*/
|
|
242
|
+
composeTransforms(matrix_a: Float64Array, matrix_b: Float64Array): Float64Array;
|
|
243
|
+
/**
|
|
244
|
+
* Cut a target solid by multiple tool solids in a single pass.
|
|
245
|
+
*
|
|
246
|
+
* This is more efficient than sequential `cut()` calls when many tools
|
|
247
|
+
* are applied to the same target — it avoids re-processing unchanged
|
|
248
|
+
* faces at each step.
|
|
249
|
+
*
|
|
250
|
+
* `tool_ids` is a JS `Uint32Array` or array of solid handles.
|
|
251
|
+
*
|
|
252
|
+
* # Errors
|
|
253
|
+
*
|
|
254
|
+
* Returns an error if any handle is invalid or the operation fails.
|
|
255
|
+
*/
|
|
256
|
+
compoundCut(target: number, tool_ids: Uint32Array): number;
|
|
257
|
+
/**
|
|
258
|
+
* Convert all analytic geometry in a solid to NURBS representation.
|
|
259
|
+
*
|
|
260
|
+
* Replaces planes, cylinders, cones, spheres, tori with NURBS surfaces and
|
|
261
|
+
* lines, circles, ellipses with NURBS curves. NURBS surfaces and curves
|
|
262
|
+
* already in the model are left untouched. Returns the number of entities
|
|
263
|
+
* converted.
|
|
264
|
+
*
|
|
265
|
+
* Converts every analytic surface and curve to a NURBS representation.
|
|
266
|
+
* Stored pcurves are dropped during conversion — callers that depend on
|
|
267
|
+
* pcurves should recompute them afterwards.
|
|
268
|
+
*
|
|
269
|
+
* # Errors
|
|
270
|
+
*
|
|
271
|
+
* Returns an error if the solid handle is invalid or conversion fails.
|
|
272
|
+
*/
|
|
273
|
+
convertToBspline(solid: number): number;
|
|
274
|
+
/**
|
|
275
|
+
* Recognize and replace NURBS faces and edges with their analytic
|
|
276
|
+
* (elementary) forms wherever possible (Plane/Cylinder/Sphere/
|
|
277
|
+
* Cone/Torus surfaces; Line/Circle/Ellipse edges).
|
|
278
|
+
*
|
|
279
|
+
* Inverse of `convertToBspline`: useful after STEP/IGES import
|
|
280
|
+
* to recover analytic types from B-spline-only exports.
|
|
281
|
+
* Returns the total number of faces and edges converted.
|
|
282
|
+
*
|
|
283
|
+
* # Errors
|
|
284
|
+
*
|
|
285
|
+
* Returns an error if topology lookups fail.
|
|
286
|
+
*/
|
|
287
|
+
convertToElementary(solid: number): number;
|
|
288
|
+
/**
|
|
289
|
+
* Build a convex hull solid from a point cloud.
|
|
290
|
+
*
|
|
291
|
+
* Uses the Quickhull algorithm for 3D point sets.
|
|
292
|
+
*
|
|
293
|
+
* Returns a solid handle (`u32`).
|
|
294
|
+
*
|
|
295
|
+
* # Errors
|
|
296
|
+
*
|
|
297
|
+
* Returns an error if fewer than 4 non-coplanar points are provided.
|
|
298
|
+
*/
|
|
299
|
+
convexHull(coords: Float64Array): number;
|
|
300
|
+
/**
|
|
301
|
+
* Copy a solid and apply a 4×4 row-major affine transform in one pass.
|
|
302
|
+
*
|
|
303
|
+
* Equivalent to `copySolid` + `transformSolid` but performs both in a
|
|
304
|
+
* single topology traversal, avoiding redundant NURBS clones.
|
|
305
|
+
*
|
|
306
|
+
* # Errors
|
|
307
|
+
*
|
|
308
|
+
* Returns an error if the solid handle is invalid, the matrix doesn't
|
|
309
|
+
* have 16 elements, or the matrix is singular.
|
|
310
|
+
*/
|
|
311
|
+
copyAndTransformSolid(solid: number, matrix: Float64Array): number;
|
|
312
|
+
/**
|
|
313
|
+
* Deep copy a face, returning a new independent face handle.
|
|
314
|
+
*
|
|
315
|
+
* The copy shares no sub-entities with the original, so translating it
|
|
316
|
+
* (to form a pocket or boss profile) does not mutate the donor solid.
|
|
317
|
+
*
|
|
318
|
+
* # Errors
|
|
319
|
+
*
|
|
320
|
+
* Returns an error if the face handle is invalid.
|
|
321
|
+
*/
|
|
322
|
+
copyFace(face: number): number;
|
|
323
|
+
/**
|
|
324
|
+
* Deep copy a solid, returning a new independent solid handle.
|
|
325
|
+
*
|
|
326
|
+
* # Errors
|
|
327
|
+
*
|
|
328
|
+
* Returns an error if the solid handle is invalid.
|
|
329
|
+
*/
|
|
330
|
+
copySolid(solid: number): number;
|
|
331
|
+
/**
|
|
332
|
+
* Deep copy a wire, returning a new independent wire handle.
|
|
333
|
+
*
|
|
334
|
+
* # Errors
|
|
335
|
+
*
|
|
336
|
+
* Returns an error if the wire handle is invalid.
|
|
337
|
+
*/
|
|
338
|
+
copyWire(wire: number): number;
|
|
339
|
+
/**
|
|
340
|
+
* Elevate the degree of an edge's NURBS curve.
|
|
341
|
+
*
|
|
342
|
+
* Returns a new edge handle.
|
|
343
|
+
*/
|
|
344
|
+
curveDegreeElevate(edge: number, elevate_by: number): number;
|
|
345
|
+
/**
|
|
346
|
+
* Insert a knot into an edge's NURBS curve.
|
|
347
|
+
*
|
|
348
|
+
* Returns a new edge handle with the refined curve.
|
|
349
|
+
*/
|
|
350
|
+
curveKnotInsert(edge: number, knot: number, times: number): number;
|
|
351
|
+
/**
|
|
352
|
+
* Remove a knot from an edge's NURBS curve.
|
|
353
|
+
*
|
|
354
|
+
* Returns a new edge handle with the simplified curve.
|
|
355
|
+
*/
|
|
356
|
+
curveKnotRemove(edge: number, knot: number, tolerance: number): number;
|
|
357
|
+
/**
|
|
358
|
+
* Split an edge's NURBS curve at a parameter value.
|
|
359
|
+
*
|
|
360
|
+
* Returns two edge handles as `[u32; 2]`.
|
|
361
|
+
*/
|
|
362
|
+
curveSplit(edge: number, u: number): Uint32Array;
|
|
363
|
+
/**
|
|
364
|
+
* Cut (subtract) solid `b` from solid `a` and return evolution tracking data.
|
|
365
|
+
*
|
|
366
|
+
* Returns a JSON string: `{"solid": <u32>, "evolution": {...}}`.
|
|
367
|
+
*
|
|
368
|
+
* # Errors
|
|
369
|
+
*
|
|
370
|
+
* Returns an error if either solid handle is invalid or the operation
|
|
371
|
+
* produces an empty or non-manifold result.
|
|
372
|
+
*/
|
|
373
|
+
cutWithEvolution(a: number, b: number): any;
|
|
374
|
+
/**
|
|
375
|
+
* Cut (subtract) solid `b` from solid `a`.
|
|
376
|
+
*
|
|
377
|
+
* Returns a new solid handle (`u32`).
|
|
378
|
+
*
|
|
379
|
+
* # Errors
|
|
380
|
+
*
|
|
381
|
+
* Returns an error if either solid handle is invalid or the operation
|
|
382
|
+
* produces an empty or non-manifold result.
|
|
383
|
+
*/
|
|
384
|
+
cut(a: number, b: number): number;
|
|
385
|
+
/**
|
|
386
|
+
* Remove specified faces from a solid (defeaturing).
|
|
387
|
+
*
|
|
388
|
+
* `face_handles` is an array of face handles to remove.
|
|
389
|
+
* Returns a new solid handle.
|
|
390
|
+
*/
|
|
391
|
+
defeature(solid: number, face_handles: Uint32Array): number;
|
|
392
|
+
/**
|
|
393
|
+
* Reconstruct a solid from a buffer produced by [`Self::serialize_solid`].
|
|
394
|
+
*
|
|
395
|
+
* # Errors
|
|
396
|
+
*
|
|
397
|
+
* Returns an error if the buffer is malformed or reconstruction fails.
|
|
398
|
+
*/
|
|
399
|
+
deserializeSolid(data: Uint8Array): number;
|
|
400
|
+
/**
|
|
401
|
+
* Detect surface-level coincident face pairs between two solids
|
|
402
|
+
* without performing a boolean operation.
|
|
403
|
+
*
|
|
404
|
+
* Useful for warning users about same-domain configurations
|
|
405
|
+
* (face stacks, coaxial cylinders, concentric spheres) before a
|
|
406
|
+
* boolean. Returns a JSON array string of objects:
|
|
407
|
+
* `[{"faceA": <u32>, "faceB": <u32>, "sameOrientation": <bool>, "aabbOverlap": <bool>}, ...]`.
|
|
408
|
+
*
|
|
409
|
+
* `sameOrientation` is `true` when the surface normals point the
|
|
410
|
+
* same way at corresponding parametric points (e.g., two coplanar
|
|
411
|
+
* faces with the same `+z` normal). `aabbOverlap` filters pairs
|
|
412
|
+
* that are same-domain on the surface but geometrically disjoint.
|
|
413
|
+
*
|
|
414
|
+
* # Errors
|
|
415
|
+
*
|
|
416
|
+
* Returns an error if either solid handle is invalid or any face /
|
|
417
|
+
* edge / vertex lookup fails internally.
|
|
418
|
+
*/
|
|
419
|
+
detectCoincidentFaces(a: number, b: number): string;
|
|
420
|
+
/**
|
|
421
|
+
* Detect small features (faces below an area threshold).
|
|
422
|
+
*
|
|
423
|
+
* Returns an array of face handles.
|
|
424
|
+
*/
|
|
425
|
+
detectSmallFeatures(solid: number, area_threshold: number, deflection: number): Uint32Array;
|
|
426
|
+
/**
|
|
427
|
+
* Discard a checkpoint and all checkpoints after it, freeing their memory.
|
|
428
|
+
*
|
|
429
|
+
* # Errors
|
|
430
|
+
*
|
|
431
|
+
* Returns an error if `checkpoint_id` does not refer to a valid checkpoint.
|
|
432
|
+
*/
|
|
433
|
+
discardCheckpoint(checkpoint_id: number): void;
|
|
434
|
+
/**
|
|
435
|
+
* Apply draft angle to faces of a solid.
|
|
436
|
+
*
|
|
437
|
+
* `face_handles` is an array of face handles to draft.
|
|
438
|
+
* Returns a solid handle.
|
|
439
|
+
*
|
|
440
|
+
* # Errors
|
|
441
|
+
*
|
|
442
|
+
* Returns an error if angle is zero or faces are invalid.
|
|
443
|
+
*/
|
|
444
|
+
draft(solid: number, face_handles: Uint32Array, pull_x: number, pull_y: number, pull_z: number, neutral_x: number, neutral_y: number, neutral_z: number, angle_degrees: number): number;
|
|
445
|
+
/**
|
|
446
|
+
* Compute the length of an edge.
|
|
447
|
+
*
|
|
448
|
+
* # Errors
|
|
449
|
+
*
|
|
450
|
+
* Returns an error if the edge handle is invalid.
|
|
451
|
+
*/
|
|
452
|
+
edgeLength(edge: number): number;
|
|
453
|
+
/**
|
|
454
|
+
* Get the edge-to-face adjacency map for a solid.
|
|
455
|
+
*
|
|
456
|
+
* Returns a JSON string: `{"edgeId": [faceId, ...], ...}`.
|
|
457
|
+
*/
|
|
458
|
+
edgeToFaceMap(solid: number): string;
|
|
459
|
+
/**
|
|
460
|
+
* Evaluate a point and tangent on an edge curve at parameter `t`.
|
|
461
|
+
*
|
|
462
|
+
* Returns `[px, py, pz, tx, ty, tz]`.
|
|
463
|
+
*/
|
|
464
|
+
evaluateEdgeCurveD1(edge: number, t: number): Float64Array;
|
|
465
|
+
/**
|
|
466
|
+
* Evaluate a point on an edge curve at parameter `t`.
|
|
467
|
+
*
|
|
468
|
+
* Returns `[x, y, z]`.
|
|
469
|
+
*/
|
|
470
|
+
evaluateEdgeCurve(edge: number, t: number): Float64Array;
|
|
471
|
+
/**
|
|
472
|
+
* Evaluate a surface normal at (u, v) on a face.
|
|
473
|
+
*
|
|
474
|
+
* Returns `[nx, ny, nz]`.
|
|
475
|
+
*/
|
|
476
|
+
evaluateSurfaceNormal(face: number, u: number, v: number): Float64Array;
|
|
477
|
+
/**
|
|
478
|
+
* Evaluate a point on a face surface at (u, v).
|
|
479
|
+
*
|
|
480
|
+
* Returns `[x, y, z]`.
|
|
481
|
+
*/
|
|
482
|
+
evaluateSurface(face: number, u: number, v: number): Float64Array;
|
|
483
|
+
/**
|
|
484
|
+
* Execute a batch of operations, crossing the JS/WASM boundary once.
|
|
485
|
+
*
|
|
486
|
+
* Accepts a JSON string containing an array of operation objects:
|
|
487
|
+
* ```json
|
|
488
|
+
* [
|
|
489
|
+
* {"op": "makeBox", "args": {"width": 2.0, "height": 2.0, "depth": 2.0}},
|
|
490
|
+
* {"op": "fuse", "args": {"solidA": 0, "solidB": 1}},
|
|
491
|
+
* {"op": "volume", "args": {"solid": 2, "deflection": 0.1}}
|
|
492
|
+
* ]
|
|
493
|
+
* ```
|
|
494
|
+
*
|
|
495
|
+
* Returns a JSON string with an array of results:
|
|
496
|
+
* ```json
|
|
497
|
+
* [
|
|
498
|
+
* {"ok": 0},
|
|
499
|
+
* {"ok": 2},
|
|
500
|
+
* {"error": "invalid solid id"}
|
|
501
|
+
* ]
|
|
502
|
+
* ```
|
|
503
|
+
*
|
|
504
|
+
* Operations are executed sequentially; an error in one does not
|
|
505
|
+
* prevent execution of subsequent operations.
|
|
506
|
+
*/
|
|
507
|
+
executeBatch(json: string): string;
|
|
508
|
+
/**
|
|
509
|
+
* Export a solid to 3MF format (ZIP archive as bytes).
|
|
510
|
+
*
|
|
511
|
+
* Returns a `Uint8Array` in JavaScript containing the `.3mf` file.
|
|
512
|
+
*
|
|
513
|
+
* # Errors
|
|
514
|
+
*
|
|
515
|
+
* Returns an error if the solid handle is invalid or export fails.
|
|
516
|
+
*/
|
|
517
|
+
export3mf(solid: number, deflection: number): Uint8Array;
|
|
518
|
+
/**
|
|
519
|
+
* Export a solid to glTF binary (.glb) format.
|
|
520
|
+
*
|
|
521
|
+
* # Errors
|
|
522
|
+
*
|
|
523
|
+
* Returns an error if the solid handle is invalid or tessellation fails.
|
|
524
|
+
*/
|
|
525
|
+
exportGlb(solid: number, deflection: number): Uint8Array;
|
|
526
|
+
/**
|
|
527
|
+
* Export a solid to IGES format.
|
|
528
|
+
*
|
|
529
|
+
* Returns the IGES file as a UTF-8 encoded byte vector.
|
|
530
|
+
*
|
|
531
|
+
* # Errors
|
|
532
|
+
*
|
|
533
|
+
* Returns an error if the solid handle is invalid or export fails.
|
|
534
|
+
*/
|
|
535
|
+
exportIges(solid: number): Uint8Array;
|
|
536
|
+
/**
|
|
537
|
+
* Export a solid to OBJ format (UTF-8 string as bytes).
|
|
538
|
+
*
|
|
539
|
+
* # Errors
|
|
540
|
+
*
|
|
541
|
+
* Returns an error if the solid handle is invalid or tessellation fails.
|
|
542
|
+
*/
|
|
543
|
+
exportObj(solid: number, deflection: number): Uint8Array;
|
|
544
|
+
/**
|
|
545
|
+
* Export a solid to PLY format (binary little-endian).
|
|
546
|
+
*
|
|
547
|
+
* # Errors
|
|
548
|
+
*
|
|
549
|
+
* Returns an error if the solid handle is invalid or tessellation fails.
|
|
550
|
+
*/
|
|
551
|
+
exportPly(solid: number, deflection: number): Uint8Array;
|
|
552
|
+
/**
|
|
553
|
+
* Export a solid to STEP AP203 format.
|
|
554
|
+
*
|
|
555
|
+
* Returns the STEP file as a UTF-8 encoded byte vector.
|
|
556
|
+
*
|
|
557
|
+
* # Errors
|
|
558
|
+
*
|
|
559
|
+
* Returns an error if the solid handle is invalid or export fails.
|
|
560
|
+
*/
|
|
561
|
+
exportStep(solid: number): Uint8Array;
|
|
562
|
+
/**
|
|
563
|
+
* Export a solid to STL ASCII format.
|
|
564
|
+
*
|
|
565
|
+
* Returns the ASCII STL as UTF-8 bytes.
|
|
566
|
+
*
|
|
567
|
+
* # Errors
|
|
568
|
+
*
|
|
569
|
+
* Returns an error if the solid handle is invalid or export fails.
|
|
570
|
+
*/
|
|
571
|
+
exportStlAscii(solid: number, deflection: number): Uint8Array;
|
|
572
|
+
/**
|
|
573
|
+
* Export a solid to binary STL format.
|
|
574
|
+
*
|
|
575
|
+
* Returns a `Uint8Array` containing the `.stl` file.
|
|
576
|
+
*
|
|
577
|
+
* # Errors
|
|
578
|
+
*
|
|
579
|
+
* Returns an error if the solid handle is invalid or export fails.
|
|
580
|
+
*/
|
|
581
|
+
exportStl(solid: number, deflection: number): Uint8Array;
|
|
582
|
+
/**
|
|
583
|
+
* Extrude a planar face along a direction vector to create a solid.
|
|
584
|
+
*
|
|
585
|
+
* Returns a solid handle (`u32`).
|
|
586
|
+
*
|
|
587
|
+
* # Errors
|
|
588
|
+
*
|
|
589
|
+
* Returns an error if the face handle is invalid or the extrusion fails.
|
|
590
|
+
*/
|
|
591
|
+
extrude(face: number, dir_x: number, dir_y: number, dir_z: number, distance: number): number;
|
|
592
|
+
/**
|
|
593
|
+
* Compute the area of a single face.
|
|
594
|
+
*
|
|
595
|
+
* # Errors
|
|
596
|
+
*
|
|
597
|
+
* Returns an error if the face handle is invalid or tessellation fails.
|
|
598
|
+
*/
|
|
599
|
+
faceArea(face: number, deflection: number): number;
|
|
600
|
+
/**
|
|
601
|
+
* Compute the perimeter of a face.
|
|
602
|
+
*
|
|
603
|
+
* # Errors
|
|
604
|
+
*
|
|
605
|
+
* Returns an error if the face handle is invalid.
|
|
606
|
+
*/
|
|
607
|
+
facePerimeter(face: number): number;
|
|
608
|
+
/**
|
|
609
|
+
* Get the wires (outer + inner) of a face.
|
|
610
|
+
*
|
|
611
|
+
* Returns an array of wire handles.
|
|
612
|
+
*/
|
|
613
|
+
faceWires(face: number): Uint32Array;
|
|
614
|
+
/**
|
|
615
|
+
* Fill a 4-sided boundary with a Coons patch surface.
|
|
616
|
+
*
|
|
617
|
+
* `boundary_coords` is flat `[x,y,z, ...]` for all 4 curves concatenated.
|
|
618
|
+
* `curve_lengths` is `[n0, n1, n2, n3]` — number of points per curve.
|
|
619
|
+
* Returns a face handle.
|
|
620
|
+
*/
|
|
621
|
+
fillCoonsPatch(boundary_coords: Float64Array, curve_lengths: Uint32Array): number;
|
|
622
|
+
/**
|
|
623
|
+
* Round corners of a 2D polygon by inserting arc-approximation vertices.
|
|
624
|
+
*
|
|
625
|
+
* `coords` is a flat array `[x,y, x,y, ...]`.
|
|
626
|
+
* `radius` is the fillet radius.
|
|
627
|
+
* Returns a flat array of the filleted polygon coordinates.
|
|
628
|
+
*/
|
|
629
|
+
fillet2d(coords: Float64Array, radius: number): Float64Array;
|
|
630
|
+
/**
|
|
631
|
+
* Fillet edges using the v2 walking-based blend engine.
|
|
632
|
+
*
|
|
633
|
+
* Returns a new solid handle.
|
|
634
|
+
*
|
|
635
|
+
* # Errors
|
|
636
|
+
*
|
|
637
|
+
* Returns an error if the solid or edge handles are invalid, or the
|
|
638
|
+
* blend computation fails.
|
|
639
|
+
*/
|
|
640
|
+
filletV2(solid: number, edge_handles: Uint32Array, radius: number): number;
|
|
641
|
+
/**
|
|
642
|
+
* Apply variable-radius fillets to edges.
|
|
643
|
+
*
|
|
644
|
+
* `json` is a JSON string: `[{"edge": u32, "law": "constant"|"linear"|"scurve", "start": f64, "end": f64}]`
|
|
645
|
+
*
|
|
646
|
+
* Also accepts brepjs-style fields: `startRadius`/`endRadius` as aliases for `start`/`end`.
|
|
647
|
+
* When `law` is omitted and `startRadius` != `endRadius`, the law auto-detects as `"linear"`.
|
|
648
|
+
*
|
|
649
|
+
* Returns a new solid handle.
|
|
650
|
+
*/
|
|
651
|
+
filletVariable(solid: number, json: string): number;
|
|
652
|
+
/**
|
|
653
|
+
* Apply a constant-radius fillet and return face-evolution tracking data.
|
|
654
|
+
*
|
|
655
|
+
* Returns a JSON string `{"solid": <u32>, "evolution": {modified,
|
|
656
|
+
* generated, deleted}}` — the same shape as `fuseWithEvolution`. Blend
|
|
657
|
+
* faces appear under `generated` and surviving faces under `modified`.
|
|
658
|
+
* Provenance is matched geometrically (face normal + centroid), so it is
|
|
659
|
+
* unaffected by how the fillet renumbers faces.
|
|
660
|
+
*
|
|
661
|
+
* # Errors
|
|
662
|
+
*
|
|
663
|
+
* Returns an error if a handle is invalid, the radius is non-positive, or
|
|
664
|
+
* the fillet fails.
|
|
665
|
+
*/
|
|
666
|
+
filletWithEvolution(solid: number, edge_handles: Uint32Array, radius: number): any;
|
|
667
|
+
/**
|
|
668
|
+
* Fillet (round) edges of a solid.
|
|
669
|
+
*
|
|
670
|
+
* `edge_handles` is an array of edge handles. Returns a solid handle.
|
|
671
|
+
*
|
|
672
|
+
* # Errors
|
|
673
|
+
*
|
|
674
|
+
* Returns an error if radius is non-positive or edges are invalid.
|
|
675
|
+
*/
|
|
676
|
+
fillet(solid: number, edge_handles: Uint32Array, radius: number): number;
|
|
677
|
+
/**
|
|
678
|
+
* Fix face orientations to ensure consistent outward normals.
|
|
679
|
+
*
|
|
680
|
+
* Returns the number of faces fixed.
|
|
681
|
+
*/
|
|
682
|
+
fixFaceOrientations(solid: number): number;
|
|
683
|
+
/**
|
|
684
|
+
* Reconstruct a solid from a BREP string.
|
|
685
|
+
*
|
|
686
|
+
* Accepts both STEP format (from `toBREP`) and JSON format (from
|
|
687
|
+
* `toBrepJson`). Auto-detects the format: strings starting with `{`
|
|
688
|
+
* are parsed as JSON, otherwise as STEP.
|
|
689
|
+
*
|
|
690
|
+
* Only single-solid STEP files are supported. Multi-solid files will
|
|
691
|
+
* return only the first solid.
|
|
692
|
+
*
|
|
693
|
+
* # Errors
|
|
694
|
+
*
|
|
695
|
+
* Returns an error if the data is invalid or reconstruction fails.
|
|
696
|
+
*/
|
|
697
|
+
fromBREP(data: string): number;
|
|
698
|
+
/**
|
|
699
|
+
* Fuse (union) many solids into one in a single call.
|
|
700
|
+
*
|
|
701
|
+
* Faster than a left-fold over `fuse`: overlapping solids are reduced
|
|
702
|
+
* pairwise in a balanced tree while disjoint groups are merged directly
|
|
703
|
+
* without a boolean.
|
|
704
|
+
*
|
|
705
|
+
* Returns a new solid handle (`u32`).
|
|
706
|
+
*
|
|
707
|
+
* # Errors
|
|
708
|
+
*
|
|
709
|
+
* Returns an error if any solid handle is invalid, the list is empty,
|
|
710
|
+
* or a boolean operation produces an empty or non-manifold result.
|
|
711
|
+
*/
|
|
712
|
+
fuseAll(solid_handles: Uint32Array): number;
|
|
713
|
+
/**
|
|
714
|
+
* Fuse (union) two solids and return evolution tracking data.
|
|
715
|
+
*
|
|
716
|
+
* Returns a JSON string: `{"solid": <u32>, "evolution": {...}}`.
|
|
717
|
+
*
|
|
718
|
+
* # Errors
|
|
719
|
+
*
|
|
720
|
+
* Returns an error if either solid handle is invalid or the operation
|
|
721
|
+
* produces an empty or non-manifold result.
|
|
722
|
+
*/
|
|
723
|
+
fuseWithEvolution(a: number, b: number): any;
|
|
724
|
+
/**
|
|
725
|
+
* Fuse (union) two solids into one.
|
|
726
|
+
*
|
|
727
|
+
* Returns a new solid handle (`u32`).
|
|
728
|
+
*
|
|
729
|
+
* # Errors
|
|
730
|
+
*
|
|
731
|
+
* Returns an error if either solid handle is invalid or the operation
|
|
732
|
+
* produces an empty or non-manifold result.
|
|
733
|
+
*/
|
|
734
|
+
fuse(a: number, b: number): number;
|
|
735
|
+
/**
|
|
736
|
+
* Get the analytic surface parameters of a face.
|
|
737
|
+
*
|
|
738
|
+
* Returns a JSON string with surface-type-specific parameters.
|
|
739
|
+
*/
|
|
740
|
+
getAnalyticSurfaceParams(face: number): string;
|
|
741
|
+
/**
|
|
742
|
+
* Get the solid handles within a compound.
|
|
743
|
+
*
|
|
744
|
+
* Returns an array of solid handles (`u32[]`).
|
|
745
|
+
*
|
|
746
|
+
* # Errors
|
|
747
|
+
*
|
|
748
|
+
* Returns an error if the compound handle is invalid.
|
|
749
|
+
*/
|
|
750
|
+
getCompoundSolids(compound: number): Uint32Array;
|
|
751
|
+
/**
|
|
752
|
+
* Get the parameter domain of an edge curve.
|
|
753
|
+
*
|
|
754
|
+
* Returns `[t_start, t_end]`.
|
|
755
|
+
* For line edges: `[0.0, length]`.
|
|
756
|
+
* For NURBS edges: knot domain.
|
|
757
|
+
*/
|
|
758
|
+
getEdgeCurveParameters(edge: number): Float64Array;
|
|
759
|
+
/**
|
|
760
|
+
* Get the curve type of an edge.
|
|
761
|
+
*
|
|
762
|
+
* Returns `"LINE"`, `"BSPLINE_CURVE"`, `"CIRCLE"`, or `"ELLIPSE"`.
|
|
763
|
+
*
|
|
764
|
+
* For NURBS curves that exactly represent analytic curves, this
|
|
765
|
+
* returns the underlying analytic type (e.g. `"CIRCLE"` for a
|
|
766
|
+
* rational NURBS circle).
|
|
767
|
+
*/
|
|
768
|
+
getEdgeCurveType(edge: number): string;
|
|
769
|
+
/**
|
|
770
|
+
* Build an edge's NURBS curve data for JS consumption.
|
|
771
|
+
*
|
|
772
|
+
* Returns `null` for line edges, or a JSON string with
|
|
773
|
+
* `{degree, knots, controlPoints, weights}` for NURBS edges.
|
|
774
|
+
*/
|
|
775
|
+
getEdgeNurbsData(edge: number): any;
|
|
776
|
+
/**
|
|
777
|
+
* Get the vertex *handles* (not positions) of an edge.
|
|
778
|
+
*
|
|
779
|
+
* Returns `[start_vertex_handle, end_vertex_handle]`.
|
|
780
|
+
*
|
|
781
|
+
* # Errors
|
|
782
|
+
*
|
|
783
|
+
* Returns an error if the edge handle is invalid.
|
|
784
|
+
*/
|
|
785
|
+
getEdgeVertexHandles(edge: number): Uint32Array;
|
|
786
|
+
/**
|
|
787
|
+
* Get the vertex positions of an edge.
|
|
788
|
+
*
|
|
789
|
+
* Returns `[start_x, start_y, start_z, end_x, end_y, end_z]`.
|
|
790
|
+
*
|
|
791
|
+
* # Errors
|
|
792
|
+
*
|
|
793
|
+
* Returns an error if the edge handle is invalid.
|
|
794
|
+
*/
|
|
795
|
+
getEdgeVertices(edge: number): Float64Array;
|
|
796
|
+
/**
|
|
797
|
+
* Get entity counts of a solid: `[faces, edges, vertices]`.
|
|
798
|
+
*
|
|
799
|
+
* # Errors
|
|
800
|
+
*
|
|
801
|
+
* Returns an error if the solid handle is invalid.
|
|
802
|
+
*/
|
|
803
|
+
getEntityCounts(solid: number): Uint32Array;
|
|
804
|
+
/**
|
|
805
|
+
* Get the edge handles of a face.
|
|
806
|
+
*
|
|
807
|
+
* Returns an array of edge handles (`u32[]`).
|
|
808
|
+
*/
|
|
809
|
+
getFaceEdges(face: number): Uint32Array;
|
|
810
|
+
/**
|
|
811
|
+
* Get the face normal of a planar face.
|
|
812
|
+
*
|
|
813
|
+
* Returns `[nx, ny, nz]`.
|
|
814
|
+
*
|
|
815
|
+
* # Errors
|
|
816
|
+
*
|
|
817
|
+
* Returns an error if the face is invalid or NURBS.
|
|
818
|
+
*/
|
|
819
|
+
getFaceNormal(face: number): Float64Array;
|
|
820
|
+
/**
|
|
821
|
+
* Get the outer wire handle of a face.
|
|
822
|
+
*
|
|
823
|
+
* Returns a wire handle (`u32`).
|
|
824
|
+
*/
|
|
825
|
+
getFaceOuterWire(face: number): number;
|
|
826
|
+
/**
|
|
827
|
+
* Get the vertex handles of a face.
|
|
828
|
+
*
|
|
829
|
+
* Returns an array of vertex handles (`u32[]`).
|
|
830
|
+
*/
|
|
831
|
+
getFaceVertices(face: number): Uint32Array;
|
|
832
|
+
/**
|
|
833
|
+
* Get all wires of a face (outer wire first, then inner/hole wires).
|
|
834
|
+
*
|
|
835
|
+
* # Errors
|
|
836
|
+
* Returns an error if the face handle is invalid.
|
|
837
|
+
*/
|
|
838
|
+
getFaceWires(face: number): Uint32Array;
|
|
839
|
+
/**
|
|
840
|
+
* Read-only canonical NURBS data for the curve underlying an edge.
|
|
841
|
+
*
|
|
842
|
+
* Analytic curves (line, circle, ellipse) are converted to their exact
|
|
843
|
+
* NURBS form. Returns a JSON string with `degree`, `controlPoints`,
|
|
844
|
+
* `weights`, the flat `knots` vector, compressed `distinctKnots` /
|
|
845
|
+
* `multiplicities`, `rational`, `closed` / `periodic`, and `domain`.
|
|
846
|
+
*/
|
|
847
|
+
getNurbsCurveData(edge: number): string;
|
|
848
|
+
/**
|
|
849
|
+
* Type-gated read-only B-Spline/NURBS surface data for a face.
|
|
850
|
+
*
|
|
851
|
+
* Unlike `getNurbsSurfaceData`, this never converts analytic surfaces:
|
|
852
|
+
* faces backed by a plane, cylinder, cone, sphere, or torus return the
|
|
853
|
+
* JSON literal `null`. Only intrinsically free-form (B-Spline/NURBS) faces
|
|
854
|
+
* yield a record with `degreeU`/`degreeV`, `nbPolesU`/`nbPolesV`, the
|
|
855
|
+
* row-major `poles` grid (u-major, v-minor) with the matching `weights`
|
|
856
|
+
* grid, distinct `knotsU`/`knotsV` paired with `multiplicitiesU`/
|
|
857
|
+
* `multiplicitiesV`, `isPeriodicU`/`isPeriodicV`, and `isRational`.
|
|
858
|
+
*/
|
|
859
|
+
getNurbsSurfaceDataParity(face: number): string;
|
|
860
|
+
/**
|
|
861
|
+
* Read-only canonical NURBS data for the surface underlying a face.
|
|
862
|
+
*
|
|
863
|
+
* Analytic surfaces are converted to NURBS (planes/cylinders exact;
|
|
864
|
+
* cones/spheres/tori via the exact rational forms). Returns a JSON
|
|
865
|
+
* string with `degreeU`/`degreeV`, the row-major `controlPoints` grid,
|
|
866
|
+
* the matching `weights` grid, flat `knotsU`/`knotsV`, compressed
|
|
867
|
+
* distinct-knots/multiplicities per direction, `rational`,
|
|
868
|
+
* `periodicU`/`periodicV`, and `domainU`/`domainV`.
|
|
869
|
+
*/
|
|
870
|
+
getNurbsSurfaceData(face: number): string;
|
|
871
|
+
/**
|
|
872
|
+
* Get the orientation of a shape.
|
|
873
|
+
*
|
|
874
|
+
* Returns `"forward"` for all faces (brepkit faces don't have an
|
|
875
|
+
* independent orientation flag; the normal direction is canonical).
|
|
876
|
+
*/
|
|
877
|
+
getShapeOrientation(_id: number): string;
|
|
878
|
+
/**
|
|
879
|
+
* Get the face handles of a shell.
|
|
880
|
+
*
|
|
881
|
+
* Returns an array of face handles (`u32[]`).
|
|
882
|
+
*
|
|
883
|
+
* # Errors
|
|
884
|
+
*
|
|
885
|
+
* Returns an error if the shell handle is invalid.
|
|
886
|
+
*/
|
|
887
|
+
getShellFaces(shell: number): Uint32Array;
|
|
888
|
+
/**
|
|
889
|
+
* Get all edge handles of a solid.
|
|
890
|
+
*
|
|
891
|
+
* Returns an array of unique edge handles (`u32[]`).
|
|
892
|
+
*
|
|
893
|
+
* # Errors
|
|
894
|
+
*
|
|
895
|
+
* Returns an error if the solid handle is invalid.
|
|
896
|
+
*/
|
|
897
|
+
getSolidEdges(solid: number): Uint32Array;
|
|
898
|
+
/**
|
|
899
|
+
* Get all face handles of a solid.
|
|
900
|
+
*
|
|
901
|
+
* Returns an array of face handles (`u32[]`).
|
|
902
|
+
*
|
|
903
|
+
* # Errors
|
|
904
|
+
*
|
|
905
|
+
* Returns an error if the solid handle is invalid.
|
|
906
|
+
*/
|
|
907
|
+
getSolidFaces(solid: number): Uint32Array;
|
|
908
|
+
/**
|
|
909
|
+
* Get all shell handles of a solid.
|
|
910
|
+
*
|
|
911
|
+
* Returns the outer shell first, followed by any inner void shells
|
|
912
|
+
* (cavities produced by `shell`/hollow operations or boolean cuts).
|
|
913
|
+
* A simple solid such as a box reports exactly one shell.
|
|
914
|
+
*
|
|
915
|
+
* # Errors
|
|
916
|
+
*
|
|
917
|
+
* Returns an error if the solid handle is invalid.
|
|
918
|
+
*/
|
|
919
|
+
getSolidShells(solid: number): Uint32Array;
|
|
920
|
+
/**
|
|
921
|
+
* Get all vertex handles of a solid.
|
|
922
|
+
*
|
|
923
|
+
* Returns an array of unique vertex handles (`u32[]`).
|
|
924
|
+
*
|
|
925
|
+
* # Errors
|
|
926
|
+
*
|
|
927
|
+
* Returns an error if the solid handle is invalid.
|
|
928
|
+
*/
|
|
929
|
+
getSolidVertices(solid: number): Uint32Array;
|
|
930
|
+
/**
|
|
931
|
+
* Get the UV parameter domain of a face's surface.
|
|
932
|
+
*
|
|
933
|
+
* Returns `[u_min, u_max, v_min, v_max]`.
|
|
934
|
+
*/
|
|
935
|
+
getSurfaceDomain(face: number): Float64Array;
|
|
936
|
+
/**
|
|
937
|
+
* Get the surface type of a face.
|
|
938
|
+
*
|
|
939
|
+
* Returns one of: `"plane"`, `"cylinder"`, `"cone"`, `"sphere"`,
|
|
940
|
+
* `"torus"`, `"bspline"`.
|
|
941
|
+
*
|
|
942
|
+
* For NURBS surfaces that exactly represent analytic shapes, this
|
|
943
|
+
* returns the underlying analytic type (e.g. `"sphere"` for a NURBS
|
|
944
|
+
* sphere patch).
|
|
945
|
+
*/
|
|
946
|
+
getSurfaceType(face: number): string;
|
|
947
|
+
/**
|
|
948
|
+
* Get the position of a vertex.
|
|
949
|
+
*
|
|
950
|
+
* Returns `[x, y, z]`.
|
|
951
|
+
*
|
|
952
|
+
* # Errors
|
|
953
|
+
*
|
|
954
|
+
* Returns an error if the vertex handle is invalid.
|
|
955
|
+
*/
|
|
956
|
+
getVertexPosition(vertex: number): Float64Array;
|
|
957
|
+
/**
|
|
958
|
+
* Get the edge handles of a wire.
|
|
959
|
+
*
|
|
960
|
+
* Returns an array of unique edge handles (`u32[]`).
|
|
961
|
+
*
|
|
962
|
+
* # Errors
|
|
963
|
+
*
|
|
964
|
+
* Returns an error if the wire handle is invalid.
|
|
965
|
+
*/
|
|
966
|
+
getWireEdges(wire: number): Uint32Array;
|
|
967
|
+
/**
|
|
968
|
+
* Create a 2D grid pattern of a solid.
|
|
969
|
+
*
|
|
970
|
+
* Produces `count_x × count_y` copies arranged in a rectangular grid.
|
|
971
|
+
*/
|
|
972
|
+
gridPattern(solid: number, dir_x_x: number, dir_x_y: number, dir_x_z: number, dir_y_x: number, dir_y_y: number, dir_y_z: number, spacing_x: number, spacing_y: number, count_x: number, count_y: number): number;
|
|
973
|
+
/**
|
|
974
|
+
* Guided (two-rail) sweep: sweep `face` along a spine, orienting the
|
|
975
|
+
* profile so its up-vector tracks an auxiliary spine.
|
|
976
|
+
*
|
|
977
|
+
* The spine and auxiliary spine are each passed as raw NURBS data
|
|
978
|
+
* (`degree`, `knots`, flat `control_points`, `weights`). Returns a solid
|
|
979
|
+
* handle (`u32`).
|
|
980
|
+
*
|
|
981
|
+
* # Errors
|
|
982
|
+
*
|
|
983
|
+
* Returns an error for a non-finite or malformed curve, a non-planar
|
|
984
|
+
* profile, or a degenerate path.
|
|
985
|
+
*/
|
|
986
|
+
guidedSweep(face: number, spine_degree: number, spine_knots: Float64Array, spine_control_points: Float64Array, spine_weights: Float64Array, aux_degree: number, aux_knots: Float64Array, aux_control_points: Float64Array, aux_weights: Float64Array): number;
|
|
987
|
+
/**
|
|
988
|
+
* Heal a solid topology.
|
|
989
|
+
*
|
|
990
|
+
* Returns the number of issues fixed.
|
|
991
|
+
*/
|
|
992
|
+
healSolid(solid: number): number;
|
|
993
|
+
/**
|
|
994
|
+
* Create a helical sweep of a profile face.
|
|
995
|
+
*
|
|
996
|
+
* Sweeps the profile along a helix defined by axis, radius, pitch,
|
|
997
|
+
* and number of turns. Used for generating thread geometry.
|
|
998
|
+
*
|
|
999
|
+
* # Errors
|
|
1000
|
+
*
|
|
1001
|
+
* Returns an error if parameters are invalid or the sweep fails.
|
|
1002
|
+
*/
|
|
1003
|
+
helicalSweep(profile: number, axis_origin_x: number, axis_origin_y: number, axis_origin_z: number, axis_dir_x: number, axis_dir_y: number, axis_dir_z: number, radius: number, pitch: number, turns: number): number;
|
|
1004
|
+
/**
|
|
1005
|
+
* Import a 3MF file and return solid handles.
|
|
1006
|
+
*
|
|
1007
|
+
* Returns handles for each object found in the 3MF archive.
|
|
1008
|
+
*
|
|
1009
|
+
* # Errors
|
|
1010
|
+
*
|
|
1011
|
+
* Returns an error if the 3MF data is malformed.
|
|
1012
|
+
*/
|
|
1013
|
+
import3mf(data: Uint8Array): Uint32Array;
|
|
1014
|
+
/**
|
|
1015
|
+
* Import a GLB (glTF binary) file and return a solid handle.
|
|
1016
|
+
*
|
|
1017
|
+
* # Errors
|
|
1018
|
+
*
|
|
1019
|
+
* Returns an error if the file is malformed or mesh import fails.
|
|
1020
|
+
*/
|
|
1021
|
+
importGlb(data: Uint8Array): number;
|
|
1022
|
+
/**
|
|
1023
|
+
* Import an IGES file and return solid handles.
|
|
1024
|
+
*
|
|
1025
|
+
* # Errors
|
|
1026
|
+
*
|
|
1027
|
+
* Returns an error if the IGES data is malformed.
|
|
1028
|
+
*/
|
|
1029
|
+
importIges(data: Uint8Array): Uint32Array;
|
|
1030
|
+
/**
|
|
1031
|
+
* Import a triangle mesh from flat vertex/index arrays.
|
|
1032
|
+
*
|
|
1033
|
+
* `positions` is a flat `[x0,y0,z0, x1,y1,z1, ...]` array.
|
|
1034
|
+
* `indices` is a flat `[i0,i1,i2, i3,i4,i5, ...]` array of triangle
|
|
1035
|
+
* vertex indices. Returns a solid handle.
|
|
1036
|
+
*
|
|
1037
|
+
* # Errors
|
|
1038
|
+
*
|
|
1039
|
+
* Returns an error if the arrays are malformed or mesh import fails.
|
|
1040
|
+
*/
|
|
1041
|
+
importIndexedMesh(positions: Float64Array, indices: Uint32Array): number;
|
|
1042
|
+
/**
|
|
1043
|
+
* Import an OBJ file and return a solid handle.
|
|
1044
|
+
*
|
|
1045
|
+
* # Errors
|
|
1046
|
+
*
|
|
1047
|
+
* Returns an error if the file is malformed or mesh import fails.
|
|
1048
|
+
*/
|
|
1049
|
+
importObj(data: Uint8Array): number;
|
|
1050
|
+
/**
|
|
1051
|
+
* Import a STEP file and return solid handles.
|
|
1052
|
+
*
|
|
1053
|
+
* Returns handles for each solid found in the STEP file.
|
|
1054
|
+
*
|
|
1055
|
+
* # Errors
|
|
1056
|
+
*
|
|
1057
|
+
* Returns an error if the STEP data is malformed.
|
|
1058
|
+
*/
|
|
1059
|
+
importStep(data: Uint8Array): Uint32Array;
|
|
1060
|
+
/**
|
|
1061
|
+
* Import an STL file (binary or ASCII) and return a solid handle.
|
|
1062
|
+
*
|
|
1063
|
+
* The mesh triangles are converted to planar B-Rep faces with
|
|
1064
|
+
* vertex merging.
|
|
1065
|
+
*
|
|
1066
|
+
* # Errors
|
|
1067
|
+
*
|
|
1068
|
+
* Returns an error if the STL data is malformed or empty.
|
|
1069
|
+
*/
|
|
1070
|
+
importStl(data: Uint8Array): number;
|
|
1071
|
+
/**
|
|
1072
|
+
* Interpolate a NURBS curve through points and create an edge.
|
|
1073
|
+
*
|
|
1074
|
+
* Uses chord-length parameterization with the given degree.
|
|
1075
|
+
* Returns an edge handle (`u32`).
|
|
1076
|
+
*/
|
|
1077
|
+
interpolatePoints(coords: Float64Array, degree: number): number;
|
|
1078
|
+
/**
|
|
1079
|
+
* Interpolate a grid of points into a NURBS surface.
|
|
1080
|
+
*
|
|
1081
|
+
* `coords` is a flat array `[x,y,z, ...]` of `rows * cols` points.
|
|
1082
|
+
* Returns a face handle.
|
|
1083
|
+
*/
|
|
1084
|
+
interpolateSurface(coords: Float64Array, rows: number, cols: number, degree_u: number, degree_v: number): number;
|
|
1085
|
+
/**
|
|
1086
|
+
* Compute the boolean intersection of two 2D polygons.
|
|
1087
|
+
*
|
|
1088
|
+
* Both polygons are flat arrays `[x,y, x,y, ...]`.
|
|
1089
|
+
* Returns a flat array of the intersection polygon coordinates,
|
|
1090
|
+
* or an empty array if they don't intersect.
|
|
1091
|
+
*
|
|
1092
|
+
* Uses the Sutherland-Hodgman algorithm (convex clipper).
|
|
1093
|
+
*/
|
|
1094
|
+
intersectPolygons2d(coords_a: Float64Array, coords_b: Float64Array): Float64Array;
|
|
1095
|
+
/**
|
|
1096
|
+
* Intersect two solids and return evolution tracking data.
|
|
1097
|
+
*
|
|
1098
|
+
* Returns a JSON string: `{"solid": <u32>, "evolution": {...}}`.
|
|
1099
|
+
*
|
|
1100
|
+
* # Errors
|
|
1101
|
+
*
|
|
1102
|
+
* Returns an error if either solid handle is invalid or the operation
|
|
1103
|
+
* produces an empty result.
|
|
1104
|
+
*/
|
|
1105
|
+
intersectWithEvolution(a: number, b: number): any;
|
|
1106
|
+
/**
|
|
1107
|
+
* Intersect two solids, keeping only their common volume.
|
|
1108
|
+
*
|
|
1109
|
+
* Returns a new solid handle (`u32`).
|
|
1110
|
+
*
|
|
1111
|
+
* # Errors
|
|
1112
|
+
*
|
|
1113
|
+
* Returns an error if either solid handle is invalid or the operation
|
|
1114
|
+
* produces an empty result.
|
|
1115
|
+
*/
|
|
1116
|
+
intersect(a: number, b: number): number;
|
|
1117
|
+
/**
|
|
1118
|
+
* Check if an edge is forward-oriented in a given wire.
|
|
1119
|
+
*
|
|
1120
|
+
* Returns `true` if the edge is forward in the wire, `false` if reversed.
|
|
1121
|
+
*/
|
|
1122
|
+
isEdgeForwardInWire(edge: number, wire: number): boolean;
|
|
1123
|
+
/**
|
|
1124
|
+
* Check whether a wire is closed (last edge connects back to first).
|
|
1125
|
+
*/
|
|
1126
|
+
isWireClosed(wire: number): boolean;
|
|
1127
|
+
/**
|
|
1128
|
+
* Lift a 2D curve onto a 3D plane, producing an edge.
|
|
1129
|
+
*
|
|
1130
|
+
* `curve_type`: 0 = Line, 1 = Circle, 2 = Ellipse, 3 = NURBS.
|
|
1131
|
+
* `curve_params` layout varies by type (see docs).
|
|
1132
|
+
* The plane is defined by an origin, x-axis, and normal.
|
|
1133
|
+
* `t_start`/`t_end` specify the parameter range on the 2D curve.
|
|
1134
|
+
*
|
|
1135
|
+
* Returns an edge handle (`u32`).
|
|
1136
|
+
*/
|
|
1137
|
+
liftCurve2dToPlane(curve_type: number, curve_params: Float64Array, origin_x: number, origin_y: number, origin_z: number, x_axis_x: number, x_axis_y: number, x_axis_z: number, normal_x: number, normal_y: number, normal_z: number, t_start: number, t_end: number): number;
|
|
1138
|
+
/**
|
|
1139
|
+
* Create a linear pattern of a solid.
|
|
1140
|
+
*
|
|
1141
|
+
* Returns a compound handle containing all copies.
|
|
1142
|
+
*
|
|
1143
|
+
* # Errors
|
|
1144
|
+
*
|
|
1145
|
+
* Returns an error if inputs are invalid.
|
|
1146
|
+
*/
|
|
1147
|
+
linearPattern(solid: number, dx: number, dy: number, dz: number, spacing: number, count: number): number;
|
|
1148
|
+
/**
|
|
1149
|
+
* Loft profiles with smooth NURBS interpolation.
|
|
1150
|
+
*
|
|
1151
|
+
* Like `loft()`, but produces smooth NURBS side surfaces for 3+
|
|
1152
|
+
* profiles instead of piecewise-planar quads. The surfaces
|
|
1153
|
+
* interpolate through all intermediate profiles with C1+ continuity.
|
|
1154
|
+
*
|
|
1155
|
+
* Returns a solid handle (`u32`).
|
|
1156
|
+
*
|
|
1157
|
+
* # Errors
|
|
1158
|
+
*
|
|
1159
|
+
* Returns an error if fewer than 2 profiles are given, profiles have
|
|
1160
|
+
* different vertex counts, or surface fitting fails.
|
|
1161
|
+
*/
|
|
1162
|
+
loftSmooth(faces: Uint32Array): number;
|
|
1163
|
+
/**
|
|
1164
|
+
* Loft profiles with options for start/end points and ruled mode.
|
|
1165
|
+
*
|
|
1166
|
+
* `options` is a JSON string with optional fields:
|
|
1167
|
+
* - `startPoint: [x, y, z]` — apex point before first profile
|
|
1168
|
+
* - `endPoint: [x, y, z]` — apex point after last profile
|
|
1169
|
+
* - `ruled: bool` — true for ruled (linear) surfaces (default), false for smooth
|
|
1170
|
+
*/
|
|
1171
|
+
loftWithOptions(faces: Uint32Array, options: string): number;
|
|
1172
|
+
/**
|
|
1173
|
+
* Loft two or more profile faces into a solid.
|
|
1174
|
+
*
|
|
1175
|
+
* Takes an array of face handles. Returns a solid handle (`u32`).
|
|
1176
|
+
*
|
|
1177
|
+
* # Errors
|
|
1178
|
+
*
|
|
1179
|
+
* Returns an error if fewer than 2 faces or profiles have
|
|
1180
|
+
* different vertex counts.
|
|
1181
|
+
*/
|
|
1182
|
+
loft(faces: Uint32Array): number;
|
|
1183
|
+
/**
|
|
1184
|
+
* Create a box solid with the given dimensions, centered at the origin.
|
|
1185
|
+
*
|
|
1186
|
+
* Returns a solid handle (`u32`).
|
|
1187
|
+
*
|
|
1188
|
+
* # Errors
|
|
1189
|
+
*
|
|
1190
|
+
* Returns an error if any dimension is non-positive or non-finite.
|
|
1191
|
+
*/
|
|
1192
|
+
makeBox(dx: number, dy: number, dz: number): number;
|
|
1193
|
+
/**
|
|
1194
|
+
* Create a circular arc edge between two points.
|
|
1195
|
+
*
|
|
1196
|
+
* The arc lies on a circle with the given center, normal axis, and
|
|
1197
|
+
* radius derived from `|start − center|`. The arc goes from start
|
|
1198
|
+
* to end counter-clockwise when viewed along the normal.
|
|
1199
|
+
*
|
|
1200
|
+
* Returns an edge handle (`u32`).
|
|
1201
|
+
*/
|
|
1202
|
+
makeCircleArc3d(start_x: number, start_y: number, start_z: number, end_x: number, end_y: number, end_z: number, center_x: number, center_y: number, center_z: number, axis_x: number, axis_y: number, axis_z: number): number;
|
|
1203
|
+
/**
|
|
1204
|
+
* Create a closed circular edge with a caller-supplied reference x-direction.
|
|
1205
|
+
*
|
|
1206
|
+
* Like [`makeCircleEdge`](Self::make_circle_edge), but `ref_dir = (rx, ry, rz)`
|
|
1207
|
+
* is projected onto the plane perpendicular to the normal to fix the
|
|
1208
|
+
* circle's `u_axis` — which controls the seam vertex position at
|
|
1209
|
+
* `circle.evaluate(0.0)`. Use when downstream code (PCurve computation,
|
|
1210
|
+
* extrusion frame) depends on a specific seam placement.
|
|
1211
|
+
*
|
|
1212
|
+
* `ref_dir` must be non-zero (rejected at this boundary) and ideally
|
|
1213
|
+
* not parallel to the normal — `Frame3::from_normal_and_ref` falls
|
|
1214
|
+
* back to an arbitrary perpendicular when the projection of `ref_dir`
|
|
1215
|
+
* onto the plane is degenerate, defeating the purpose of this call.
|
|
1216
|
+
*
|
|
1217
|
+
* Returns an edge handle (`u32`).
|
|
1218
|
+
*
|
|
1219
|
+
* # Errors
|
|
1220
|
+
*
|
|
1221
|
+
* Returns an error if any coordinate is NaN/infinite, `radius` is
|
|
1222
|
+
* non-positive, or the normal vector or `ref_dir` is zero.
|
|
1223
|
+
*/
|
|
1224
|
+
makeCircleEdgeWithRef(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, radius: number, rx: number, ry: number, rz: number): number;
|
|
1225
|
+
/**
|
|
1226
|
+
* Create a closed circular edge with true `Circle` curve geometry.
|
|
1227
|
+
*
|
|
1228
|
+
* Unlike `makeCircle` (which returns a polygon face approximation),
|
|
1229
|
+
* this creates a single closed edge with an [`EdgeCurve::Circle`]
|
|
1230
|
+
* backing curve and parameter domain `[0, 2π]`. The start and end
|
|
1231
|
+
* vertex are shared at the seam point `circle.evaluate(0.0)`.
|
|
1232
|
+
*
|
|
1233
|
+
* Returns an edge handle (`u32`).
|
|
1234
|
+
*
|
|
1235
|
+
* # Errors
|
|
1236
|
+
*
|
|
1237
|
+
* Returns an error if any coordinate is NaN/infinite, `radius` is
|
|
1238
|
+
* non-positive, or the normal vector is zero.
|
|
1239
|
+
*/
|
|
1240
|
+
makeCircleEdge(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, radius: number): number;
|
|
1241
|
+
/**
|
|
1242
|
+
* Create a circular face on the XY plane (using NURBS arcs).
|
|
1243
|
+
*
|
|
1244
|
+
* Returns a face handle.
|
|
1245
|
+
*/
|
|
1246
|
+
makeCircleFace(radius: number, segments: number): number;
|
|
1247
|
+
/**
|
|
1248
|
+
* Create a circular polygon approximation on the XY plane.
|
|
1249
|
+
*
|
|
1250
|
+
* The circle is centered at the origin with the given `radius`,
|
|
1251
|
+
* approximated by `segments` straight edges.
|
|
1252
|
+
* Returns a face handle (`u32`).
|
|
1253
|
+
*
|
|
1254
|
+
* # Errors
|
|
1255
|
+
*
|
|
1256
|
+
* Returns an error if fewer than 3 segments are specified.
|
|
1257
|
+
*/
|
|
1258
|
+
makeCircle(radius: number, segments: number): number;
|
|
1259
|
+
/**
|
|
1260
|
+
* Create a compound from multiple solid handles.
|
|
1261
|
+
*
|
|
1262
|
+
* Returns a compound handle (stored as `u32`).
|
|
1263
|
+
*/
|
|
1264
|
+
makeCompound(solid_handles: Uint32Array): number;
|
|
1265
|
+
/**
|
|
1266
|
+
* Create a cone or frustum solid centered at the origin, axis along +Z.
|
|
1267
|
+
*
|
|
1268
|
+
* Returns a solid handle (`u32`).
|
|
1269
|
+
*
|
|
1270
|
+
* # Errors
|
|
1271
|
+
*
|
|
1272
|
+
* Returns an error if height is non-positive or both radii are zero.
|
|
1273
|
+
*/
|
|
1274
|
+
makeCone(bottom_radius: number, top_radius: number, height: number): number;
|
|
1275
|
+
/**
|
|
1276
|
+
* Create a cylinder solid centered at the origin, axis along +Z.
|
|
1277
|
+
*
|
|
1278
|
+
* Returns a solid handle (`u32`).
|
|
1279
|
+
*
|
|
1280
|
+
* # Errors
|
|
1281
|
+
*
|
|
1282
|
+
* Returns an error if radius or height is non-positive.
|
|
1283
|
+
*/
|
|
1284
|
+
makeCylinder(radius: number, height: number): number;
|
|
1285
|
+
/**
|
|
1286
|
+
* Create a trimmed elliptical arc edge.
|
|
1287
|
+
*
|
|
1288
|
+
* The ellipse is defined by `center`, `axis` (plane normal), the
|
|
1289
|
+
* `ref` major-axis direction, and `semi_major`/`semi_minor`. The
|
|
1290
|
+
* `start`/`end` points trim it to the CCW arc between them (they must
|
|
1291
|
+
* lie on the ellipse). Produces an `EdgeCurve::Ellipse` edge — not a
|
|
1292
|
+
* NURBS approximation — so it reports CIRCLE/ELLIPSE-class geometry.
|
|
1293
|
+
*
|
|
1294
|
+
* Returns an edge handle (`u32`).
|
|
1295
|
+
*
|
|
1296
|
+
* # Errors
|
|
1297
|
+
*
|
|
1298
|
+
* Returns an error if any coordinate is NaN/infinite, a semi-axis is
|
|
1299
|
+
* non-positive, `semi_minor` exceeds `semi_major`, or `axis`/`ref` is
|
|
1300
|
+
* a zero vector.
|
|
1301
|
+
*/
|
|
1302
|
+
makeEllipseArc3d(start_x: number, start_y: number, start_z: number, end_x: number, end_y: number, end_z: number, center_x: number, center_y: number, center_z: number, axis_x: number, axis_y: number, axis_z: number, ref_x: number, ref_y: number, ref_z: number, semi_major: number, semi_minor: number): number;
|
|
1303
|
+
/**
|
|
1304
|
+
* Create a closed elliptical edge with a caller-supplied reference major-axis.
|
|
1305
|
+
*
|
|
1306
|
+
* Like [`makeEllipseEdge`](Self::make_ellipse_edge), but `ref_dir = (rx, ry, rz)`
|
|
1307
|
+
* is projected onto the plane perpendicular to the normal to fix the
|
|
1308
|
+
* ellipse's major-axis direction (`u_axis`, carrying `semi_major`).
|
|
1309
|
+
* Use this when the caller has an intended major-axis orientation —
|
|
1310
|
+
* otherwise the default-frame variant chooses an arbitrary
|
|
1311
|
+
* perpendicular, which can cause adapters to fall back to NURBS
|
|
1312
|
+
* approximations to preserve their requested orientation.
|
|
1313
|
+
*
|
|
1314
|
+
* `ref_dir` must be non-zero (rejected at this boundary) and ideally
|
|
1315
|
+
* not parallel to the normal — `Frame3::from_normal_and_ref` falls
|
|
1316
|
+
* back to an arbitrary perpendicular when the projection of `ref_dir`
|
|
1317
|
+
* onto the plane is degenerate, defeating the purpose of this call.
|
|
1318
|
+
*
|
|
1319
|
+
* Returns an edge handle (`u32`).
|
|
1320
|
+
*
|
|
1321
|
+
* # Errors
|
|
1322
|
+
*
|
|
1323
|
+
* Returns an error if any coordinate is NaN/infinite, either
|
|
1324
|
+
* semi-axis is non-positive, `semi_minor` exceeds `semi_major`, or
|
|
1325
|
+
* the normal vector or `ref_dir` is zero.
|
|
1326
|
+
*/
|
|
1327
|
+
makeEllipseEdgeWithRef(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, semi_major: number, semi_minor: number, rx: number, ry: number, rz: number): number;
|
|
1328
|
+
/**
|
|
1329
|
+
* Create a closed elliptical edge with true `Ellipse` curve geometry.
|
|
1330
|
+
*
|
|
1331
|
+
* Creates a single closed edge with an [`EdgeCurve::Ellipse`] backing
|
|
1332
|
+
* curve and parameter domain `[0, 2π]`. The start and end vertex are
|
|
1333
|
+
* shared at the seam point `ellipse.evaluate(0.0)`.
|
|
1334
|
+
*
|
|
1335
|
+
* Returns an edge handle (`u32`).
|
|
1336
|
+
*
|
|
1337
|
+
* # Errors
|
|
1338
|
+
*
|
|
1339
|
+
* Returns an error if any coordinate is NaN/infinite, either
|
|
1340
|
+
* semi-axis is non-positive, `semi_minor` exceeds `semi_major`, or
|
|
1341
|
+
* the normal vector is zero.
|
|
1342
|
+
*/
|
|
1343
|
+
makeEllipseEdge(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, semi_major: number, semi_minor: number): number;
|
|
1344
|
+
/**
|
|
1345
|
+
* Create an ellipsoid solid centered at the origin.
|
|
1346
|
+
*
|
|
1347
|
+
* Built by creating a unit sphere and scaling it by `(rx, ry, rz)`.
|
|
1348
|
+
*
|
|
1349
|
+
* # Errors
|
|
1350
|
+
*
|
|
1351
|
+
* Returns an error if any radius is non-positive.
|
|
1352
|
+
*/
|
|
1353
|
+
makeEllipsoid(rx: number, ry: number, rz: number): number;
|
|
1354
|
+
/**
|
|
1355
|
+
* Create a face from a wire.
|
|
1356
|
+
*
|
|
1357
|
+
* Samples the wire's edges and attaches a planar surface only if the
|
|
1358
|
+
* geometry lies within tolerance of a single plane; otherwise a
|
|
1359
|
+
* non-planar surface is attached, so `getSurfaceType` never reports
|
|
1360
|
+
* `"plane"` for a non-coplanar wire.
|
|
1361
|
+
*
|
|
1362
|
+
* Returns a face handle (`u32`).
|
|
1363
|
+
*/
|
|
1364
|
+
makeFaceFromWire(wire: number): number;
|
|
1365
|
+
/**
|
|
1366
|
+
* Create a straight-line edge between two points.
|
|
1367
|
+
*
|
|
1368
|
+
* Returns an edge handle (`u32`).
|
|
1369
|
+
*/
|
|
1370
|
+
makeLineEdge(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): number;
|
|
1371
|
+
/**
|
|
1372
|
+
* Create a NURBS curve edge.
|
|
1373
|
+
*
|
|
1374
|
+
* Returns an edge handle (`u32`).
|
|
1375
|
+
*/
|
|
1376
|
+
makeNurbsEdge(start_x: number, start_y: number, start_z: number, end_x: number, end_y: number, end_z: number, degree: number, knots: Float64Array, control_points: Float64Array, weights: Float64Array): number;
|
|
1377
|
+
/**
|
|
1378
|
+
* Create a strictly planar face from a wire.
|
|
1379
|
+
*
|
|
1380
|
+
* Fails with a "wire is not planar" error if the wire's geometry does
|
|
1381
|
+
* not lie within tolerance of a single plane. Use this for planar-only
|
|
1382
|
+
* construction intent (probing whether a wire is planar).
|
|
1383
|
+
*
|
|
1384
|
+
* Returns a face handle (`u32`).
|
|
1385
|
+
*/
|
|
1386
|
+
makePlanarFaceFromWire(wire: number): number;
|
|
1387
|
+
/**
|
|
1388
|
+
* Create a closed polygon wire from flat coordinates.
|
|
1389
|
+
*
|
|
1390
|
+
* Returns a wire handle.
|
|
1391
|
+
*/
|
|
1392
|
+
makePolygonWire(coords: Float64Array): number;
|
|
1393
|
+
/**
|
|
1394
|
+
* Create a polygonal face from flat coordinate triples `[x,y,z, ...]`.
|
|
1395
|
+
*
|
|
1396
|
+
* Requires at least 3 points (9 `f64` values).
|
|
1397
|
+
* Returns a face handle (`u32`).
|
|
1398
|
+
*
|
|
1399
|
+
* # Errors
|
|
1400
|
+
*
|
|
1401
|
+
* Returns an error if `coords` length is not a multiple of 3,
|
|
1402
|
+
* fewer than 3 points are provided, or the face normal is degenerate.
|
|
1403
|
+
*/
|
|
1404
|
+
makePolygon(coords: Float64Array): number;
|
|
1405
|
+
/**
|
|
1406
|
+
* Create a rectangular face on the XY plane centered at the origin.
|
|
1407
|
+
*
|
|
1408
|
+
* Returns a face handle (`u32`).
|
|
1409
|
+
*
|
|
1410
|
+
* # Errors
|
|
1411
|
+
*
|
|
1412
|
+
* Returns an error if `width` or `height` is non-positive, NaN,
|
|
1413
|
+
* or infinite, or if the face geometry cannot be constructed.
|
|
1414
|
+
*/
|
|
1415
|
+
makeRectangle(width: number, height: number): number;
|
|
1416
|
+
/**
|
|
1417
|
+
* Create a regular polygon wire on the XY plane.
|
|
1418
|
+
*
|
|
1419
|
+
* Returns a wire handle.
|
|
1420
|
+
*/
|
|
1421
|
+
makeRegularPolygonWire(radius: number, n_sides: number): number;
|
|
1422
|
+
/**
|
|
1423
|
+
* Create a solid from a set of faces by sewing them together.
|
|
1424
|
+
*
|
|
1425
|
+
* Alias for `sewFaces` with a default tolerance. This is the equivalent
|
|
1426
|
+
* of sewing faces into a closed shell and building a solid.
|
|
1427
|
+
*/
|
|
1428
|
+
makeSolid(face_handles: Uint32Array): number;
|
|
1429
|
+
/**
|
|
1430
|
+
* Create a sphere solid centered at the origin.
|
|
1431
|
+
*
|
|
1432
|
+
* Returns a solid handle (`u32`).
|
|
1433
|
+
*
|
|
1434
|
+
* # Errors
|
|
1435
|
+
*
|
|
1436
|
+
* Returns an error if radius is non-positive or segments < 4.
|
|
1437
|
+
*/
|
|
1438
|
+
makeSphere(radius: number, segments: number): number;
|
|
1439
|
+
/**
|
|
1440
|
+
* Create a circular arc edge defined by start point, tangent direction
|
|
1441
|
+
* at start, and end point.
|
|
1442
|
+
*
|
|
1443
|
+
* If the tangent is parallel to the start→end chord (collinear), falls
|
|
1444
|
+
* back to a straight line edge.
|
|
1445
|
+
*
|
|
1446
|
+
* Returns an edge handle (`u32`).
|
|
1447
|
+
*/
|
|
1448
|
+
makeTangentArc3d(start_x: number, start_y: number, start_z: number, tangent_x: number, tangent_y: number, tangent_z: number, end_x: number, end_y: number, end_z: number): number;
|
|
1449
|
+
/**
|
|
1450
|
+
* Create a torus solid centered at the origin in the XY plane.
|
|
1451
|
+
*
|
|
1452
|
+
* Returns a solid handle (`u32`).
|
|
1453
|
+
*
|
|
1454
|
+
* # Errors
|
|
1455
|
+
*
|
|
1456
|
+
* Returns an error if radii are non-positive or minor >= major.
|
|
1457
|
+
*/
|
|
1458
|
+
makeTorus(major_radius: number, minor_radius: number, segments: number): number;
|
|
1459
|
+
/**
|
|
1460
|
+
* Create a vertex at the given position.
|
|
1461
|
+
*
|
|
1462
|
+
* Returns a vertex handle (`u32`).
|
|
1463
|
+
*/
|
|
1464
|
+
makeVertex(x: number, y: number, z: number): number;
|
|
1465
|
+
/**
|
|
1466
|
+
* Create a closed wire from an ordered array of edge handles.
|
|
1467
|
+
*
|
|
1468
|
+
* Returns a wire handle (`u32`).
|
|
1469
|
+
*/
|
|
1470
|
+
makeWire(edge_handles: Uint32Array, closed: boolean): number;
|
|
1471
|
+
/**
|
|
1472
|
+
* Measure curvature of an edge curve at parameter `t`.
|
|
1473
|
+
*
|
|
1474
|
+
* Returns `[curvature, tangent_x, tangent_y, tangent_z, normal_x, normal_y, normal_z]`.
|
|
1475
|
+
* Curvature is 1/radius. For lines, curvature is 0.
|
|
1476
|
+
*/
|
|
1477
|
+
measureCurvatureAtEdge(edge: number, t: number): Float64Array;
|
|
1478
|
+
/**
|
|
1479
|
+
* Measure principal curvatures at (u, v) on a face surface.
|
|
1480
|
+
*
|
|
1481
|
+
* Returns `[k1, k2, d1x, d1y, d1z, d2x, d2y, d2z]` where k1/k2 are
|
|
1482
|
+
* principal curvatures and d1/d2 are the corresponding direction vectors.
|
|
1483
|
+
*/
|
|
1484
|
+
measureCurvatureAtSurface(face: number, u: number, v: number): Float64Array;
|
|
1485
|
+
/**
|
|
1486
|
+
* Merge coincident vertices in a solid.
|
|
1487
|
+
*
|
|
1488
|
+
* Returns the number of vertices merged.
|
|
1489
|
+
*/
|
|
1490
|
+
mergeCoincidentVertices(solid: number, tolerance: number): number;
|
|
1491
|
+
/**
|
|
1492
|
+
* Perform a mesh boolean on raw triangle data.
|
|
1493
|
+
*
|
|
1494
|
+
* Returns a `JsMesh` with the result.
|
|
1495
|
+
*/
|
|
1496
|
+
meshBoolean(positions_a: Float64Array, indices_a: Uint32Array, positions_b: Float64Array, indices_b: Uint32Array, op: string, tolerance: number): JsMesh;
|
|
1497
|
+
/**
|
|
1498
|
+
* Sample ALL edges of a solid (no smooth-edge filtering).
|
|
1499
|
+
*
|
|
1500
|
+
* Same as `meshEdges` but includes edges between co-surface faces.
|
|
1501
|
+
* Useful for debugging topology.
|
|
1502
|
+
*/
|
|
1503
|
+
meshEdgesAll(solid: number, deflection: number, angular_tolerance?: number | null): JsEdgeLines;
|
|
1504
|
+
/**
|
|
1505
|
+
* Sample edges of a solid into polylines for wireframe rendering.
|
|
1506
|
+
*
|
|
1507
|
+
* Returns a `JsEdgeLines` containing flattened positions and per-edge
|
|
1508
|
+
* offset indices. The `deflection` parameter controls sampling density.
|
|
1509
|
+
*
|
|
1510
|
+
* Smooth edges (between faces on the same underlying surface) are
|
|
1511
|
+
* automatically filtered out to reduce wireframe clutter. These edges
|
|
1512
|
+
* arise from boolean face-splitting and don't represent visible creases.
|
|
1513
|
+
*/
|
|
1514
|
+
meshEdges(solid: number, deflection: number, angular_tolerance?: number | null): JsEdgeLines;
|
|
1515
|
+
/**
|
|
1516
|
+
* How many boolean operations have degraded to the mesh (co-refinement)
|
|
1517
|
+
* fallback since this page/tab started.
|
|
1518
|
+
*
|
|
1519
|
+
* A mesh fallback still returns a usable solid, but it destroys every
|
|
1520
|
+
* analytic surface type in the result — planes become triangle soups,
|
|
1521
|
+
* cylinders and tori disappear, and face counts jump by orders of
|
|
1522
|
+
* magnitude. Read this before and after a batch of booleans: a non-zero
|
|
1523
|
+
* delta means at least one operation silently lost precision.
|
|
1524
|
+
*
|
|
1525
|
+
* The counter is process-global (shared by every `BrepKernel` in the
|
|
1526
|
+
* module), so read deltas rather than absolute values.
|
|
1527
|
+
*/
|
|
1528
|
+
meshFallbackCount(): bigint;
|
|
1529
|
+
/**
|
|
1530
|
+
* Convex Minkowski sum of two solids (`A ⊕ B`).
|
|
1531
|
+
*
|
|
1532
|
+
* Returns the convex hull of all pairwise vertex sums — exact for convex
|
|
1533
|
+
* polytopes (boxes, or a tessellated-sphere rolling tool), a convex
|
|
1534
|
+
* over-approximation otherwise. Returns a solid handle (`u32`).
|
|
1535
|
+
*
|
|
1536
|
+
* # Errors
|
|
1537
|
+
*
|
|
1538
|
+
* Returns an error if either handle is invalid, either solid is empty, or
|
|
1539
|
+
* the summed points are degenerate so no hull can be built.
|
|
1540
|
+
*/
|
|
1541
|
+
minkowskiSum(solid_a: number, solid_b: number): number;
|
|
1542
|
+
/**
|
|
1543
|
+
* Mirror a solid across a plane.
|
|
1544
|
+
*
|
|
1545
|
+
* Returns a new solid handle.
|
|
1546
|
+
*
|
|
1547
|
+
* # Errors
|
|
1548
|
+
*
|
|
1549
|
+
* Returns an error if the solid handle is invalid or the normal is zero.
|
|
1550
|
+
*/
|
|
1551
|
+
mirror(solid: number, px: number, py: number, pz: number, nx: number, ny: number, nz: number): number;
|
|
1552
|
+
/**
|
|
1553
|
+
* Sweep through multiple section profiles along a spine, lofting the
|
|
1554
|
+
* rotation-minimizing-frame-placed profiles.
|
|
1555
|
+
*
|
|
1556
|
+
* `face_handles` and `params` are parallel arrays: each planar profile and
|
|
1557
|
+
* its parameter in `[0, 1]` along the spine (given as raw NURBS data).
|
|
1558
|
+
* `ruled` selects ruled (planar bands) vs smooth (NURBS) lofted sides.
|
|
1559
|
+
*
|
|
1560
|
+
* Returns a solid handle (`u32`).
|
|
1561
|
+
*
|
|
1562
|
+
* # Errors
|
|
1563
|
+
*
|
|
1564
|
+
* Returns an error for fewer than two sections, mismatched array lengths, a
|
|
1565
|
+
* non-finite or out-of-range value, a non-planar profile, or loft failure.
|
|
1566
|
+
*/
|
|
1567
|
+
multiSectionSweep(face_handles: Uint32Array, params: Float64Array, spine_degree: number, spine_knots: Float64Array, spine_control_points: Float64Array, spine_weights: Float64Array, ruled: boolean): number;
|
|
1568
|
+
/**
|
|
1569
|
+
* Create a new, empty kernel.
|
|
1570
|
+
*/
|
|
1571
|
+
constructor();
|
|
1572
|
+
/**
|
|
1573
|
+
* Offset a face by a distance along its surface normal.
|
|
1574
|
+
*
|
|
1575
|
+
* Returns the new offset face handle.
|
|
1576
|
+
*
|
|
1577
|
+
* # Errors
|
|
1578
|
+
*
|
|
1579
|
+
* Returns an error if the face handle is invalid or the operation fails.
|
|
1580
|
+
*/
|
|
1581
|
+
offsetFace(face: number, distance: number, samples: number): number;
|
|
1582
|
+
/**
|
|
1583
|
+
* Offset a 2D polygon by a signed distance.
|
|
1584
|
+
*
|
|
1585
|
+
* `coords` is a flat array `[x,y, x,y, ...]` of 2D points.
|
|
1586
|
+
* Returns a flat array of offset polygon coordinates.
|
|
1587
|
+
*/
|
|
1588
|
+
offsetPolygon2d(coords: Float64Array, distance: number, tolerance: number): Float64Array;
|
|
1589
|
+
/**
|
|
1590
|
+
* Offset all faces of a solid outward or inward (V2 pipeline).
|
|
1591
|
+
*
|
|
1592
|
+
* Uses the new `brepkit-offset` engine with intersection-based joints.
|
|
1593
|
+
*
|
|
1594
|
+
* # Errors
|
|
1595
|
+
*
|
|
1596
|
+
* Returns an error if the distance is not finite or the solid is invalid.
|
|
1597
|
+
*/
|
|
1598
|
+
offsetSolidV2(solid: number, distance: number): number;
|
|
1599
|
+
/**
|
|
1600
|
+
* Offset (shell) a solid by a distance.
|
|
1601
|
+
*
|
|
1602
|
+
* Returns a new solid handle.
|
|
1603
|
+
*
|
|
1604
|
+
* # Errors
|
|
1605
|
+
*
|
|
1606
|
+
* Returns an error if the distance is zero or the solid is invalid.
|
|
1607
|
+
*/
|
|
1608
|
+
offsetSolid(solid: number, distance: number): number;
|
|
1609
|
+
/**
|
|
1610
|
+
* Offset a planar wire directly by a distance with a specific join type.
|
|
1611
|
+
*
|
|
1612
|
+
* Builds a planar face from the wire internally, then offsets it with
|
|
1613
|
+
* the requested corner join. This is the wire-based counterpart to
|
|
1614
|
+
* [`offset_wire_with_join_type`](Self::offset_wire_with_join_type),
|
|
1615
|
+
* which requires a face handle. Consumers that only hold a wire (such
|
|
1616
|
+
* as 2D sketch offsets) can route a join type through this entry point
|
|
1617
|
+
* without first constructing a face.
|
|
1618
|
+
*
|
|
1619
|
+
* `join_type` must be one of `"intersection"`, `"arc"`, or `"chamfer"`.
|
|
1620
|
+
* Returns a new wire handle.
|
|
1621
|
+
*
|
|
1622
|
+
* # Errors
|
|
1623
|
+
*
|
|
1624
|
+
* Returns an error if the wire handle is invalid, the wire is not
|
|
1625
|
+
* planar, the join type string is unrecognized, or the offset
|
|
1626
|
+
* operation fails.
|
|
1627
|
+
*/
|
|
1628
|
+
offsetWire2DWithJoin(wire: number, distance: number, join_type: string): number;
|
|
1629
|
+
/**
|
|
1630
|
+
* Offset a wire on a planar face with a specific join type.
|
|
1631
|
+
*
|
|
1632
|
+
* `join_type` must be one of `"intersection"`, `"arc"`, or `"chamfer"`.
|
|
1633
|
+
* Returns a new wire handle.
|
|
1634
|
+
*
|
|
1635
|
+
* # Errors
|
|
1636
|
+
*
|
|
1637
|
+
* Returns an error if the face handle is invalid, the join type string
|
|
1638
|
+
* is unrecognized, or the offset operation fails.
|
|
1639
|
+
*/
|
|
1640
|
+
offsetWireWithJoinType(face: number, distance: number, join_type: string): number;
|
|
1641
|
+
/**
|
|
1642
|
+
* Offset a wire on a planar face.
|
|
1643
|
+
*
|
|
1644
|
+
* Returns a new wire handle.
|
|
1645
|
+
*/
|
|
1646
|
+
offsetWire(face: number, distance: number): number;
|
|
1647
|
+
/**
|
|
1648
|
+
* Pipe sweep: sweep a profile along a NURBS path (no guide).
|
|
1649
|
+
*
|
|
1650
|
+
* Returns a solid handle.
|
|
1651
|
+
*
|
|
1652
|
+
* # Errors
|
|
1653
|
+
*
|
|
1654
|
+
* Returns an error if the face or path is invalid.
|
|
1655
|
+
*/
|
|
1656
|
+
pipe(face: number, path_degree: number, path_knots: Float64Array, path_control_points: Float64Array, path_weights: Float64Array): number;
|
|
1657
|
+
/**
|
|
1658
|
+
* Test if a 2D point is inside a closed polygon.
|
|
1659
|
+
*
|
|
1660
|
+
* `polygon_coords` is a flat array `[x,y, x,y, ...]`.
|
|
1661
|
+
* Returns `true` if the point is inside the polygon (winding number test).
|
|
1662
|
+
*/
|
|
1663
|
+
pointInPolygon2d(polygon_coords: Float64Array, px: number, py: number): boolean;
|
|
1664
|
+
/**
|
|
1665
|
+
* Compute minimum distance from a point to an edge.
|
|
1666
|
+
*
|
|
1667
|
+
* Returns `[distance, closest_x, closest_y, closest_z]`.
|
|
1668
|
+
*
|
|
1669
|
+
* # Errors
|
|
1670
|
+
*
|
|
1671
|
+
* Returns an error if the edge handle is invalid.
|
|
1672
|
+
*/
|
|
1673
|
+
pointToEdgeDistance(px: number, py: number, pz: number, edge: number): Float64Array;
|
|
1674
|
+
/**
|
|
1675
|
+
* Compute minimum distance from a point to a face.
|
|
1676
|
+
*
|
|
1677
|
+
* Returns `[distance, closest_x, closest_y, closest_z]`.
|
|
1678
|
+
*
|
|
1679
|
+
* # Errors
|
|
1680
|
+
*
|
|
1681
|
+
* Returns an error if the face handle is invalid.
|
|
1682
|
+
*/
|
|
1683
|
+
pointToFaceDistance(px: number, py: number, pz: number, face: number): Float64Array;
|
|
1684
|
+
/**
|
|
1685
|
+
* Compute minimum distance from a point to a solid.
|
|
1686
|
+
*
|
|
1687
|
+
* Returns `[distance, closest_x, closest_y, closest_z]`.
|
|
1688
|
+
*
|
|
1689
|
+
* # Errors
|
|
1690
|
+
*
|
|
1691
|
+
* Returns an error if the solid handle is invalid.
|
|
1692
|
+
*/
|
|
1693
|
+
pointToSolidDistance(px: number, py: number, pz: number, solid: number): Float64Array;
|
|
1694
|
+
/**
|
|
1695
|
+
* Test if two 2D polygons intersect (overlap).
|
|
1696
|
+
*
|
|
1697
|
+
* Both polygons are flat arrays `[x,y, x,y, ...]`.
|
|
1698
|
+
* Returns `true` if any vertex of one polygon is inside the other
|
|
1699
|
+
* or if any edges cross.
|
|
1700
|
+
*/
|
|
1701
|
+
polygonsIntersect2d(coords_a: Float64Array, coords_b: Float64Array): boolean;
|
|
1702
|
+
/**
|
|
1703
|
+
* Project a solid's edges onto a view plane with hidden-line removal.
|
|
1704
|
+
*
|
|
1705
|
+
* Viewed along `dir` (orthographic) through `origin`, with in-plane x-axis
|
|
1706
|
+
* `x_axis`. Returns a JSON string `{"visible": [[x,y,…]], "hidden": [[…]]}`
|
|
1707
|
+
* — flat 2D polylines in view coordinates. `hidden_lines = false` drops the
|
|
1708
|
+
* hidden set. Occlusion is an exact point-in-solid test.
|
|
1709
|
+
*
|
|
1710
|
+
* # Errors
|
|
1711
|
+
*
|
|
1712
|
+
* Returns an error for an invalid handle, a non-positive `deflection`, or a
|
|
1713
|
+
* degenerate `dir`/`x_axis`.
|
|
1714
|
+
*/
|
|
1715
|
+
projectEdges(solid: number, origin_x: number, origin_y: number, origin_z: number, dir_x: number, dir_y: number, dir_z: number, x_axis_x: number, x_axis_y: number, x_axis_z: number, hidden_lines: boolean, deflection: number): any;
|
|
1716
|
+
/**
|
|
1717
|
+
* Project a 3D point onto a face surface using Newton iteration.
|
|
1718
|
+
*
|
|
1719
|
+
* Returns `[u, v, px, py, pz, distance]`.
|
|
1720
|
+
*/
|
|
1721
|
+
projectPointOnSurface(face: number, px: number, py: number, pz: number): Float64Array;
|
|
1722
|
+
/**
|
|
1723
|
+
* Recognize geometric features in a solid.
|
|
1724
|
+
*
|
|
1725
|
+
* Returns a JSON string describing the recognized features.
|
|
1726
|
+
*/
|
|
1727
|
+
recognizeFeatures(solid: number, deflection: number): string;
|
|
1728
|
+
/**
|
|
1729
|
+
* Remove degenerate (zero-length) edges from a solid.
|
|
1730
|
+
*
|
|
1731
|
+
* Returns the number of edges removed.
|
|
1732
|
+
*/
|
|
1733
|
+
removeDegenerateEdges(solid: number, tolerance: number): number;
|
|
1734
|
+
/**
|
|
1735
|
+
* Remove all holes from a face, returning a new face with only the outer wire.
|
|
1736
|
+
*/
|
|
1737
|
+
removeHolesFromFace(face: number): number;
|
|
1738
|
+
/**
|
|
1739
|
+
* Validate, heal, and re-validate a solid in one pass.
|
|
1740
|
+
*
|
|
1741
|
+
* Returns the number of remaining validation errors after repair.
|
|
1742
|
+
* A return value of 0 means the solid is valid after repair.
|
|
1743
|
+
*
|
|
1744
|
+
* # Errors
|
|
1745
|
+
*
|
|
1746
|
+
* Returns an error if the solid handle is invalid.
|
|
1747
|
+
*/
|
|
1748
|
+
repairSolid(solid: number): number;
|
|
1749
|
+
/**
|
|
1750
|
+
* Restore the kernel to a previously saved checkpoint.
|
|
1751
|
+
*
|
|
1752
|
+
* All state created after the checkpoint is discarded. The checkpoint
|
|
1753
|
+
* itself (and any earlier checkpoints) remain valid for future restores.
|
|
1754
|
+
* Checkpoints created after this one are discarded.
|
|
1755
|
+
*
|
|
1756
|
+
* # Errors
|
|
1757
|
+
*
|
|
1758
|
+
* Returns an error if `checkpoint_id` does not refer to a valid checkpoint.
|
|
1759
|
+
*/
|
|
1760
|
+
restore(checkpoint_id: number): void;
|
|
1761
|
+
/**
|
|
1762
|
+
* Reverse the orientation of a face or edge.
|
|
1763
|
+
*
|
|
1764
|
+
* For faces: creates a new face with negated plane normal.
|
|
1765
|
+
* For edges: creates a new edge with swapped start/end vertices.
|
|
1766
|
+
* Returns the handle of the new reversed shape.
|
|
1767
|
+
*
|
|
1768
|
+
* # Errors
|
|
1769
|
+
*
|
|
1770
|
+
* Returns an error if the handle is neither a valid face nor edge.
|
|
1771
|
+
*/
|
|
1772
|
+
reverseShape(id: number): number;
|
|
1773
|
+
/**
|
|
1774
|
+
* Revolve a planar face around an axis to create a solid of revolution.
|
|
1775
|
+
*
|
|
1776
|
+
* The axis is defined by an origin point `(ox, oy, oz)` and a direction
|
|
1777
|
+
* `(dx, dy, dz)`. The angle is in degrees and must be in (0, 360].
|
|
1778
|
+
*
|
|
1779
|
+
* Returns a solid handle (`u32`).
|
|
1780
|
+
*
|
|
1781
|
+
* # Errors
|
|
1782
|
+
*
|
|
1783
|
+
* Returns an error if any input is non-finite, the face handle is
|
|
1784
|
+
* invalid, or the revolve operation fails.
|
|
1785
|
+
*/
|
|
1786
|
+
revolve(face: number, ox: number, oy: number, oz: number, dx: number, dy: number, dz: number, angle_degrees: number): number;
|
|
1787
|
+
/**
|
|
1788
|
+
* Section a solid with a plane, returning cross-section face handles.
|
|
1789
|
+
*
|
|
1790
|
+
* Returns an array of face handles (`u32[]`).
|
|
1791
|
+
*
|
|
1792
|
+
* # Errors
|
|
1793
|
+
*
|
|
1794
|
+
* Returns an error if the solid handle is invalid or the plane doesn't
|
|
1795
|
+
* intersect the solid.
|
|
1796
|
+
*/
|
|
1797
|
+
section(solid: number, px: number, py: number, pz: number, nx: number, ny: number, nz: number): Uint32Array;
|
|
1798
|
+
/**
|
|
1799
|
+
* Serialize a solid's complete in-memory topology sub-arena to bytes.
|
|
1800
|
+
*
|
|
1801
|
+
* Captures every vertex, edge, wire, face, shell reachable from the
|
|
1802
|
+
* solid with byte-exact f64 values (no geometry re-derivation or
|
|
1803
|
+
* tolerance normalization). Unlike STEP/IGES export, this preserves the
|
|
1804
|
+
* kernel's exact in-memory state — intended for capturing live operands
|
|
1805
|
+
* and replaying them in a native Rust harness to reproduce
|
|
1806
|
+
* sub-ULP-sensitive boolean behavior.
|
|
1807
|
+
*
|
|
1808
|
+
* Returns a `Uint8Array` consumable by `brepkit_io::arena_io::deserialize_solid`.
|
|
1809
|
+
*
|
|
1810
|
+
* # Errors
|
|
1811
|
+
*
|
|
1812
|
+
* Returns an error if the solid handle is invalid or serialization fails.
|
|
1813
|
+
*/
|
|
1814
|
+
serializeSolid(solid: number): Uint8Array;
|
|
1815
|
+
/**
|
|
1816
|
+
* Sew loose faces into a connected solid.
|
|
1817
|
+
*
|
|
1818
|
+
* `face_handles` is an array of face handles. Returns a solid handle.
|
|
1819
|
+
*
|
|
1820
|
+
* # Errors
|
|
1821
|
+
*
|
|
1822
|
+
* Returns an error if fewer than 2 faces or sewing fails.
|
|
1823
|
+
*/
|
|
1824
|
+
sewFaces(face_handles: Uint32Array, tolerance: number): number;
|
|
1825
|
+
/**
|
|
1826
|
+
* Get edges shared between two faces.
|
|
1827
|
+
*
|
|
1828
|
+
* Returns an array of edge handles.
|
|
1829
|
+
*/
|
|
1830
|
+
sharedEdges(face_a: number, face_b: number): Uint32Array;
|
|
1831
|
+
/**
|
|
1832
|
+
* Hollow a solid with uniform wall thickness.
|
|
1833
|
+
*
|
|
1834
|
+
* `open_faces` is an array of face handles to remove (creating openings).
|
|
1835
|
+
* Returns a solid handle (`u32`).
|
|
1836
|
+
*
|
|
1837
|
+
* # Errors
|
|
1838
|
+
*
|
|
1839
|
+
* Returns an error if thickness is non-positive or the solid is invalid.
|
|
1840
|
+
*/
|
|
1841
|
+
shell(solid: number, thickness: number, open_faces: Uint32Array): number;
|
|
1842
|
+
/**
|
|
1843
|
+
* Add an arc to a sketch (defined by center, start, end point indices).
|
|
1844
|
+
* Returns the arc index.
|
|
1845
|
+
*/
|
|
1846
|
+
sketchAddArc(sketch: number, center_idx: number, start_idx: number, end_idx: number): number;
|
|
1847
|
+
/**
|
|
1848
|
+
* Add a circle to a sketch.
|
|
1849
|
+
*
|
|
1850
|
+
* `center_idx` must be a valid point index. Returns the circle index
|
|
1851
|
+
* (0-based) for use in circle-referencing constraints.
|
|
1852
|
+
*/
|
|
1853
|
+
sketchAddCircle(sketch: number, center_idx: number, radius: number): number;
|
|
1854
|
+
/**
|
|
1855
|
+
* Add a constraint to a sketch from a JSON string.
|
|
1856
|
+
*
|
|
1857
|
+
* Supports all legacy constraint types plus arc-referencing constraints:
|
|
1858
|
+
* `tangentLineArc`, `tangentArcArc`, `pointOnArc`, `equalRadiusArcArc`,
|
|
1859
|
+
* `arcLength`, `concentricArcArc`.
|
|
1860
|
+
*/
|
|
1861
|
+
sketchAddConstraint(sketch: number, json: string): void;
|
|
1862
|
+
/**
|
|
1863
|
+
* Add a point to a sketch. Returns the point index.
|
|
1864
|
+
*/
|
|
1865
|
+
sketchAddPoint(sketch: number, x: number, y: number, fixed: boolean): number;
|
|
1866
|
+
/**
|
|
1867
|
+
* Compute degrees of freedom for a sketch.
|
|
1868
|
+
*
|
|
1869
|
+
* Returns a JSON string: `{"dof": n, "rank": n, "numParams": n, "numEquations": n}`.
|
|
1870
|
+
*/
|
|
1871
|
+
sketchDof(sketch: number): string;
|
|
1872
|
+
/**
|
|
1873
|
+
* Create a new empty sketch. Returns a sketch index.
|
|
1874
|
+
*/
|
|
1875
|
+
sketchNew(): number;
|
|
1876
|
+
/**
|
|
1877
|
+
* Solve the sketch constraints.
|
|
1878
|
+
*
|
|
1879
|
+
* Returns a JSON string with converged status, iteration count, point
|
|
1880
|
+
* positions, and arc definitions.
|
|
1881
|
+
*/
|
|
1882
|
+
sketchSolve(sketch: number, max_iterations: number, tolerance: number): string;
|
|
1883
|
+
/**
|
|
1884
|
+
* Create a solid from a shell.
|
|
1885
|
+
*
|
|
1886
|
+
* Returns a solid handle (`u32`).
|
|
1887
|
+
*/
|
|
1888
|
+
solidFromShell(shell: number): number;
|
|
1889
|
+
/**
|
|
1890
|
+
* Compute minimum distance between two solids.
|
|
1891
|
+
*
|
|
1892
|
+
* Returns `[distance, point_a_x, point_a_y, point_a_z, point_b_x, point_b_y, point_b_z]`.
|
|
1893
|
+
*
|
|
1894
|
+
* # Errors
|
|
1895
|
+
*
|
|
1896
|
+
* Returns an error if either solid handle is invalid.
|
|
1897
|
+
*/
|
|
1898
|
+
solidToSolidDistance(a: number, b: number): Float64Array;
|
|
1899
|
+
/**
|
|
1900
|
+
* Split a solid into two halves along a plane.
|
|
1901
|
+
*
|
|
1902
|
+
* Returns `[positive_solid_handle, negative_solid_handle]`.
|
|
1903
|
+
*
|
|
1904
|
+
* # Errors
|
|
1905
|
+
*
|
|
1906
|
+
* Returns an error if the plane doesn't intersect the solid.
|
|
1907
|
+
*/
|
|
1908
|
+
split(solid: number, px: number, py: number, pz: number, nx: number, ny: number, nz: number): Uint32Array;
|
|
1909
|
+
/**
|
|
1910
|
+
* Compute the total surface area of a solid.
|
|
1911
|
+
*
|
|
1912
|
+
* # Errors
|
|
1913
|
+
*
|
|
1914
|
+
* Returns an error if the solid handle is invalid or tessellation fails.
|
|
1915
|
+
*/
|
|
1916
|
+
surfaceArea(solid: number, deflection: number): number;
|
|
1917
|
+
/**
|
|
1918
|
+
* Sweep a face along a path defined by a chain of edges.
|
|
1919
|
+
*
|
|
1920
|
+
* Collects points from the edges, fits an interpolating NURBS curve,
|
|
1921
|
+
* then sweeps the profile along that curve.
|
|
1922
|
+
*
|
|
1923
|
+
* Returns a solid handle (`u32`).
|
|
1924
|
+
*
|
|
1925
|
+
* # Errors
|
|
1926
|
+
*
|
|
1927
|
+
* Returns an error if fewer than 2 edges or the fit fails.
|
|
1928
|
+
*/
|
|
1929
|
+
sweepAlongEdges(face: number, edge_handles: Uint32Array): number;
|
|
1930
|
+
/**
|
|
1931
|
+
* Sweep a face along a path with smooth NURBS side surfaces.
|
|
1932
|
+
*
|
|
1933
|
+
* Like `sweep()`, but produces a single NURBS surface per edge strip
|
|
1934
|
+
* instead of multiple flat quads, giving smooth geometry that
|
|
1935
|
+
* tessellates to arbitrary quality.
|
|
1936
|
+
*
|
|
1937
|
+
* Returns a solid handle (`u32`).
|
|
1938
|
+
*
|
|
1939
|
+
* # Errors
|
|
1940
|
+
*
|
|
1941
|
+
* Returns an error if the face or path is invalid, or surface fitting fails.
|
|
1942
|
+
*/
|
|
1943
|
+
sweepSmooth(face: number, path_degree: number, path_knots: Float64Array, path_control_points: Float64Array, path_weights: Float64Array): number;
|
|
1944
|
+
/**
|
|
1945
|
+
* Sweep a face along a NURBS path with advanced options.
|
|
1946
|
+
*
|
|
1947
|
+
* `contact_mode`: "rmf" (default), "fixed", or "constantNormal:x,y,z"
|
|
1948
|
+
* `scale_values`: flat `[t0,s0,t1,s1,...]` pairs for piecewise-linear scale law.
|
|
1949
|
+
* `corner_mode`: "smooth" (default), "miter", or "round"
|
|
1950
|
+
* Returns a solid handle.
|
|
1951
|
+
*/
|
|
1952
|
+
sweepWithOptions(profile: number, path_edge: number, contact_mode: string, scale_values: Float64Array, segments: number, corner_mode: string): number;
|
|
1953
|
+
/**
|
|
1954
|
+
* Sweep a planar face along a NURBS curve path to create a solid.
|
|
1955
|
+
*
|
|
1956
|
+
* The path is specified as flat arrays for JS interop:
|
|
1957
|
+
* - `path_degree` — polynomial degree of the path curve
|
|
1958
|
+
* - `path_knots` — knot vector
|
|
1959
|
+
* - `path_control_points` — flat `[x,y,z, ...]` control point coordinates
|
|
1960
|
+
* - `path_weights` — per-control-point weights
|
|
1961
|
+
*
|
|
1962
|
+
* Returns a solid handle (`u32`).
|
|
1963
|
+
*
|
|
1964
|
+
* # Errors
|
|
1965
|
+
*
|
|
1966
|
+
* Returns an error if the face handle is invalid, the NURBS arrays have
|
|
1967
|
+
* inconsistent lengths, or the sweep operation fails.
|
|
1968
|
+
*/
|
|
1969
|
+
sweep(face: number, path_degree: number, path_knots: Float64Array, path_control_points: Float64Array, path_weights: Float64Array): number;
|
|
1970
|
+
/**
|
|
1971
|
+
* Tessellate an edge curve into polyline segments.
|
|
1972
|
+
*
|
|
1973
|
+
* For line edges, returns just start and end points.
|
|
1974
|
+
* For NURBS edges, samples at `num_points` along the curve.
|
|
1975
|
+
*
|
|
1976
|
+
* Returns flattened `[x, y, z, x, y, z, ...]` array.
|
|
1977
|
+
*/
|
|
1978
|
+
tessellateEdge(edge: number, num_points: number): Float64Array;
|
|
1979
|
+
/**
|
|
1980
|
+
* Tessellate a single face into a triangle mesh.
|
|
1981
|
+
*
|
|
1982
|
+
* # Errors
|
|
1983
|
+
*
|
|
1984
|
+
* Returns an error if the face handle is invalid or tessellation fails.
|
|
1985
|
+
*/
|
|
1986
|
+
tessellateFace(face: number, deflection: number, angular_tolerance?: number | null): JsMesh;
|
|
1987
|
+
/**
|
|
1988
|
+
* Tessellate a solid with per-face grouping, returned as packed binary
|
|
1989
|
+
* buffers ([`JsGroupedMesh`]) instead of a JSON string.
|
|
1990
|
+
*
|
|
1991
|
+
* Identical geometry to [`tessellate_solid_grouped`](Self::tessellate_solid_grouped),
|
|
1992
|
+
* but the mesh crosses the WASM boundary as `Float32Array`/`Uint32Array`
|
|
1993
|
+
* bulk copies rather than a (potentially multi-megabyte) JSON string that
|
|
1994
|
+
* the caller must `JSON.parse` and re-pack — far cheaper for large meshes.
|
|
1995
|
+
*
|
|
1996
|
+
* # Errors
|
|
1997
|
+
*
|
|
1998
|
+
* Returns an error if the solid handle is invalid or tessellation fails.
|
|
1999
|
+
*/
|
|
2000
|
+
tessellateSolidGroupedBinary(solid: number, deflection: number, angular_tolerance?: number | null): JsGroupedMesh;
|
|
2001
|
+
/**
|
|
2002
|
+
* Tessellate a solid with per-face triangle grouping.
|
|
2003
|
+
*
|
|
2004
|
+
* Returns a JSON string containing `{ positions, normals, indices, faceOffsets }`.
|
|
2005
|
+
* `faceOffsets` is an array where `faceOffsets[i]` is the start index into
|
|
2006
|
+
* `indices` for face `i`, and the last element is `indices.length`.
|
|
2007
|
+
*
|
|
2008
|
+
* Uses the watertight shared-edge-pool tessellation: adjacent faces share
|
|
2009
|
+
* identical boundary vertices, so the exported mesh has no T-junctions
|
|
2010
|
+
* regardless of how the solid was constructed (booleans included).
|
|
2011
|
+
*/
|
|
2012
|
+
tessellateSolidGrouped(solid: number, deflection: number, angular_tolerance?: number | null): any;
|
|
2013
|
+
/**
|
|
2014
|
+
* Tessellate a solid and include per-vertex UV coordinates.
|
|
2015
|
+
*
|
|
2016
|
+
* Returns a JSON string containing `{ positions, normals, indices, uvs }`.
|
|
2017
|
+
* `uvs` is a flat array of `[u0, v0, u1, v1, ...]` values, two per vertex.
|
|
2018
|
+
* For analytic and NURBS surfaces, these are the parametric (u, v) values.
|
|
2019
|
+
* For planar faces, UVs are computed by projection onto the face plane.
|
|
2020
|
+
*
|
|
2021
|
+
* # Errors
|
|
2022
|
+
*
|
|
2023
|
+
* Returns an error if the solid handle is invalid or tessellation fails.
|
|
2024
|
+
*/
|
|
2025
|
+
tessellateSolidUV(solid: number, deflection: number, angular_tolerance?: number | null): any;
|
|
2026
|
+
/**
|
|
2027
|
+
* Tessellate all faces of a solid into a single merged triangle mesh.
|
|
2028
|
+
*
|
|
2029
|
+
* Includes both the outer shell and any inner shells (voids).
|
|
2030
|
+
*
|
|
2031
|
+
* # Errors
|
|
2032
|
+
*
|
|
2033
|
+
* Returns an error if the solid handle is invalid or tessellation fails.
|
|
2034
|
+
*/
|
|
2035
|
+
tessellateSolid(solid: number, deflection: number, angular_tolerance?: number | null): JsMesh;
|
|
2036
|
+
/**
|
|
2037
|
+
* Thicken a face into a solid by offsetting it by the given distance.
|
|
2038
|
+
*
|
|
2039
|
+
* Creates a solid from a face by extruding it along its normal by
|
|
2040
|
+
* `thickness`. Positive values offset outward, negative inward.
|
|
2041
|
+
*
|
|
2042
|
+
* # Errors
|
|
2043
|
+
*
|
|
2044
|
+
* Returns an error if the face handle is invalid or thickness is zero.
|
|
2045
|
+
*/
|
|
2046
|
+
thicken(face: number, thickness: number): number;
|
|
2047
|
+
/**
|
|
2048
|
+
* Export a solid as a BREP string (STEP format).
|
|
2049
|
+
*
|
|
2050
|
+
* Returns a STEP-formatted string containing the solid's B-Rep data.
|
|
2051
|
+
* Use `fromBREP` to reconstruct the solid from this string.
|
|
2052
|
+
*
|
|
2053
|
+
* # Errors
|
|
2054
|
+
*
|
|
2055
|
+
* Returns an error if the solid handle is invalid.
|
|
2056
|
+
*/
|
|
2057
|
+
toBREP(solid: number): any;
|
|
2058
|
+
/**
|
|
2059
|
+
* Export a solid as a JSON-encoded BREP representation.
|
|
2060
|
+
*
|
|
2061
|
+
* Returns a JSON string with vertices, edges (with curve parameters),
|
|
2062
|
+
* and faces (with surface parameters). This is a brepkit-specific format
|
|
2063
|
+
* that preserves all analytic geometry types.
|
|
2064
|
+
*/
|
|
2065
|
+
toBrepJson(solid: number): any;
|
|
2066
|
+
/**
|
|
2067
|
+
* Apply a 4×4 affine transform to a face (in place).
|
|
2068
|
+
*
|
|
2069
|
+
* Transforms all vertices, edge curves, and the face surface geometry.
|
|
2070
|
+
* The `matrix` must contain exactly 16 values in row-major order.
|
|
2071
|
+
*
|
|
2072
|
+
* # Errors
|
|
2073
|
+
*
|
|
2074
|
+
* Returns an error if the face handle is invalid, the matrix doesn't
|
|
2075
|
+
* have 16 elements, or the matrix is singular.
|
|
2076
|
+
*/
|
|
2077
|
+
transformFace(face: number, matrix: Float64Array): void;
|
|
2078
|
+
/**
|
|
2079
|
+
* Apply a 4×4 affine transform to a solid (in place).
|
|
2080
|
+
*
|
|
2081
|
+
* The `matrix` must contain exactly 16 values in row-major order.
|
|
2082
|
+
*
|
|
2083
|
+
* # Errors
|
|
2084
|
+
*
|
|
2085
|
+
* Returns an error if the solid handle is invalid, the matrix doesn't
|
|
2086
|
+
* have 16 elements, or the matrix is singular.
|
|
2087
|
+
*/
|
|
2088
|
+
transformSolid(solid: number, matrix: Float64Array): void;
|
|
2089
|
+
/**
|
|
2090
|
+
* Apply a 4×4 affine transform to a wire (in place).
|
|
2091
|
+
*
|
|
2092
|
+
* The `matrix` must contain exactly 16 values in row-major order.
|
|
2093
|
+
*
|
|
2094
|
+
* # Errors
|
|
2095
|
+
*
|
|
2096
|
+
* Returns an error if the wire handle is invalid, the matrix doesn't
|
|
2097
|
+
* have 16 elements, or the matrix is singular.
|
|
2098
|
+
*/
|
|
2099
|
+
transformWire(wire: number, matrix: Float64Array): void;
|
|
2100
|
+
/**
|
|
2101
|
+
* Unify adjacent faces that lie on the same geometric surface.
|
|
2102
|
+
*
|
|
2103
|
+
* Merges co-surface face fragments (produced by boolean operations)
|
|
2104
|
+
* back into single faces, reducing face count and improving topology.
|
|
2105
|
+
* Returns the number of faces removed.
|
|
2106
|
+
*/
|
|
2107
|
+
unifyFaces(solid: number): number;
|
|
2108
|
+
/**
|
|
2109
|
+
* Untrim a NURBS face by fitting a new surface to the trimmed region.
|
|
2110
|
+
*
|
|
2111
|
+
* Returns a new face handle.
|
|
2112
|
+
*/
|
|
2113
|
+
untrimFace(face: number, samples_per_curve: number, interior_samples: number): number;
|
|
2114
|
+
/**
|
|
2115
|
+
* Validate a solid with relaxed checks suitable for assembled geometry.
|
|
2116
|
+
*
|
|
2117
|
+
* Operations like boolean, fillet, and shell produce geometrically
|
|
2118
|
+
* correct shapes that may not have fully manifold topology (faces
|
|
2119
|
+
* from different operations may not share edges). This validation
|
|
2120
|
+
* skips Euler characteristic, boundary edge, non-manifold edge, and
|
|
2121
|
+
* shell connectivity checks.
|
|
2122
|
+
*
|
|
2123
|
+
* Returns 0 if the solid passes all structural checks.
|
|
2124
|
+
*
|
|
2125
|
+
* # Errors
|
|
2126
|
+
*
|
|
2127
|
+
* Returns an error if the solid handle is invalid.
|
|
2128
|
+
*/
|
|
2129
|
+
validateSolidRelaxed(solid: number): number;
|
|
2130
|
+
/**
|
|
2131
|
+
* Validate a solid with configurable tolerance scaling.
|
|
2132
|
+
*
|
|
2133
|
+
* `tolerance_scale` multiplies geometric tolerances used for the
|
|
2134
|
+
* face-normal and face-area checks. Use `10.0` to reduce false
|
|
2135
|
+
* positives on NURBS faces from fillet/shell operations.
|
|
2136
|
+
*
|
|
2137
|
+
* Returns 0 if the solid is valid.
|
|
2138
|
+
*
|
|
2139
|
+
* # Errors
|
|
2140
|
+
*
|
|
2141
|
+
* Returns an error if the solid handle is invalid.
|
|
2142
|
+
*/
|
|
2143
|
+
validateSolidWithOptions(solid: number, tolerance_scale: number): number;
|
|
2144
|
+
/**
|
|
2145
|
+
* Validate a solid, returning the number of errors found.
|
|
2146
|
+
*
|
|
2147
|
+
* Returns 0 if the solid is valid.
|
|
2148
|
+
*
|
|
2149
|
+
* # Errors
|
|
2150
|
+
*
|
|
2151
|
+
* Returns an error if the solid handle is invalid.
|
|
2152
|
+
*/
|
|
2153
|
+
validateSolid(solid: number): number;
|
|
2154
|
+
/**
|
|
2155
|
+
* Compute the volume of a solid.
|
|
2156
|
+
*
|
|
2157
|
+
* # Errors
|
|
2158
|
+
*
|
|
2159
|
+
* Returns an error if the solid handle is invalid or tessellation fails.
|
|
2160
|
+
*/
|
|
2161
|
+
volume(solid: number, deflection: number): number;
|
|
2162
|
+
/**
|
|
2163
|
+
* Weld shells and faces into a single solid by sewing.
|
|
2164
|
+
*
|
|
2165
|
+
* Accepts an array of face handles from potentially different shells.
|
|
2166
|
+
* Sews all faces together into a single solid.
|
|
2167
|
+
*/
|
|
2168
|
+
weldShellsAndFaces(face_handles: Uint32Array, tolerance: number): number;
|
|
2169
|
+
/**
|
|
2170
|
+
* Compute the total arc-length of a wire.
|
|
2171
|
+
*/
|
|
2172
|
+
wireLength(wire: number): number;
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
/**
|
|
2176
|
+
* Edge polylines for wireframe rendering, exposed to JavaScript.
|
|
2177
|
+
*
|
|
2178
|
+
* Positions are flattened to `[x, y, z, x, y, z, ...]` format.
|
|
2179
|
+
* Offsets are float-array indices into `positions` (already multiplied by 3).
|
|
2180
|
+
*/
|
|
2181
|
+
export class JsEdgeLines {
|
|
2182
|
+
private constructor();
|
|
2183
|
+
free(): void;
|
|
2184
|
+
[Symbol.dispose](): void;
|
|
2185
|
+
/**
|
|
2186
|
+
* Return all data in a single packed buffer for efficient FFI transfer.
|
|
2187
|
+
*
|
|
2188
|
+
* Layout: `[pos_bytes: u32 LE, off_bytes: u32 LE,
|
|
2189
|
+
* positions: f64 LE..., offsets: u32 LE...]`
|
|
2190
|
+
*/
|
|
2191
|
+
packedBuffer(): Uint8Array;
|
|
2192
|
+
/**
|
|
2193
|
+
* Number of edges.
|
|
2194
|
+
*/
|
|
2195
|
+
readonly edgeCount: number;
|
|
2196
|
+
/**
|
|
2197
|
+
* Start index into the flattened positions array for each edge polyline.
|
|
2198
|
+
*
|
|
2199
|
+
* The i-th edge's positions span from `positions[offsets[i]]` to
|
|
2200
|
+
* `positions[offsets[i+1]]` (or to the end for the last edge).
|
|
2201
|
+
* Each offset is already a float-array index (vertex index × 3).
|
|
2202
|
+
*/
|
|
2203
|
+
readonly offsets: Uint32Array;
|
|
2204
|
+
/**
|
|
2205
|
+
* Flattened vertex positions as `[x, y, z, ...]`.
|
|
2206
|
+
*/
|
|
2207
|
+
readonly positions: Float64Array;
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
/**
|
|
2211
|
+
* A triangle mesh with per-face triangle grouping, exposed to JavaScript.
|
|
2212
|
+
*
|
|
2213
|
+
* The binary counterpart to the JSON `tessellateSolidGrouped`: positions and
|
|
2214
|
+
* normals are packed `Float32Array`s and indices/`faceOffsets` are
|
|
2215
|
+
* `Uint32Array`s, so the whole mesh crosses the WASM boundary as bulk memory
|
|
2216
|
+
* copies instead of a JSON string round-trip. `f32` matches what mesh
|
|
2217
|
+
* consumers (GPU vertex buffers) use, halving the transfer versus `f64`.
|
|
2218
|
+
*/
|
|
2219
|
+
export class JsGroupedMesh {
|
|
2220
|
+
private constructor();
|
|
2221
|
+
free(): void;
|
|
2222
|
+
[Symbol.dispose](): void;
|
|
2223
|
+
/**
|
|
2224
|
+
* Per-face start offsets into `indices`: `faceOffsets[i]` is the start of
|
|
2225
|
+
* face `i`, and the final element equals `indices.length`.
|
|
2226
|
+
*/
|
|
2227
|
+
readonly faceOffsets: Uint32Array;
|
|
2228
|
+
/**
|
|
2229
|
+
* Triangle indices (groups of 3).
|
|
2230
|
+
*/
|
|
2231
|
+
readonly indices: Uint32Array;
|
|
2232
|
+
/**
|
|
2233
|
+
* Flattened per-vertex normals as `[nx, ny, nz, ...]`.
|
|
2234
|
+
*/
|
|
2235
|
+
readonly normals: Float32Array;
|
|
2236
|
+
/**
|
|
2237
|
+
* Flattened vertex positions as `[x, y, z, ...]`.
|
|
2238
|
+
*/
|
|
2239
|
+
readonly positions: Float32Array;
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
/**
|
|
2243
|
+
* A triangle mesh exposed to JavaScript.
|
|
2244
|
+
*
|
|
2245
|
+
* Positions and normals are flattened to `[x, y, z, x, y, z, ...]` format
|
|
2246
|
+
* for efficient WASM transfer and direct use as GPU vertex buffers.
|
|
2247
|
+
*/
|
|
2248
|
+
export class JsMesh {
|
|
2249
|
+
private constructor();
|
|
2250
|
+
free(): void;
|
|
2251
|
+
[Symbol.dispose](): void;
|
|
2252
|
+
/**
|
|
2253
|
+
* Return all mesh data in a single packed buffer for efficient FFI transfer.
|
|
2254
|
+
*
|
|
2255
|
+
* Layout: `[pos_bytes: u32 LE, norm_bytes: u32 LE, idx_bytes: u32 LE,
|
|
2256
|
+
* positions: f64 LE..., normals: f64 LE..., indices: u32 LE...]`
|
|
2257
|
+
*
|
|
2258
|
+
* This avoids three separate `.clone()` + FFI copies that the individual
|
|
2259
|
+
* getters (`positions`, `normals`, `indices`) would incur.
|
|
2260
|
+
*/
|
|
2261
|
+
packedBuffer(): Uint8Array;
|
|
2262
|
+
/**
|
|
2263
|
+
* Triangle indices (groups of 3).
|
|
2264
|
+
*/
|
|
2265
|
+
readonly indices: Uint32Array;
|
|
2266
|
+
/**
|
|
2267
|
+
* Flattened per-vertex normals as `[nx, ny, nz, ...]`.
|
|
2268
|
+
*/
|
|
2269
|
+
readonly normals: Float64Array;
|
|
2270
|
+
/**
|
|
2271
|
+
* Flattened vertex positions as `[x, y, z, ...]`.
|
|
2272
|
+
*/
|
|
2273
|
+
readonly positions: Float64Array;
|
|
2274
|
+
/**
|
|
2275
|
+
* Number of triangles in the mesh.
|
|
2276
|
+
*/
|
|
2277
|
+
readonly triangleCount: number;
|
|
2278
|
+
/**
|
|
2279
|
+
* Number of vertices in the mesh.
|
|
2280
|
+
*/
|
|
2281
|
+
readonly vertexCount: number;
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
/**
|
|
2285
|
+
* A 3D point exposed to JavaScript.
|
|
2286
|
+
*/
|
|
2287
|
+
export class JsPoint3 {
|
|
2288
|
+
free(): void;
|
|
2289
|
+
[Symbol.dispose](): void;
|
|
2290
|
+
/**
|
|
2291
|
+
* Create a new 3D point.
|
|
2292
|
+
*/
|
|
2293
|
+
constructor(x: number, y: number, z: number);
|
|
2294
|
+
/**
|
|
2295
|
+
* X coordinate.
|
|
2296
|
+
*/
|
|
2297
|
+
x: number;
|
|
2298
|
+
/**
|
|
2299
|
+
* Y coordinate.
|
|
2300
|
+
*/
|
|
2301
|
+
y: number;
|
|
2302
|
+
/**
|
|
2303
|
+
* Z coordinate.
|
|
2304
|
+
*/
|
|
2305
|
+
z: number;
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
/**
|
|
2309
|
+
* A 3D vector exposed to JavaScript.
|
|
2310
|
+
*/
|
|
2311
|
+
export class JsVec3 {
|
|
2312
|
+
free(): void;
|
|
2313
|
+
[Symbol.dispose](): void;
|
|
2314
|
+
/**
|
|
2315
|
+
* Compute the length of this vector.
|
|
2316
|
+
*/
|
|
2317
|
+
length(): number;
|
|
2318
|
+
/**
|
|
2319
|
+
* Create a new 3D vector.
|
|
2320
|
+
*/
|
|
2321
|
+
constructor(x: number, y: number, z: number);
|
|
2322
|
+
/**
|
|
2323
|
+
* X component.
|
|
2324
|
+
*/
|
|
2325
|
+
x: number;
|
|
2326
|
+
/**
|
|
2327
|
+
* Y component.
|
|
2328
|
+
*/
|
|
2329
|
+
y: number;
|
|
2330
|
+
/**
|
|
2331
|
+
* Z component.
|
|
2332
|
+
*/
|
|
2333
|
+
z: number;
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
/**
|
|
2337
|
+
* Clears the stored panic message so later reads reflect only new panics.
|
|
2338
|
+
*/
|
|
2339
|
+
export function clearLastPanicMessage(): void;
|
|
2340
|
+
|
|
2341
|
+
/**
|
|
2342
|
+
* Returns the message and source location of the most recent panic inside
|
|
2343
|
+
* the kernel, or `undefined` if none has occurred.
|
|
2344
|
+
*
|
|
2345
|
+
* After a panic the kernel object is unusable (every method throws
|
|
2346
|
+
* "recursive use of an object"); this free function remains callable and
|
|
2347
|
+
* carries the root-cause text for the failed call.
|
|
2348
|
+
*/
|
|
2349
|
+
export function lastPanicMessage(): string | undefined;
|
|
2350
|
+
|
|
2351
|
+
/**
|
|
2352
|
+
* Route brepkit's Rust `log::*` calls to JavaScript `console.{log, warn,
|
|
2353
|
+
* error}`. Without this every `log::warn!` in the engine is silently
|
|
2354
|
+
* dropped under wasm-pack.
|
|
2355
|
+
*
|
|
2356
|
+
* `level` is one of `"off"`, `"error"`, `"warn"`, `"info"`, `"debug"`,
|
|
2357
|
+
* `"trace"` (case-insensitive). Default is `"off"` (no log calls reach
|
|
2358
|
+
* the console). Idempotent — call as often as you like to change the
|
|
2359
|
+
* filter.
|
|
2360
|
+
*
|
|
2361
|
+
* Throws a JS Error if `level` is not one of the recognised values so a
|
|
2362
|
+
* typo surfaces immediately instead of producing the same observable
|
|
2363
|
+
* behaviour as never calling `setLogLevel` at all.
|
|
2364
|
+
*
|
|
2365
|
+
* Recommended: call once at app start with `"warn"` to surface boolean /
|
|
2366
|
+
* validation diagnostics without flooding the console.
|
|
2367
|
+
*/
|
|
2368
|
+
export function setLogLevel(level: string): void;
|