brepkit-wasm 4.11.17 → 4.11.19

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 CHANGED
@@ -20,6 +20,20 @@ export interface UvMeshResult {
20
20
  uvs: number[];
21
21
  }
22
22
 
23
+ /**
24
+ * Typed result for the `import*Parts` mesh imports.
25
+ */
26
+ export interface MeshImportResult {
27
+ /**
28
+ * A solid handle for each closed body, cavities included.
29
+ */
30
+ solids: number[];
31
+ /**
32
+ * A shell handle for each body that does not close.
33
+ */
34
+ shells: number[];
35
+ }
36
+
23
37
 
24
38
  /**
25
39
  * The B-Rep modeling kernel.
@@ -1077,6 +1091,18 @@ export class BrepKernel {
1077
1091
  * Returns an error if parameters are invalid or the sweep fails.
1078
1092
  */
1079
1093
  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;
1094
+ /**
1095
+ * Import a 3MF file, one entry for each object and one handle for each
1096
+ * body of the object.
1097
+ *
1098
+ * Returns a JSON string: an array of `{ solids, shells }`, in the
1099
+ * order of the objects in the archive.
1100
+ *
1101
+ * # Errors
1102
+ *
1103
+ * Returns an error if the 3MF data is malformed.
1104
+ */
1105
+ import3mfParts(data: Uint8Array | number[]): string;
1080
1106
  /**
1081
1107
  * Import a 3MF file and return solid handles.
1082
1108
  *
@@ -1087,6 +1113,16 @@ export class BrepKernel {
1087
1113
  * Returns an error if the 3MF data is malformed.
1088
1114
  */
1089
1115
  import3mf(data: Uint8Array | number[]): Uint32Array;
1116
+ /**
1117
+ * Import a GLB (glTF binary) file, one handle for each body.
1118
+ *
1119
+ * Returns the same JSON string as `importStlParts`.
1120
+ *
1121
+ * # Errors
1122
+ *
1123
+ * Returns an error if the file is malformed or has no triangle.
1124
+ */
1125
+ importGlbParts(data: Uint8Array | number[]): string;
1090
1126
  /**
1091
1127
  * Import a GLB (glTF binary) file and return a solid handle.
1092
1128
  *
@@ -1103,6 +1139,18 @@ export class BrepKernel {
1103
1139
  * Returns an error if the IGES data is malformed.
1104
1140
  */
1105
1141
  importIges(data: Uint8Array | number[]): Uint32Array;
1142
+ /**
1143
+ * Import a triangle mesh from flat vertex/index arrays, one handle for
1144
+ * each body.
1145
+ *
1146
+ * The arrays are those of `importIndexedMesh`. Returns the same JSON
1147
+ * string as `importStlParts`.
1148
+ *
1149
+ * # Errors
1150
+ *
1151
+ * Returns an error if the arrays are malformed or have no triangle.
1152
+ */
1153
+ importIndexedMeshParts(positions: Float64Array | number[], indices: Uint32Array | number[]): string;
1106
1154
  /**
1107
1155
  * Import a triangle mesh from flat vertex/index arrays.
1108
1156
  *
@@ -1112,9 +1160,21 @@ export class BrepKernel {
1112
1160
  *
1113
1161
  * # Errors
1114
1162
  *
1115
- * Returns an error if the arrays are malformed or mesh import fails.
1163
+ * Returns an error if the arrays are malformed, a part of the mesh
1164
+ * does not close, or a body lies in the material of another.
1165
+ * `importIndexedMeshParts` returns each part of such a mesh.
1116
1166
  */
1117
1167
  importIndexedMesh(positions: Float64Array | number[], indices: Uint32Array | number[]): number;
