brepkit-wasm 2.43.2 → 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 CHANGED
@@ -596,21 +596,20 @@ export class BrepKernel {
596
596
  */
597
597
  fixFaceOrientations(solid: number): number;
598
598
  /**
599
- * Reconstruct a solid from a `toBREP` JSON string.
599
+ * Reconstruct a solid from a BREP string.
600
600
  *
601
- * Supports all edge curve types (line, circle, ellipse, NURBS) and
602
- * all surface types (plane, cylinder, cone, sphere, torus, NURBS)
603
- * via `curveParams` and `surfaceParams` in the JSON. Unrecognized
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
- * Returns a solid handle.
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 JSON is invalid or reconstruction fails.
610
+ * Returns an error if the data is invalid or reconstruction fails.
612
611
  */
613
- fromBREP(json: string): number;
612
+ fromBREP(data: string): number;
614
613
  /**
615
614
  * Fuse (union) two solids into one.
616
615
  *
@@ -1664,17 +1663,24 @@ export class BrepKernel {
1664
1663
  */
1665
1664
  thicken(face: number, thickness: number): number;
1666
1665
  /**
1667
- * Serialize a solid's B-Rep topology to JSON.
1666
+ * Export a solid as a BREP string (STEP format).
1668
1667
  *
1669
- * Returns a JSON string containing the solid's complete topology:
1670
- * vertices, edges (with curve types), faces (with surface types), and
1671
- * 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.
1672
1670
  *
1673
1671
  * # Errors
1674
1672
  *
1675
1673
  * Returns an error if the solid handle is invalid.
1676
1674
  */
1677
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;
1678
1684
  /**
1679
1685
  * Apply a 4×4 affine transform to a face (in place).
1680
1686
  *
@@ -1319,24 +1319,23 @@ export class BrepKernel {
1319
1319
  return ret[0] >>> 0;
1320
1320
  }
1321
1321
  /**
1322
- * Reconstruct a solid from a `toBREP` JSON string.
1322
+ * Reconstruct a solid from a BREP string.
1323
1323
  *
1324
- * Supports all edge curve types (line, circle, ellipse, NURBS) and
1325
- * all surface types (plane, cylinder, cone, sphere, torus, NURBS)
1326
- * via `curveParams` and `surfaceParams` in the JSON. Unrecognized
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
- * Returns a solid handle.
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 JSON is invalid or reconstruction fails.
1335
- * @param {string} json
1333
+ * Returns an error if the data is invalid or reconstruction fails.
1334
+ * @param {string} data
1336
1335
  * @returns {number}
1337
1336
  */
1338
- fromBREP(json) {
1339
- const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
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]) {
@@ -3785,11 +3784,10 @@ export class BrepKernel {
3785
3784
  return ret[0] >>> 0;
3786
3785
  }
3787
3786
  /**
3788
- * Serialize a solid's B-Rep topology to JSON.
3787
+ * Export a solid as a BREP string (STEP format).
3789
3788
  *
3790
- * Returns a JSON string containing the solid's complete topology:
3791
- * vertices, edges (with curve types), faces (with surface types), and
3792
- * 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.
3793
3791
  *
3794
3792
  * # Errors
3795
3793
  *
@@ -3804,6 +3802,22 @@ export class BrepKernel {
3804
3802
  }
3805
3803
  return takeFromExternrefTable0(ret[0]);
3806
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
+ }
3807
3821
  /**
3808
3822
  * Apply a 4×4 affine transform to a face (in place).
3809
3823
  *
Binary file
@@ -1321,24 +1321,23 @@ class BrepKernel {
1321
1321
  return ret[0] >>> 0;
1322
1322
  }
1323
1323
  /**
1324
- * Reconstruct a solid from a `toBREP` JSON string.
1324
+ * Reconstruct a solid from a BREP string.
1325
1325
  *
1326
- * Supports all edge curve types (line, circle, ellipse, NURBS) and
1327
- * all surface types (plane, cylinder, cone, sphere, torus, NURBS)
1328
- * via `curveParams` and `surfaceParams` in the JSON. Unrecognized
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
- * Returns a solid handle.
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 JSON is invalid or reconstruction fails.
1337
- * @param {string} json
1335
+ * Returns an error if the data is invalid or reconstruction fails.
1336
+ * @param {string} data
1338
1337
  * @returns {number}
1339
1338
  */
1340
- fromBREP(json) {
1341
- const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
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]) {
@@ -3787,11 +3786,10 @@ class BrepKernel {
3787
3786
  return ret[0] >>> 0;
3788
3787
  }
3789
3788
  /**
3790
- * Serialize a solid's B-Rep topology to JSON.
3789
+ * Export a solid as a BREP string (STEP format).
3791
3790
  *
3792
- * Returns a JSON string containing the solid's complete topology:
3793
- * vertices, edges (with curve types), faces (with surface types), and
3794
- * 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.
3795
3793
  *
3796
3794
  * # Errors
3797
3795
  *
@@ -3806,6 +3804,22 @@ class BrepKernel {
3806
3804
  }
3807
3805
  return takeFromExternrefTable0(ret[0]);
3808
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
+ }
3809
3823
  /**
3810
3824
  * Apply a 4×4 affine transform to a face (in place).
3811
3825
  *
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": "2.43.2",
5
+ "version": "2.43.3",
6
6
  "license": "MIT OR Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",