brepkit-wasm 0.8.4 → 0.9.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
@@ -107,6 +107,20 @@ export class BrepKernel {
107
107
  * Returns a flat array of the chamfered polygon coordinates.
108
108
  */
109
109
  chamfer2d(coords: Float64Array, distance: number): Float64Array;
110
+ /**
111
+ * Save a snapshot of the current kernel state.
112
+ *
113
+ * Returns a checkpoint ID (zero-based index) that can be passed to
114
+ * `restore` or `discardCheckpoint`.
115
+ *
116
+ * The snapshot is a clone of all topology, assembly, and sketch state.
117
+ * Existing entity handles remain valid after restore.
118
+ */
119
+ checkpoint(): number;
120
+ /**
121
+ * Returns the number of saved checkpoints.
122
+ */
123
+ checkpointCount(): number;
110
124
  /**
111
125
  * Create a circular pattern of a solid around an axis.
112
126
  *
@@ -253,6 +267,14 @@ export class BrepKernel {
253
267
  * Returns an array of face handles.
254
268
  */
255
269
  detectSmallFeatures(solid: number, area_threshold: number, deflection: number): Uint32Array;
270
+ /**
271
+ * Discard a checkpoint and all checkpoints after it, freeing their memory.
272
+ *
273
+ * # Errors
274
+ *
275
+ * Returns an error if `checkpoint_id` does not refer to a valid checkpoint.
276
+ */
277
+ discardCheckpoint(checkpoint_id: number): void;
256
278
  /**
257
279
  * Apply draft angle to faces of a solid.
258
280
  *
@@ -1197,6 +1219,18 @@ export class BrepKernel {
1197
1219
  * Returns an error if the solid handle is invalid.
1198
1220
  */
1199
1221
  repairSolid(solid: number): number;
1222
+ /**
1223
+ * Restore the kernel to a previously saved checkpoint.
1224
+ *
1225
+ * All state created after the checkpoint is discarded. The checkpoint
1226
+ * itself (and any earlier checkpoints) remain valid for future restores.
1227
+ * Checkpoints created after this one are discarded.
1228
+ *
1229
+ * # Errors
1230
+ *
1231
+ * Returns an error if `checkpoint_id` does not refer to a valid checkpoint.
1232
+ */
1233
+ restore(checkpoint_id: number): void;
1200
1234
  /**
1201
1235
  * Reverse the orientation of a face or edge.
1202
1236
  *
@@ -300,6 +300,28 @@ export class BrepKernel {
300
300
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
301
301
  return v2;
302
302
  }
303
+ /**
304
+ * Save a snapshot of the current kernel state.
305
+ *
306
+ * Returns a checkpoint ID (zero-based index) that can be passed to
307
+ * `restore` or `discardCheckpoint`.
308
+ *
309
+ * The snapshot is a clone of all topology, assembly, and sketch state.
310
+ * Existing entity handles remain valid after restore.
311
+ * @returns {number}
312
+ */
313
+ checkpoint() {
314
+ const ret = wasm.brepkernel_checkpoint(this.__wbg_ptr);
315
+ return ret >>> 0;
316
+ }
317
+ /**
318
+ * Returns the number of saved checkpoints.
319
+ * @returns {number}
320
+ */
321
+ checkpointCount() {
322
+ const ret = wasm.brepkernel_checkpointCount(this.__wbg_ptr);
323
+ return ret >>> 0;
324
+ }
303
325
  /**
304
326
  * Create a circular pattern of a solid around an axis.
305
327
  *
@@ -675,6 +697,20 @@ export class BrepKernel {
675
697
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
676
698
  return v1;
677
699
  }
700
+ /**
701
+ * Discard a checkpoint and all checkpoints after it, freeing their memory.
702
+ *
703
+ * # Errors
704
+ *
705
+ * Returns an error if `checkpoint_id` does not refer to a valid checkpoint.
706
+ * @param {number} checkpoint_id
707
+ */
708
+ discardCheckpoint(checkpoint_id) {
709
+ const ret = wasm.brepkernel_discardCheckpoint(this.__wbg_ptr, checkpoint_id);
710
+ if (ret[1]) {
711
+ throw takeFromExternrefTable0(ret[0]);
712
+ }
713
+ }
678
714
  /**
679
715
  * Apply draft angle to faces of a solid.
680
716
  *
@@ -2878,6 +2914,24 @@ export class BrepKernel {
2878
2914
  }
2879
2915
  return ret[0] >>> 0;
2880
2916
  }
2917
+ /**
2918
+ * Restore the kernel to a previously saved checkpoint.
2919
+ *
2920
+ * All state created after the checkpoint is discarded. The checkpoint
2921
+ * itself (and any earlier checkpoints) remain valid for future restores.
2922
+ * Checkpoints created after this one are discarded.
2923
+ *
2924
+ * # Errors
2925
+ *
2926
+ * Returns an error if `checkpoint_id` does not refer to a valid checkpoint.
2927
+ * @param {number} checkpoint_id
2928
+ */
2929
+ restore(checkpoint_id) {
2930
+ const ret = wasm.brepkernel_restore(this.__wbg_ptr, checkpoint_id);
2931
+ if (ret[1]) {
2932
+ throw takeFromExternrefTable0(ret[0]);
2933
+ }
2934
+ }
2881
2935
  /**
2882
2936
  * Reverse the orientation of a face or edge.
2883
2937
  *
Binary file
@@ -302,6 +302,28 @@ class BrepKernel {
302
302
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
303
303
  return v2;
304
304
  }
305
+ /**
306
+ * Save a snapshot of the current kernel state.
307
+ *
308
+ * Returns a checkpoint ID (zero-based index) that can be passed to
309
+ * `restore` or `discardCheckpoint`.
310
+ *
311
+ * The snapshot is a clone of all topology, assembly, and sketch state.
312
+ * Existing entity handles remain valid after restore.
313
+ * @returns {number}
314
+ */
315
+ checkpoint() {
316
+ const ret = wasm.brepkernel_checkpoint(this.__wbg_ptr);
317
+ return ret >>> 0;
318
+ }
319
+ /**
320
+ * Returns the number of saved checkpoints.
321
+ * @returns {number}
322
+ */
323
+ checkpointCount() {
324
+ const ret = wasm.brepkernel_checkpointCount(this.__wbg_ptr);
325
+ return ret >>> 0;
326
+ }
305
327
  /**
306
328
  * Create a circular pattern of a solid around an axis.
307
329
  *
@@ -677,6 +699,20 @@ class BrepKernel {
677
699
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
678
700
  return v1;
679
701
  }
702
+ /**
703
+ * Discard a checkpoint and all checkpoints after it, freeing their memory.
704
+ *
705
+ * # Errors
706
+ *
707
+ * Returns an error if `checkpoint_id` does not refer to a valid checkpoint.
708
+ * @param {number} checkpoint_id
709
+ */
710
+ discardCheckpoint(checkpoint_id) {
711
+ const ret = wasm.brepkernel_discardCheckpoint(this.__wbg_ptr, checkpoint_id);
712
+ if (ret[1]) {
713
+ throw takeFromExternrefTable0(ret[0]);
714
+ }
715
+ }
680
716
  /**
681
717
  * Apply draft angle to faces of a solid.
682
718
  *
@@ -2880,6 +2916,24 @@ class BrepKernel {
2880
2916
  }
2881
2917
  return ret[0] >>> 0;
2882
2918
  }
2919
+ /**
2920
+ * Restore the kernel to a previously saved checkpoint.
2921
+ *
2922
+ * All state created after the checkpoint is discarded. The checkpoint
2923
+ * itself (and any earlier checkpoints) remain valid for future restores.
2924
+ * Checkpoints created after this one are discarded.
2925
+ *
2926
+ * # Errors
2927
+ *
2928
+ * Returns an error if `checkpoint_id` does not refer to a valid checkpoint.
2929
+ * @param {number} checkpoint_id
2930
+ */
2931
+ restore(checkpoint_id) {
2932
+ const ret = wasm.brepkernel_restore(this.__wbg_ptr, checkpoint_id);
2933
+ if (ret[1]) {
2934
+ throw takeFromExternrefTable0(ret[0]);
2935
+ }
2936
+ }
2883
2937
  /**
2884
2938
  * Reverse the orientation of a face or edge.
2885
2939
  *
package/package.json CHANGED
@@ -2,8 +2,8 @@
2
2
  "name": "brepkit-wasm",
3
3
  "type": "module",
4
4
  "description": "WebAssembly bindings for brepkit — browser-native B-Rep solid modeling",
5
- "version": "0.8.4",
6
- "license": "Apache-2.0",
5
+ "version": "0.9.0",
6
+ "license": "AGPL-3.0-only",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/andymai/brepkit.git"