1168
+ /**
1169
+ * Import an OBJ file, one handle for each body.
1170
+ *
1171
+ * Returns the same JSON string as `importStlParts`.
1172
+ *
1173
+ * # Errors
1174
+ *
1175
+ * Returns an error if the file is malformed or has no triangle.
1176
+ */
1177
+ importObjParts(data: Uint8Array | number[]): string;
1118
1178
  /**
1119
1179
  * Import an OBJ file and return a solid handle.
1120
1180
  *
@@ -1133,15 +1193,30 @@ export class BrepKernel {
1133
1193
  * Returns an error if the STEP data is malformed.
1134
1194
  */
1135
1195
  importStep(data: Uint8Array | number[]): Uint32Array;
1196
+ /**
1197
+ * Import an STL file (binary or ASCII), one handle for each body.
1198
+ *
1199
+ * Returns a JSON string `{ solids: number[], shells: number[] }`. A
1200
+ * closed body is a solid, with each inward closed body in it as a
1201
+ * cavity. A body that does not close is a shell.
1202
+ *
1203
+ * # Errors
1204
+ *
1205
+ * Returns an error if the STL data is malformed or empty.
1206
+ */
1207
+ importStlParts(data: Uint8Array | number[]): string;
1136
1208
  /**
1137
1209
  * Import an STL file (binary or ASCII) and return a solid handle.
1138
1210
  *
1139
1211
  * The mesh triangles are converted to planar B-Rep faces with
1140
- * vertex merging.
1212
+ * vertex merging, and triangles that meet at an edge share it. Two or
1213
+ * more closed bodies come back as the pieces of one solid.
1141
1214
  *
1142
1215
  * # Errors
1143
1216
  *
1144
- * Returns an error if the STL data is malformed or empty.
1217
+ * Returns an error if the STL data is malformed or empty, a part of
1218
+ * the mesh does not close, or a body lies in the material of another.
1219
+ * `importStlParts` returns each part of such a mesh.
1145
1220
  */
1146
1221
  importStl(data: Uint8Array | number[]): number;
