brepkit-wasm 2.43.1 → 2.43.3
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 +38 -13
- package/brepkit_wasm_bg.js +67 -15
- package/brepkit_wasm_bg.wasm +0 -0
- package/brepkit_wasm_node.cjs +67 -15
- package/package.json +1 -1
package/brepkit_wasm.d.ts
CHANGED
|
@@ -596,21 +596,20 @@ export class BrepKernel {
|
|
|
596
596
|
*/
|
|
597
597
|
fixFaceOrientations(solid: number): number;
|
|
598
598
|
/**
|
|
599
|
-
* Reconstruct a solid from a
|
|
599
|
+
* Reconstruct a solid from a BREP string.
|
|
600
600
|
*
|
|
601
|
-
*
|
|
602
|
-
*
|
|
603
|
-
*
|
|
604
|
-
* edge types fall back to lines; unrecognized surface types fall back
|
|
605
|
-
* to planes computed from wire vertices.
|
|
601
|
+
* Accepts both STEP format (from `toBREP`) and JSON format (from
|
|
602
|
+
* `toBrepJson`). Auto-detects the format: strings starting with `{`
|
|
603
|
+
* are parsed as JSON, otherwise as STEP.
|
|
606
604
|
*
|
|
607
|
-
*
|
|
605
|
+
* Only single-solid STEP files are supported. Multi-solid files will
|
|
606
|
+
* return only the first solid.
|
|
608
607
|
*
|
|
609
608
|
* # Errors
|
|
610
609
|
*
|
|
611
|
-
* Returns an error if the
|
|
610
|
+
* Returns an error if the data is invalid or reconstruction fails.
|
|
612
611
|
*/
|
|
613
|
-
fromBREP(
|
|
612
|
+
fromBREP(data: string): number;
|
|
614
613
|
/**
|
|
615
614
|
* Fuse (union) two solids into one.
|
|
616
615
|
*
|
|
@@ -1481,6 +1480,13 @@ export class BrepKernel {
|
|
|
1481
1480
|
* Returns the arc index.
|
|
1482
1481
|
*/
|
|
1483
1482
|
sketchAddArc(sketch: number, center_idx: number, start_idx: number, end_idx: number): number;
|
|
1483
|
+
/**
|
|
1484
|
+
* Add a circle to a sketch.
|
|
1485
|
+
*
|
|
1486
|
+
* `center_idx` must be a valid point index. Returns the circle index
|
|
1487
|
+
* (0-based) for use in circle-referencing constraints.
|
|
1488
|
+
*/
|
|
1489
|
+
sketchAddCircle(sketch: number, center_idx: number, radius: number): number;
|
|
1484
1490
|
/**
|
|
1485
1491
|
* Add a constraint to a sketch from a JSON string.
|
|
1486
1492
|
*
|
|
@@ -1657,17 +1663,36 @@ export class BrepKernel {
|
|
|
1657
1663
|
*/
|
|
1658
1664
|
thicken(face: number, thickness: number): number;
|
|
1659
1665
|
/**
|
|
1660
|
-
*
|
|
1666
|
+
* Export a solid as a BREP string (STEP format).
|
|
1661
1667
|
*
|
|
1662
|
-
* Returns a
|
|
1663
|
-
*
|
|
1664
|
-
* connectivity information.
|
|
1668
|
+
* Returns a STEP-formatted string containing the solid's B-Rep data.
|
|
1669
|
+
* Use `fromBREP` to reconstruct the solid from this string.
|
|
1665
1670
|
*
|
|
1666
1671
|
* # Errors
|
|
1667
1672
|
*
|
|
1668
1673
|
* Returns an error if the solid handle is invalid.
|
|
1669
1674
|
*/
|
|
1670
1675
|
toBREP(solid: number): any;
|
|
1676
|
+
/**
|
|
1677
|
+
* Export a solid as a JSON-encoded BREP representation.
|
|
1678
|
+
*
|
|
1679
|
+
* Returns a JSON string with vertices, edges (with curve parameters),
|
|
1680
|
+
* and faces (with surface parameters). This is a brepkit-specific format
|
|
1681
|
+
* that preserves all analytic geometry types.
|
|
1682
|
+
*/
|
|
1683
|
+
toBrepJson(solid: number): any;
|
|
1684
|
+
/**
|
|
1685
|
+
* Apply a 4×4 affine transform to a face (in place).
|
|
1686
|
+
*
|
|
1687
|
+
* Transforms all vertices, edge curves, and the face surface geometry.
|
|
1688
|
+
* The `matrix` must contain exactly 16 values in row-major order.
|
|
1689
|
+
*
|
|
1690
|
+
* # Errors
|
|
1691
|
+
*
|
|
1692
|
+
* Returns an error if the face handle is invalid, the matrix doesn't
|
|
1693
|
+
* have 16 elements, or the matrix is singular.
|
|
1694
|
+
*/
|
|
1695
|
+
transformFace(face: number, matrix: Float64Array): void;
|
|
1671
1696
|
/**
|
|
1672
1697
|
* Apply a 4×4 affine transform to a solid (in place).
|
|
1673
1698
|
*
|
package/brepkit_wasm_bg.js
CHANGED
|
@@ -1319,24 +1319,23 @@ export class BrepKernel {
|
|
|
1319
1319
|
return ret[0] >>> 0;
|
|
1320
1320
|
}
|
|
1321
1321
|
/**
|
|
1322
|
-
* Reconstruct a solid from a
|
|
1322
|
+
* Reconstruct a solid from a BREP string.
|
|
1323
1323
|
*
|
|
1324
|
-
*
|
|
1325
|
-
*
|
|
1326
|
-
*
|
|
1327
|
-
* edge types fall back to lines; unrecognized surface types fall back
|
|
1328
|
-
* to planes computed from wire vertices.
|
|
1324
|
+
* Accepts both STEP format (from `toBREP`) and JSON format (from
|
|
1325
|
+
* `toBrepJson`). Auto-detects the format: strings starting with `{`
|
|
1326
|
+
* are parsed as JSON, otherwise as STEP.
|
|
1329
1327
|
*
|
|
1330
|
-
*
|
|
1328
|
+
* Only single-solid STEP files are supported. Multi-solid files will
|
|
1329
|
+
* return only the first solid.
|
|
1331
1330
|
*
|
|
1332
1331
|
* # Errors
|
|
1333
1332
|
*
|
|
1334
|
-
* Returns an error if the
|
|
1335
|
-
* @param {string}
|
|
1333
|
+
* Returns an error if the data is invalid or reconstruction fails.
|
|
1334
|
+
* @param {string} data
|
|
1336
1335
|
* @returns {number}
|
|
1337
1336
|
*/
|
|
1338
|
-
fromBREP(
|
|
1339
|
-
const ptr0 = passStringToWasm0(
|
|
1337
|
+
fromBREP(data) {
|
|
1338
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1340
1339
|
const len0 = WASM_VECTOR_LEN;
|
|
1341
1340
|
const ret = wasm.brepkernel_fromBREP(this.__wbg_ptr, ptr0, len0);
|
|
1342
1341
|
if (ret[2]) {
|
|
@@ -3362,6 +3361,23 @@ export class BrepKernel {
|
|
|
3362
3361
|
}
|
|
3363
3362
|
return ret[0] >>> 0;
|
|
3364
3363
|
}
|
|
3364
|
+
/**
|
|
3365
|
+
* Add a circle to a sketch.
|
|
3366
|
+
*
|
|
3367
|
+
* `center_idx` must be a valid point index. Returns the circle index
|
|
3368
|
+
* (0-based) for use in circle-referencing constraints.
|
|
3369
|
+
* @param {number} sketch
|
|
3370
|
+
* @param {number} center_idx
|
|
3371
|
+
* @param {number} radius
|
|
3372
|
+
* @returns {number}
|
|
3373
|
+
*/
|
|
3374
|
+
sketchAddCircle(sketch, center_idx, radius) {
|
|
3375
|
+
const ret = wasm.brepkernel_sketchAddCircle(this.__wbg_ptr, sketch, center_idx, radius);
|
|
3376
|
+
if (ret[2]) {
|
|
3377
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3378
|
+
}
|
|
3379
|
+
return ret[0] >>> 0;
|
|
3380
|
+
}
|
|
3365
3381
|
/**
|
|
3366
3382
|
* Add a constraint to a sketch from a JSON string.
|
|
3367
3383
|
*
|
|
@@ -3768,11 +3784,10 @@ export class BrepKernel {
|
|
|
3768
3784
|
return ret[0] >>> 0;
|
|
3769
3785
|
}
|
|
3770
3786
|
/**
|
|
3771
|
-
*
|
|
3787
|
+
* Export a solid as a BREP string (STEP format).
|
|
3772
3788
|
*
|
|
3773
|
-
* Returns a
|
|
3774
|
-
*
|
|
3775
|
-
* connectivity information.
|
|
3789
|
+
* Returns a STEP-formatted string containing the solid's B-Rep data.
|
|
3790
|
+
* Use `fromBREP` to reconstruct the solid from this string.
|
|
3776
3791
|
*
|
|
3777
3792
|
* # Errors
|
|
3778
3793
|
*
|
|
@@ -3787,6 +3802,43 @@ export class BrepKernel {
|
|
|
3787
3802
|
}
|
|
3788
3803
|
return takeFromExternrefTable0(ret[0]);
|
|
3789
3804
|
}
|
|
3805
|
+
/**
|
|
3806
|
+
* Export a solid as a JSON-encoded BREP representation.
|
|
3807
|
+
*
|
|
3808
|
+
* Returns a JSON string with vertices, edges (with curve parameters),
|
|
3809
|
+
* and faces (with surface parameters). This is a brepkit-specific format
|
|
3810
|
+
* that preserves all analytic geometry types.
|
|
3811
|
+
* @param {number} solid
|
|
3812
|
+
* @returns {any}
|
|
3813
|
+
*/
|
|
3814
|
+
toBrepJson(solid) {
|
|
3815
|
+
const ret = wasm.brepkernel_toBrepJson(this.__wbg_ptr, solid);
|
|
3816
|
+
if (ret[2]) {
|
|
3817
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3818
|
+
}
|
|
3819
|
+
return takeFromExternrefTable0(ret[0]);
|
|
3820
|
+
}
|
|
3821
|
+
/**
|
|
3822
|
+
* Apply a 4×4 affine transform to a face (in place).
|
|
3823
|
+
*
|
|
3824
|
+
* Transforms all vertices, edge curves, and the face surface geometry.
|
|
3825
|
+
* The `matrix` must contain exactly 16 values in row-major order.
|
|
3826
|
+
*
|
|
3827
|
+
* # Errors
|
|
3828
|
+
*
|
|
3829
|
+
* Returns an error if the face handle is invalid, the matrix doesn't
|
|
3830
|
+
* have 16 elements, or the matrix is singular.
|
|
3831
|
+
* @param {number} face
|
|
3832
|
+
* @param {Float64Array} matrix
|
|
3833
|
+
*/
|
|
3834
|
+
transformFace(face, matrix) {
|
|
3835
|
+
const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
3836
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3837
|
+
const ret = wasm.brepkernel_transformFace(this.__wbg_ptr, face, ptr0, len0);
|
|
3838
|
+
if (ret[1]) {
|
|
3839
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
3840
|
+
}
|
|
3841
|
+
}
|
|
3790
3842
|
/**
|
|
3791
3843
|
* Apply a 4×4 affine transform to a solid (in place).
|
|
3792
3844
|
*
|
package/brepkit_wasm_bg.wasm
CHANGED
|
Binary file
|
package/brepkit_wasm_node.cjs
CHANGED
|
@@ -1321,24 +1321,23 @@ class BrepKernel {
|
|
|
1321
1321
|
return ret[0] >>> 0;
|
|
1322
1322
|
}
|
|
1323
1323
|
/**
|
|
1324
|
-
* Reconstruct a solid from a
|
|
1324
|
+
* Reconstruct a solid from a BREP string.
|
|
1325
1325
|
*
|
|
1326
|
-
*
|
|
1327
|
-
*
|
|
1328
|
-
*
|
|
1329
|
-
* edge types fall back to lines; unrecognized surface types fall back
|
|
1330
|
-
* to planes computed from wire vertices.
|
|
1326
|
+
* Accepts both STEP format (from `toBREP`) and JSON format (from
|
|
1327
|
+
* `toBrepJson`). Auto-detects the format: strings starting with `{`
|
|
1328
|
+
* are parsed as JSON, otherwise as STEP.
|
|
1331
1329
|
*
|
|
1332
|
-
*
|
|
1330
|
+
* Only single-solid STEP files are supported. Multi-solid files will
|
|
1331
|
+
* return only the first solid.
|
|
1333
1332
|
*
|
|
1334
1333
|
* # Errors
|
|
1335
1334
|
*
|
|
1336
|
-
* Returns an error if the
|
|
1337
|
-
* @param {string}
|
|
1335
|
+
* Returns an error if the data is invalid or reconstruction fails.
|
|
1336
|
+
* @param {string} data
|
|
1338
1337
|
* @returns {number}
|
|
1339
1338
|
*/
|
|
1340
|
-
fromBREP(
|
|
1341
|
-
const ptr0 = passStringToWasm0(
|
|
1339
|
+
fromBREP(data) {
|
|
1340
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1342
1341
|
const len0 = WASM_VECTOR_LEN;
|
|
1343
1342
|
const ret = wasm.brepkernel_fromBREP(this.__wbg_ptr, ptr0, len0);
|
|
1344
1343
|
if (ret[2]) {
|
|
@@ -3364,6 +3363,23 @@ class BrepKernel {
|
|
|
3364
3363
|
}
|
|
3365
3364
|
return ret[0] >>> 0;
|
|
3366
3365
|
}
|
|
3366
|
+
/**
|
|
3367
|
+
* Add a circle to a sketch.
|
|
3368
|
+
*
|
|
3369
|
+
* `center_idx` must be a valid point index. Returns the circle index
|
|
3370
|
+
* (0-based) for use in circle-referencing constraints.
|
|
3371
|
+
* @param {number} sketch
|
|
3372
|
+
* @param {number} center_idx
|
|
3373
|
+
* @param {number} radius
|
|
3374
|
+
* @returns {number}
|
|
3375
|
+
*/
|
|
3376
|
+
sketchAddCircle(sketch, center_idx, radius) {
|
|
3377
|
+
const ret = wasm.brepkernel_sketchAddCircle(this.__wbg_ptr, sketch, center_idx, radius);
|
|
3378
|
+
if (ret[2]) {
|
|
3379
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3380
|
+
}
|
|
3381
|
+
return ret[0] >>> 0;
|
|
3382
|
+
}
|
|
3367
3383
|
/**
|
|
3368
3384
|
* Add a constraint to a sketch from a JSON string.
|
|
3369
3385
|
*
|
|
@@ -3770,11 +3786,10 @@ class BrepKernel {
|
|
|
3770
3786
|
return ret[0] >>> 0;
|
|
3771
3787
|
}
|
|
3772
3788
|
/**
|
|
3773
|
-
*
|
|
3789
|
+
* Export a solid as a BREP string (STEP format).
|
|
3774
3790
|
*
|
|
3775
|
-
* Returns a
|
|
3776
|
-
*
|
|
3777
|
-
* connectivity information.
|
|
3791
|
+
* Returns a STEP-formatted string containing the solid's B-Rep data.
|
|
3792
|
+
* Use `fromBREP` to reconstruct the solid from this string.
|
|
3778
3793
|
*
|
|
3779
3794
|
* # Errors
|
|
3780
3795
|
*
|
|
@@ -3789,6 +3804,43 @@ class BrepKernel {
|
|
|
3789
3804
|
}
|
|
3790
3805
|
return takeFromExternrefTable0(ret[0]);
|
|
3791
3806
|
}
|
|
3807
|
+
/**
|
|
3808
|
+
* Export a solid as a JSON-encoded BREP representation.
|
|
3809
|
+
*
|
|
3810
|
+
* Returns a JSON string with vertices, edges (with curve parameters),
|
|
3811
|
+
* and faces (with surface parameters). This is a brepkit-specific format
|
|
3812
|
+
* that preserves all analytic geometry types.
|
|
3813
|
+
* @param {number} solid
|
|
3814
|
+
* @returns {any}
|
|
3815
|
+
*/
|
|
3816
|
+
toBrepJson(solid) {
|
|
3817
|
+
const ret = wasm.brepkernel_toBrepJson(this.__wbg_ptr, solid);
|
|
3818
|
+
if (ret[2]) {
|
|
3819
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3820
|
+
}
|
|
3821
|
+
return takeFromExternrefTable0(ret[0]);
|
|
3822
|
+
}
|
|
3823
|
+
/**
|
|
3824
|
+
* Apply a 4×4 affine transform to a face (in place).
|
|
3825
|
+
*
|
|
3826
|
+
* Transforms all vertices, edge curves, and the face surface geometry.
|
|
3827
|
+
* The `matrix` must contain exactly 16 values in row-major order.
|
|
3828
|
+
*
|
|
3829
|
+
* # Errors
|
|
3830
|
+
*
|
|
3831
|
+
* Returns an error if the face handle is invalid, the matrix doesn't
|
|
3832
|
+
* have 16 elements, or the matrix is singular.
|
|
3833
|
+
* @param {number} face
|
|
3834
|
+
* @param {Float64Array} matrix
|
|
3835
|
+
*/
|
|
3836
|
+
transformFace(face, matrix) {
|
|
3837
|
+
const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
3838
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3839
|
+
const ret = wasm.brepkernel_transformFace(this.__wbg_ptr, face, ptr0, len0);
|
|
3840
|
+
if (ret[1]) {
|
|
3841
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
3842
|
+
}
|
|
3843
|
+
}
|
|
3792
3844
|
/**
|
|
3793
3845
|
* Apply a 4×4 affine transform to a solid (in place).
|
|
3794
3846
|
*
|
package/package.json
CHANGED