brepkit-wasm 2.44.1 → 2.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/brepkit_wasm.d.ts CHANGED
@@ -254,6 +254,23 @@ export class BrepKernel {
254
254
  * Returns an error if any handle is invalid or the operation fails.
255
255
  */
256
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
+ * Equivalent to OCCT's `BRepBuilderAPI_NurbsConvert`. Stored pcurves are
266
+ * dropped during conversion — callers that depend on pcurves should
267
+ * 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;
257
274
  /**
258
275
  * Build a convex hull solid from a point cloud.
259
276
  *
@@ -553,6 +553,31 @@ export class BrepKernel {
553
553
  }
554
554
  return ret[0] >>> 0;
555
555
  }
556
+ /**
557
+ * Convert all analytic geometry in a solid to NURBS representation.
558
+ *
559
+ * Replaces planes, cylinders, cones, spheres, tori with NURBS surfaces and
560
+ * lines, circles, ellipses with NURBS curves. NURBS surfaces and curves
561
+ * already in the model are left untouched. Returns the number of entities
562
+ * converted.
563
+ *
564
+ * Equivalent to OCCT's `BRepBuilderAPI_NurbsConvert`. Stored pcurves are
565
+ * dropped during conversion — callers that depend on pcurves should
566
+ * recompute them afterwards.
567
+ *
568
+ * # Errors
569
+ *
570
+ * Returns an error if the solid handle is invalid or conversion fails.
571
+ * @param {number} solid
572
+ * @returns {number}
573
+ */
574
+ convertToBspline(solid) {
575
+ const ret = wasm.brepkernel_convertToBspline(this.__wbg_ptr, solid);
576
+ if (ret[2]) {
577
+ throw takeFromExternrefTable0(ret[1]);
578
+ }
579
+ return ret[0] >>> 0;
580
+ }
556
581
  /**
557
582
  * Build a convex hull solid from a point cloud.
558
583
  *
@@ -2880,7 +2905,7 @@ export class BrepKernel {
2880
2905
  */
2881
2906
  constructor() {
2882
2907
  const ret = wasm.brepkernel_new();
2883
- this.__wbg_ptr = ret >>> 0;
2908
+ this.__wbg_ptr = ret;
2884
2909
  BrepKernelFinalization.register(this, this.__wbg_ptr, this);
2885
2910
  return this;
2886
2911
  }
@@ -4074,7 +4099,6 @@ if (Symbol.dispose) BrepKernel.prototype[Symbol.dispose] = BrepKernel.prototype.
4074
4099
  */
4075
4100
  export class JsEdgeLines {
4076
4101
  static __wrap(ptr) {
4077
- ptr = ptr >>> 0;
4078
4102
  const obj = Object.create(JsEdgeLines.prototype);
4079
4103
  obj.__wbg_ptr = ptr;
4080
4104
  JsEdgeLinesFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -4146,7 +4170,6 @@ if (Symbol.dispose) JsEdgeLines.prototype[Symbol.dispose] = JsEdgeLines.prototyp
4146
4170
  */
4147
4171
  export class JsMesh {
4148
4172
  static __wrap(ptr) {
4149
- ptr = ptr >>> 0;
4150
4173
  const obj = Object.create(JsMesh.prototype);
4151
4174
  obj.__wbg_ptr = ptr;
4152
4175
  JsMeshFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -4273,7 +4296,7 @@ export class JsPoint3 {
4273
4296
  */
4274
4297
  constructor(x, y, z) {
4275
4298
  const ret = wasm.jspoint3_new(x, y, z);
4276
- this.__wbg_ptr = ret >>> 0;
4299
+ this.__wbg_ptr = ret;
4277
4300
  JsPoint3Finalization.register(this, this.__wbg_ptr, this);
4278
4301
  return this;
4279
4302
  }
@@ -4355,7 +4378,7 @@ export class JsVec3 {
4355
4378
  */
4356
4379
  constructor(x, y, z) {
4357
4380
  const ret = wasm.jsvec3_new(x, y, z);
4358
- this.__wbg_ptr = ret >>> 0;
4381
+ this.__wbg_ptr = ret;
4359
4382
  JsVec3Finalization.register(this, this.__wbg_ptr, this);
4360
4383
  return this;
4361
4384
  }
@@ -4382,18 +4405,18 @@ export class JsVec3 {
4382
4405
  }
4383
4406
  }
4384
4407
  if (Symbol.dispose) JsVec3.prototype[Symbol.dispose] = JsVec3.prototype.free;
4385
- export function __wbg_Error_960c155d3d49e4c2(arg0, arg1) {
4408
+ export function __wbg_Error_3639a60ed15f87e7(arg0, arg1) {
4386
4409
  const ret = Error(getStringFromWasm0(arg0, arg1));
4387
4410
  return ret;
4388
4411
  }
4389
- export function __wbg___wbindgen_debug_string_ab4b34d23d6778bd(arg0, arg1) {
4412
+ export function __wbg___wbindgen_debug_string_07cb72cfcc952e2b(arg0, arg1) {
4390
4413
  const ret = debugString(arg1);
4391
4414
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4392
4415
  const len1 = WASM_VECTOR_LEN;
4393
4416
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4394
4417
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4395
4418
  }
4396
- export function __wbg___wbindgen_throw_6b64449b9b9ed33c(arg0, arg1) {
4419
+ export function __wbg___wbindgen_throw_9c75d47bf9e7731e(arg0, arg1) {
4397
4420
  throw new Error(getStringFromWasm0(arg0, arg1));
4398
4421
  }
4399
4422
  export function __wbindgen_cast_0000000000000001(arg0, arg1) {
@@ -4412,19 +4435,19 @@ export function __wbindgen_init_externref_table() {
4412
4435
  }
4413
4436
  const BrepKernelFinalization = (typeof FinalizationRegistry === 'undefined')
4414
4437
  ? { register: () => {}, unregister: () => {} }
4415
- : new FinalizationRegistry(ptr => wasm.__wbg_brepkernel_free(ptr >>> 0, 1));
4438
+ : new FinalizationRegistry(ptr => wasm.__wbg_brepkernel_free(ptr, 1));
4416
4439
  const JsEdgeLinesFinalization = (typeof FinalizationRegistry === 'undefined')
4417
4440
  ? { register: () => {}, unregister: () => {} }
4418
- : new FinalizationRegistry(ptr => wasm.__wbg_jsedgelines_free(ptr >>> 0, 1));
4441
+ : new FinalizationRegistry(ptr => wasm.__wbg_jsedgelines_free(ptr, 1));
4419
4442
  const JsMeshFinalization = (typeof FinalizationRegistry === 'undefined')
4420
4443
  ? { register: () => {}, unregister: () => {} }
4421
- : new FinalizationRegistry(ptr => wasm.__wbg_jsmesh_free(ptr >>> 0, 1));
4444
+ : new FinalizationRegistry(ptr => wasm.__wbg_jsmesh_free(ptr, 1));
4422
4445
  const JsPoint3Finalization = (typeof FinalizationRegistry === 'undefined')
4423
4446
  ? { register: () => {}, unregister: () => {} }
4424
- : new FinalizationRegistry(ptr => wasm.__wbg_jspoint3_free(ptr >>> 0, 1));
4447
+ : new FinalizationRegistry(ptr => wasm.__wbg_jspoint3_free(ptr, 1));
4425
4448
  const JsVec3Finalization = (typeof FinalizationRegistry === 'undefined')
4426
4449
  ? { register: () => {}, unregister: () => {} }
4427
- : new FinalizationRegistry(ptr => wasm.__wbg_jsvec3_free(ptr >>> 0, 1));
4450
+ : new FinalizationRegistry(ptr => wasm.__wbg_jsvec3_free(ptr, 1));
4428
4451
 
4429
4452
  function debugString(val) {
4430
4453
  // primitive types
@@ -4523,8 +4546,7 @@ function getFloat64ArrayMemory0() {
4523
4546
  }
4524
4547
 
4525
4548
  function getStringFromWasm0(ptr, len) {
4526
- ptr = ptr >>> 0;
4527
- return decodeText(ptr, len);
4549
+ return decodeText(ptr >>> 0, len);
4528
4550
  }
4529
4551
 
4530
4552
  let cachedUint32ArrayMemory0 = null;
Binary file
@@ -555,6 +555,31 @@ class BrepKernel {
555
555
  }
556
556
  return ret[0] >>> 0;
557
557
  }
558
+ /**
559
+ * Convert all analytic geometry in a solid to NURBS representation.
560
+ *
561
+ * Replaces planes, cylinders, cones, spheres, tori with NURBS surfaces and
562
+ * lines, circles, ellipses with NURBS curves. NURBS surfaces and curves
563
+ * already in the model are left untouched. Returns the number of entities
564
+ * converted.
565
+ *
566
+ * Equivalent to OCCT's `BRepBuilderAPI_NurbsConvert`. Stored pcurves are
567
+ * dropped during conversion — callers that depend on pcurves should
568
+ * recompute them afterwards.
569
+ *
570
+ * # Errors
571
+ *
572
+ * Returns an error if the solid handle is invalid or conversion fails.
573
+ * @param {number} solid
574
+ * @returns {number}
575
+ */
576
+ convertToBspline(solid) {
577
+ const ret = wasm.brepkernel_convertToBspline(this.__wbg_ptr, solid);
578
+ if (ret[2]) {
579
+ throw takeFromExternrefTable0(ret[1]);
580
+ }
581
+ return ret[0] >>> 0;
582
+ }
558
583
  /**
559
584
  * Build a convex hull solid from a point cloud.
560
585
  *
@@ -2882,7 +2907,7 @@ class BrepKernel {
2882
2907
  */
2883
2908
  constructor() {
2884
2909
  const ret = wasm.brepkernel_new();
2885
- this.__wbg_ptr = ret >>> 0;
2910
+ this.__wbg_ptr = ret;
2886
2911
  BrepKernelFinalization.register(this, this.__wbg_ptr, this);
2887
2912
  return this;
2888
2913
  }
@@ -4077,7 +4102,6 @@ exports.BrepKernel = BrepKernel;
4077
4102
  */
4078
4103
  class JsEdgeLines {
4079
4104
  static __wrap(ptr) {
4080
- ptr = ptr >>> 0;
4081
4105
  const obj = Object.create(JsEdgeLines.prototype);
4082
4106
  obj.__wbg_ptr = ptr;
4083
4107
  JsEdgeLinesFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -4150,7 +4174,6 @@ exports.JsEdgeLines = JsEdgeLines;
4150
4174
  */
4151
4175
  class JsMesh {
4152
4176
  static __wrap(ptr) {
4153
- ptr = ptr >>> 0;
4154
4177
  const obj = Object.create(JsMesh.prototype);
4155
4178
  obj.__wbg_ptr = ptr;
4156
4179
  JsMeshFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -4278,7 +4301,7 @@ class JsPoint3 {
4278
4301
  */
4279
4302
  constructor(x, y, z) {
4280
4303
  const ret = wasm.jspoint3_new(x, y, z);
4281
- this.__wbg_ptr = ret >>> 0;
4304
+ this.__wbg_ptr = ret;
4282
4305
  JsPoint3Finalization.register(this, this.__wbg_ptr, this);
4283
4306
  return this;
4284
4307
  }
@@ -4361,7 +4384,7 @@ class JsVec3 {
4361
4384
  */
4362
4385
  constructor(x, y, z) {
4363
4386
  const ret = wasm.jsvec3_new(x, y, z);
4364
- this.__wbg_ptr = ret >>> 0;
4387
+ this.__wbg_ptr = ret;
4365
4388
  JsVec3Finalization.register(this, this.__wbg_ptr, this);
4366
4389
  return this;
4367
4390
  }
@@ -4392,18 +4415,18 @@ exports.JsVec3 = JsVec3;
4392
4415
  function __wbg_get_imports() {
4393
4416
  const import0 = {
4394
4417
  __proto__: null,
4395
- __wbg_Error_960c155d3d49e4c2: function(arg0, arg1) {
4418
+ __wbg_Error_3639a60ed15f87e7: function(arg0, arg1) {
4396
4419
  const ret = Error(getStringFromWasm0(arg0, arg1));
4397
4420
  return ret;
4398
4421
  },
4399
- __wbg___wbindgen_debug_string_ab4b34d23d6778bd: function(arg0, arg1) {
4422
+ __wbg___wbindgen_debug_string_07cb72cfcc952e2b: function(arg0, arg1) {
4400
4423
  const ret = debugString(arg1);
4401
4424
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4402
4425
  const len1 = WASM_VECTOR_LEN;
4403
4426
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4404
4427
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4405
4428
  },
4406
- __wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
4429
+ __wbg___wbindgen_throw_9c75d47bf9e7731e: function(arg0, arg1) {
4407
4430
  throw new Error(getStringFromWasm0(arg0, arg1));
4408
4431
  },
4409
4432
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
@@ -4429,19 +4452,19 @@ function __wbg_get_imports() {
4429
4452
 
4430
4453
  const BrepKernelFinalization = (typeof FinalizationRegistry === 'undefined')
4431
4454
  ? { register: () => {}, unregister: () => {} }
4432
- : new FinalizationRegistry(ptr => wasm.__wbg_brepkernel_free(ptr >>> 0, 1));
4455
+ : new FinalizationRegistry(ptr => wasm.__wbg_brepkernel_free(ptr, 1));
4433
4456
  const JsEdgeLinesFinalization = (typeof FinalizationRegistry === 'undefined')
4434
4457
  ? { register: () => {}, unregister: () => {} }
4435
- : new FinalizationRegistry(ptr => wasm.__wbg_jsedgelines_free(ptr >>> 0, 1));
4458
+ : new FinalizationRegistry(ptr => wasm.__wbg_jsedgelines_free(ptr, 1));
4436
4459
  const JsMeshFinalization = (typeof FinalizationRegistry === 'undefined')
4437
4460
  ? { register: () => {}, unregister: () => {} }
4438
- : new FinalizationRegistry(ptr => wasm.__wbg_jsmesh_free(ptr >>> 0, 1));
4461
+ : new FinalizationRegistry(ptr => wasm.__wbg_jsmesh_free(ptr, 1));
4439
4462
  const JsPoint3Finalization = (typeof FinalizationRegistry === 'undefined')
4440
4463
  ? { register: () => {}, unregister: () => {} }
4441
- : new FinalizationRegistry(ptr => wasm.__wbg_jspoint3_free(ptr >>> 0, 1));
4464
+ : new FinalizationRegistry(ptr => wasm.__wbg_jspoint3_free(ptr, 1));
4442
4465
  const JsVec3Finalization = (typeof FinalizationRegistry === 'undefined')
4443
4466
  ? { register: () => {}, unregister: () => {} }
4444
- : new FinalizationRegistry(ptr => wasm.__wbg_jsvec3_free(ptr >>> 0, 1));
4467
+ : new FinalizationRegistry(ptr => wasm.__wbg_jsvec3_free(ptr, 1));
4445
4468
 
4446
4469
  function debugString(val) {
4447
4470
  // primitive types
@@ -4540,8 +4563,7 @@ function getFloat64ArrayMemory0() {
4540
4563
  }
4541
4564
 
4542
4565
  function getStringFromWasm0(ptr, len) {
4543
- ptr = ptr >>> 0;
4544
- return decodeText(ptr, len);
4566
+ return decodeText(ptr >>> 0, len);
4545
4567
  }
4546
4568
 
4547
4569
  let cachedUint32ArrayMemory0 = null;
@@ -4648,5 +4670,6 @@ let WASM_VECTOR_LEN = 0;
4648
4670
  const wasmPath = `${__dirname}/brepkit_wasm_bg.wasm`;
4649
4671
  const wasmBytes = require('fs').readFileSync(wasmPath);
4650
4672
  const wasmModule = new WebAssembly.Module(wasmBytes);
4651
- let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
4673
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
4674
+ let wasm = wasmInstance.exports;
4652
4675
  wasm.__wbindgen_start();
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.44.1",
5
+ "version": "2.46.0",
6
6
  "license": "MIT OR Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",