1147
1222
  /**
@@ -2530,6 +2530,39 @@ export class BrepKernel {
2530
2530
  }
2531
2531
  return ret[0] >>> 0;
2532
2532
  }
2533
+ /**
2534
+ * Import a 3MF file, one entry for each object and one handle for each
2535
+ * body of the object.
2536
+ *
2537
+ * Returns a JSON string: an array of `{ solids, shells }`, in the
2538
+ * order of the objects in the archive.
2539
+ *
2540
+ * # Errors
2541
+ *
2542
+ * Returns an error if the 3MF data is malformed.
2543
+ * @param {Uint8Array | number[]} data
2544
+ * @returns {string}
2545
+ */
2546
+ import3mfParts(data) {
2547
+ let deferred3_0;
2548
+ let deferred3_1;
2549
+ try {
2550
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
2551
+ const len0 = WASM_VECTOR_LEN;
2552
+ const ret = wasm.brepkernel_import3mfParts(this.__wbg_ptr, ptr0, len0);
2553
+ var ptr2 = ret[0];
2554
+ var len2 = ret[1];
2555
+ if (ret[3]) {
2556
+ ptr2 = 0; len2 = 0;
2557
+ throw takeFromExternrefTable0(ret[2]);
2558
+ }
2559
+ deferred3_0 = ptr2;
2560
+ deferred3_1 = len2;
2561
+ return getStringFromWasm0(ptr2, len2);
2562
+ } finally {
2563
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2564
+ }
2565
+ }
2533
2566
  /**
2534
2567
  * Import a 3MF file and return solid handles.
2535
2568
  *
@@ -2552,6 +2585,37 @@ export class BrepKernel {
2552
2585
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2553
2586
  return v2;
2554
2587
  }
2588
+ /**
2589
+ * Import a GLB (glTF binary) file, one handle for each body.
2590
+ *
2591
+ * Returns the same JSON string as `importStlParts`.
2592
+ *
2593
+ * # Errors
2594
+ *
2595
+ * Returns an error if the file is malformed or has no triangle.
2596
+ * @param {Uint8Array | number[]} data
2597
+ * @returns {string}
2598
+ */
2599
+ importGlbParts(data) {
2600
+ let deferred3_0;
2601
+ let deferred3_1;
2602
+ try {
2603
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
2604
+ const len0 = WASM_VECTOR_LEN;
2605
+ const ret = wasm.brepkernel_importGlbParts(this.__wbg_ptr, ptr0, len0);
2606
+ var ptr2 = ret[0];
2607
+ var len2 = ret[1];
2608
+ if (ret[3]) {
2609
+ ptr2 = 0; len2 = 0;
2610
+ throw takeFromExternrefTable0(ret[2]);
2611
+ }
2612
+ deferred3_0 = ptr2;
2613
+ deferred3_1 = len2;
2614
+ return getStringFromWasm0(ptr2, len2);
2615
+ } finally {
2616
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2617
+ }
2618
+ }
2555
2619
  /**
2556
2620
  * Import a GLB (glTF binary) file and return a solid handle.
2557
2621
  *
@@ -2590,6 +2654,49 @@ export class BrepKernel {
2590
2654
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2591
2655
  return v2;
2592
2656
  }
2657
+ /**
2658
+ * Import a triangle mesh from flat vertex/index arrays, one handle for
2659
+ * each body.
2660
+ *
2661
+ * The arrays are those of `importIndexedMesh`. Returns the same JSON
2662
+ * string as `importStlParts`.
2663
+ *
2664
+ * # Errors
2665
+ *
2666
+ * Returns an error if the arrays are malformed or have no triangle.
2667
+ * @param {Float64Array | number[]} positions
2668
+ * @param {Uint32Array | number[]} indices
2669
+ * @returns {string}
2670
+ */
2671
+ importIndexedMeshParts(positions, indices) {
2672
+ let deferred4_0;
2673
+ let deferred4_1;
2674
+ try {
2675
+ let ptr0, len0, ptr1, len1;
2676
+ try {
2677
+ ptr0 = passArrayF64ToWasm0(positions, wasm.__wbindgen_malloc);
2678
+ len0 = WASM_VECTOR_LEN;
2679
+ ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);
2680
+ len1 = WASM_VECTOR_LEN;
2681
+ } catch (e) {
2682
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 4, 4); }
2683
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
2684
+ throw e;
2685
+ }
2686
+ const ret = wasm.brepkernel_importIndexedMeshParts(this.__wbg_ptr, ptr0, len0, ptr1, len1);
2687
+ var ptr3 = ret[0];
2688
+ var len3 = ret[1];
2689
+ if (ret[3]) {
2690
+ ptr3 = 0; len3 = 0;
2691
+ throw takeFromExternrefTable0(ret[2]);
2692
+ }
2693
+ deferred4_0 = ptr3;
2694
+ deferred4_1 = len3;
2695
+ return getStringFromWasm0(ptr3, len3);
2696
+ } finally {
2697
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2698
+ }
2699
+ }
2593
2700
  /**
2594
2701
  * Import a triangle mesh from flat vertex/index arrays.
2595
2702
  *
@@ -2599,7 +2706,9 @@ export class BrepKernel {
2599
2706
  *
2600
2707
  * # Errors
2601
2708
  *
2602
- * Returns an error if the arrays are malformed or mesh import fails.
2709
+ * Returns an error if the arrays are malformed, a part of the mesh
2710
+ * does not close, or a body lies in the material of another.
2711
+ * `importIndexedMeshParts` returns each part of such a mesh.
2603
2712
  * @param {Float64Array | number[]} positions
2604
2713
  * @param {Uint32Array | number[]} indices
2605
2714
  * @returns {number}
@@ -2622,6 +2731,37 @@ export class BrepKernel {
2622
2731
  }
2623
2732
  return ret[0] >>> 0;
2624
2733
  }
2734
+ /**
2735
+ * Import an OBJ file, one handle for each body.
2736
+ *
2737
+ * Returns the same JSON string as `importStlParts`.
2738
+ *
2739
+ * # Errors
2740
+ *
2741
+ * Returns an error if the file is malformed or has no triangle.
2742
+ * @param {Uint8Array | number[]} data
2743
+ * @returns {string}
2744
+ */
2745
+ importObjParts(data) {
2746
+ let deferred3_0;
2747
+ let deferred3_1;
2748
+ try {
2749
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
2750
+ const len0 = WASM_VECTOR_LEN;
2751
+ const ret = wasm.brepkernel_importObjParts(this.__wbg_ptr, ptr0, len0);
2752
+ var ptr2 = ret[0];
2753
+ var len2 = ret[1];
2754
+ if (ret[3]) {
2755
+ ptr2 = 0; len2 = 0;
2756
+ throw takeFromExternrefTable0(ret[2]);
2757
+ }
2758
+ deferred3_0 = ptr2;
2759
+ deferred3_1 = len2;
2760
+ return getStringFromWasm0(ptr2, len2);
2761
+ } finally {
2762
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2763
+ }
2764
+ }
2625
2765
  /**
2626
2766
  * Import an OBJ file and return a solid handle.
2627
2767
  *
@@ -2662,15 +2802,51 @@ export class BrepKernel {
2662
2802
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2663
2803
  return v2;
2664
2804
  }
2805
+ /**
2806
+ * Import an STL file (binary or ASCII), one handle for each body.
2807
+ *
2808
+ * Returns a JSON string `{ solids: number[], shells: number[] }`. A
2809
+ * closed body is a solid, with each inward closed body in it as a
2810
+ * cavity. A body that does not close is a shell.
2811
+ *
2812
+ * # Errors
2813
+ *
2814
+ * Returns an error if the STL data is malformed or empty.
2815
+ * @param {Uint8Array | number[]} data
2816
+ * @returns {string}
2817
+ */
2818
+ importStlParts(data) {
2819
+ let deferred3_0;
2820
+ let deferred3_1;
2821
+ try {
2822
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
2823
+ const len0 = WASM_VECTOR_LEN;
2824
+ const ret = wasm.brepkernel_importStlParts(this.__wbg_ptr, ptr0, len0);
2825
+ var ptr2 = ret[0];
2826
+ var len2 = ret[1];
2827
+ if (ret[3]) {
2828
+ ptr2 = 0; len2 = 0;
2829
+ throw takeFromExternrefTable0(ret[2]);
2830
+ }
2831
+ deferred3_0 = ptr2;
2832
+ deferred3_1 = len2;
2833
+ return getStringFromWasm0(ptr2, len2);
2834
+ } finally {
2835
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2836
+ }
2837
+ }
2665
2838
  /**
2666
2839
  * Import an STL file (binary or ASCII) and return a solid handle.
2667
2840
  *
2668
2841
  * The mesh triangles are converted to planar B-Rep faces with
2669
- * vertex merging.
2842
+ * vertex merging, and triangles that meet at an edge share it. Two or
2843
+ * more closed bodies come back as the pieces of one solid.
2670
2844
  *
2671
2845
  * # Errors
2672
2846
  *
2673
- * Returns an error if the STL data is malformed or empty.
2847
+ * Returns an error if the STL data is malformed or empty, a part of
2848
+ * the mesh does not close, or a body lies in the material of another.
2849
+ * `importStlParts` returns each part of such a mesh.
2674
2850
  * @param {Uint8Array | number[]} data
2675
2851
  * @returns {number}
2676
2852
  */
@@ -5937,16 +6113,16 @@ export function __wbg___wbindgen_debug_string_f249a2a76caa9a55(arg0, arg1) {
5937
6113
  export function __wbg___wbindgen_throw_4c88d8bf264fd984(arg0, arg1) {
5938
6114
  throw new Error(getStringFromWasm0(arg0, arg1));
5939
6115
  }
5940
- export function __wbg_error_7b7edfcf947eaefd(arg0, arg1) {
6116
+ export function __wbg_error_d5592256b6267425(arg0, arg1) {
5941
6117
  console.error(getStringFromWasm0(arg0, arg1));
5942
6118
  }
5943
6119
  export function __wbg_getRandomValues_8b6f1f663e6f188d() { return handleError(function (arg0, arg1) {
5944
6120
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
5945
6121
  }, arguments); }
5946
- export function __wbg_log_a1b3fd7ef77d4de0(arg0, arg1) {
6122
+ export function __wbg_log_ad1f7c9caf6035ee(arg0, arg1) {
5947
6123
  console.log(getStringFromWasm0(arg0, arg1));
5948
6124
  }
5949
- export function __wbg_warn_de83fbe5e9b83791(arg0, arg1) {
6125
+ export function __wbg_warn_348febe051d473b5(arg0, arg1) {
5950
6126
  console.warn(getStringFromWasm0(arg0, arg1));
5951
6127
  }
5952
6128
  export function __wbindgen_generic_0000000000000001(arg0, arg1) {
Binary file
@@ -2532,6 +2532,39 @@ class BrepKernel {
2532
2532
  }
2533
2533
  return ret[0] >>> 0;
2534
2534
  }
2535
+ /**
2536
+ * Import a 3MF file, one entry for each object and one handle for each
2537
+ * body of the object.
2538
+ *
2539
+ * Returns a JSON string: an array of `{ solids, shells }`, in the
2540
+ * order of the objects in the archive.
2541
+ *
2542
+ * # Errors
2543
+ *
2544
+ * Returns an error if the 3MF data is malformed.
2545
+ * @param {Uint8Array | number[]} data
2546
+ * @returns {string}
2547
+ */
2548
+ import3mfParts(data) {
2549
+ let deferred3_0;
2550
+ let deferred3_1;
2551
+ try {
2552
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
2553
+ const len0 = WASM_VECTOR_LEN;
2554
+ const ret = wasm.brepkernel_import3mfParts(this.__wbg_ptr, ptr0, len0);
2555
+ var ptr2 = ret[0];
2556
+ var len2 = ret[1];
2557
+ if (ret[3]) {
2558
+ ptr2 = 0; len2 = 0;
2559
+ throw takeFromExternrefTable0(ret[2]);
2560
+ }
2561
+ deferred3_0 = ptr2;
2562
+ deferred3_1 = len2;
2563
+ return getStringFromWasm0(ptr2, len2);
2564
+ } finally {
2565
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2566
+ }
2567
+ }
2535
2568
  /**
2536
2569
  * Import a 3MF file and return solid handles.
2537
2570
  *
@@ -2554,6 +2587,37 @@ class BrepKernel {
2554
2587
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2555
2588
  return v2;
2556
2589
  }
2590
+ /**
2591
+ * Import a GLB (glTF binary) file, one handle for each body.
2592
+ *
2593
+ * Returns the same JSON string as `importStlParts`.
2594
+ *
2595
+ * # Errors
2596
+ *
2597
+ * Returns an error if the file is malformed or has no triangle.
2598
+ * @param {Uint8Array | number[]} data
2599
+ * @returns {string}
2600
+ */
2601
+ importGlbParts(data) {
2602
+ let deferred3_0;
2603
+ let deferred3_1;
2604
+ try {
2605
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
2606
+ const len0 = WASM_VECTOR_LEN;
2607
+ const ret = wasm.brepkernel_importGlbParts(this.__wbg_ptr, ptr0, len0);
2608
+ var ptr2 = ret[0];
2609
+ var len2 = ret[1];
2610
+ if (ret[3]) {
2611
+ ptr2 = 0; len2 = 0;
2612
+ throw takeFromExternrefTable0(ret[2]);
2613
+ }
2614
+ deferred3_0 = ptr2;
2615
+ deferred3_1 = len2;
2616
+ return getStringFromWasm0(ptr2, len2);
2617
+ } finally {
2618
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2619
+ }
2620
+ }
2557
2621
  /**
2558
2622
  * Import a GLB (glTF binary) file and return a solid handle.
2559
2623
  *
@@ -2592,6 +2656,49 @@ class BrepKernel {
2592
2656
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2593
2657
  return v2;
2594
2658
  }
2659
+ /**
2660
+ * Import a triangle mesh from flat vertex/index arrays, one handle for
2661
+ * each body.
2662
+ *
2663
+ * The arrays are those of `importIndexedMesh`. Returns the same JSON
2664
+ * string as `importStlParts`.
2665
+ *
2666
+ * # Errors
2667
+ *
2668
+ * Returns an error if the arrays are malformed or have no triangle.
2669
+ * @param {Float64Array | number[]} positions
2670
+ * @param {Uint32Array | number[]} indices
2671
+ * @returns {string}
2672
+ */
2673
+ importIndexedMeshParts(positions, indices) {
2674
+ let deferred4_0;
2675
+ let deferred4_1;
2676
+ try {
2677
+ let ptr0, len0, ptr1, len1;
2678
+ try {
2679
+ ptr0 = passArrayF64ToWasm0(positions, wasm.__wbindgen_malloc);
2680
+ len0 = WASM_VECTOR_LEN;
2681
+ ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);
2682
+ len1 = WASM_VECTOR_LEN;
2683
+ } catch (e) {
2684
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 4, 4); }
2685
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
2686
+ throw e;
2687
+ }
2688
+ const ret = wasm.brepkernel_importIndexedMeshParts(this.__wbg_ptr, ptr0, len0, ptr1, len1);
2689
+ var ptr3 = ret[0];
2690
+ var len3 = ret[1];
2691
+ if (ret[3]) {
2692
+ ptr3 = 0; len3 = 0;
2693
+ throw takeFromExternrefTable0(ret[2]);
2694
+ }
2695
+ deferred4_0 = ptr3;
2696
+ deferred4_1 = len3;
2697
+ return getStringFromWasm0(ptr3, len3);
2698
+ } finally {
2699
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2700
+ }
2701
+ }
2595
2702
  /**
2596
2703
  * Import a triangle mesh from flat vertex/index arrays.
2597
2704
  *
@@ -2601,7 +2708,9 @@ class BrepKernel {
2601
2708
  *
2602
2709
  * # Errors
2603
2710
  *
2604
- * Returns an error if the arrays are malformed or mesh import fails.
2711
+ * Returns an error if the arrays are malformed, a part of the mesh
2712
+ * does not close, or a body lies in the material of another.
2713
+ * `importIndexedMeshParts` returns each part of such a mesh.
2605
2714
  * @param {Float64Array | number[]} positions
2606
2715
  * @param {Uint32Array | number[]} indices
2607
2716
  * @returns {number}
@@ -2624,6 +2733,37 @@ class BrepKernel {
2624
2733
  }
2625
2734
  return ret[0] >>> 0;
2626
2735
  }
2736
+ /**
2737
+ * Import an OBJ file, one handle for each body.
2738
+ *
2739
+ * Returns the same JSON string as `importStlParts`.
2740
+ *
2741
+ * # Errors
2742
+ *
2743
+ * Returns an error if the file is malformed or has no triangle.
2744
+ * @param {Uint8Array | number[]} data
2745
+ * @returns {string}
2746
+ */
2747
+ importObjParts(data) {
2748
+ let deferred3_0;
2749
+ let deferred3_1;
2750
+ try {
2751
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
2752
+ const len0 = WASM_VECTOR_LEN;
2753
+ const ret = wasm.brepkernel_importObjParts(this.__wbg_ptr, ptr0, len0);
2754
+ var ptr2 = ret[0];
2755
+ var len2 = ret[1];
2756
+ if (ret[3]) {
2757
+ ptr2 = 0; len2 = 0;
2758
+ throw takeFromExternrefTable0(ret[2]);
2759
+ }
2760
+ deferred3_0 = ptr2;
2761
+ deferred3_1 = len2;
2762
+ return getStringFromWasm0(ptr2, len2);
2763
+ } finally {
2764
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2765
+ }
2766
+ }
2627
2767
  /**
2628
2768
  * Import an OBJ file and return a solid handle.
2629
2769
  *
@@ -2664,15 +2804,51 @@ class BrepKernel {
2664
2804
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2665
2805
  return v2;
2666
2806
  }
2807
+ /**
2808
+ * Import an STL file (binary or ASCII), one handle for each body.
2809
+ *
2810
+ * Returns a JSON string `{ solids: number[], shells: number[] }`. A
2811
+ * closed body is a solid, with each inward closed body in it as a
2812
+ * cavity. A body that does not close is a shell.
2813
+ *
2814
+ * # Errors
2815
+ *
2816
+ * Returns an error if the STL data is malformed or empty.
2817
+ * @param {Uint8Array | number[]} data
2818
+ * @returns {string}
2819
+ */
2820
+ importStlParts(data) {
2821
+ let deferred3_0;
2822
+ let deferred3_1;
2823
+ try {
2824
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
2825
+ const len0 = WASM_VECTOR_LEN;
2826
+ const ret = wasm.brepkernel_importStlParts(this.__wbg_ptr, ptr0, len0);
2827
+ var ptr2 = ret[0];
2828
+ var len2 = ret[1];
2829
+ if (ret[3]) {
2830
+ ptr2 = 0; len2 = 0;
2831
+ throw takeFromExternrefTable0(ret[2]);
2832
+ }
2833
+ deferred3_0 = ptr2;
2834
+ deferred3_1 = len2;
2835
+ return getStringFromWasm0(ptr2, len2);
2836
+ } finally {
2837
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2838
+ }
2839
+ }
2667
2840
  /**
2668
2841
  * Import an STL file (binary or ASCII) and return a solid handle.
2669
2842
  *
2670
2843
  * The mesh triangles are converted to planar B-Rep faces with
2671
- * vertex merging.
2844
+ * vertex merging, and triangles that meet at an edge share it. Two or
2845
+ * more closed bodies come back as the pieces of one solid.
2672
2846
  *
2673
2847
  * # Errors
2674
2848
  *
2675
- * Returns an error if the STL data is malformed or empty.
2849
+ * Returns an error if the STL data is malformed or empty, a part of
2850
+ * the mesh does not close, or a body lies in the material of another.
2851
+ * `importStlParts` returns each part of such a mesh.
2676
2852
  * @param {Uint8Array | number[]} data
2677
2853
  * @returns {number}
2678
2854
  */
@@ -5951,16 +6127,16 @@ function __wbg_get_imports() {
5951
6127
  __wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
5952
6128
  throw new Error(getStringFromWasm0(arg0, arg1));
5953
6129
  },
5954
- __wbg_error_7b7edfcf947eaefd: function(arg0, arg1) {
6130
+ __wbg_error_d5592256b6267425: function(arg0, arg1) {
5955
6131
  console.error(getStringFromWasm0(arg0, arg1));
5956
6132
  },
5957
6133
  __wbg_getRandomValues_8b6f1f663e6f188d: function() { return handleError(function (arg0, arg1) {
5958
6134
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
5959
6135
  }, arguments); },
5960
- __wbg_log_a1b3fd7ef77d4de0: function(arg0, arg1) {
6136
+ __wbg_log_ad1f7c9caf6035ee: function(arg0, arg1) {
5961
6137
  console.log(getStringFromWasm0(arg0, arg1));
5962
6138
  },
5963
- __wbg_warn_de83fbe5e9b83791: function(arg0, arg1) {
6139
+ __wbg_warn_348febe051d473b5: function(arg0, arg1) {
5964
6140
  console.warn(getStringFromWasm0(arg0, arg1));
5965
6141
  },
5966
6142
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "brepkit-wasm",
3
3
  "type": "module",
4
4
  "description": "WebAssembly bindings for brepkit — browser-native B-Rep solid modeling",
5
- "version": "4.11.17",
5
+ "version": "4.11.19",
6
6
  "license": "AGPL-3.0-only",
7
7
  "repository": {
8
8
  "type": "git",