opengeometry 2.0.3 → 2.0.4

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/README.md CHANGED
@@ -19,7 +19,7 @@
19
19
  </p>
20
20
 
21
21
  <p align="center">
22
- <a href="https://opengeometry.io">Website</a> · <a href="https://docs.opengeometry.io">Documentation</a> · <a href="https://demos.opengeometry.io">Live Demos</a> · <a href="https://opengeometry.io/blog">Blog</a> · <a href="https://www.npmjs.com/package/opengeometry">npm</a>
22
+ <a href="https://opengeometry.io">Website</a> · <a href="https://docs.opengeometry.io">Documentation</a> · <a href="https://demo.opengeometry.io">Live Demos</a> · <a href="https://opengeometry.io/blog">Blog</a> · <a href="https://www.npmjs.com/package/opengeometry">npm</a>
23
23
  </p>
24
24
 
25
25
  ---
@@ -32,14 +32,39 @@
32
32
 
33
33
  OpenGeometry is an **open-source CAD kernel** purpose-built for the browser. The geometry engine is written in **Rust**, compiled to **WebAssembly**, and ships with a **Three.js integration layer** — so you can build real CAD tools that run entirely on the web.
34
34
 
35
- Whether you're building a parametric modeler, a BIM viewer, a 3D configurator, or any geometry-heavy web app, OpenGeometry gives you the primitives and operations you need without leaving JavaScript.
35
+ OpenGeometry is best suited for **browser-based CAD, AEC/BIM, configurators, and geometry-heavy web tools**. Whether you're building a parametric modeler, a wall/opening workflow, a BIM viewer, or a custom Three.js modeling tool, OpenGeometry gives you kernel-backed primitives and operations without leaving JavaScript.
36
+
37
+ OpenPlans is an application/toolkit built on top of OpenGeometry for AEC workflows. In this repository, OpenGeometry is the engine.
38
+
39
+ ## When to use OpenGeometry
40
+
41
+ Use OpenGeometry when you need:
42
+
43
+ - browser-based parametric modeling with Rust + WebAssembly performance
44
+ - wall/opening subtraction and other solid boolean workflows
45
+ - polygon extrusion into solids for CAD or AEC modeling
46
+ - IFC, STEP, STL, and PDF-style export/projection in web apps
47
+ - a Three.js-friendly CAD kernel instead of ad hoc mesh math
48
+
49
+ ## AI and Coding Agent Entrypoints
50
+
51
+ If you are using ChatGPT, Claude, Gemini, Copilot, or other coding agents on this repository, start here:
52
+
53
+ - [llms.txt](./llms.txt)
54
+ - [llms-full.txt](./llms-full.txt)
55
+ - [llm.txt](./llm.txt)
56
+ - [AGENTS.md](./AGENTS.md)
57
+ - [Quickstart](https://docs.opengeometry.io/quickstart)
58
+ - [Three.js integration](https://docs.opengeometry.io/integration/threejs)
59
+ - [Boolean operations](https://docs.opengeometry.io/api/operations/boolean-operations)
60
+ - [Extrude](https://docs.opengeometry.io/api/operations/extrude)
36
61
 
37
62
  ### What you can do today
38
63
 
39
64
  | Category | Capabilities |
40
65
  | --- | --- |
41
66
  | **Primitives** | Lines, arcs, curves, polylines, rectangles |
42
- | **Shapes** | Polygons, cylinders, cuboids, spheres, wedges |
67
+ | **Shapes** | Polygons, solids, cuboids, cylinders, spheres, wedges, sweeps, openings |
43
68
  | **Operations** | Triangulation, extrusion, sweep, offset, boolean operations |
44
69
  | **Exports** | STL, STEP, IFC, PDF projection |
45
70
  | **Integration** | Three.js scene management, WebAssembly-powered performance |
@@ -48,7 +73,7 @@ Whether you're building a parametric modeler, a BIM viewer, a 3D configurator, o
48
73
 
49
74
  See OpenGeometry in action — interactive, browser-based demos showcasing the kernel's capabilities:
50
75
 
51
- **[demos.opengeometry.io](https://demos.opengeometry.io)**
76
+ **[demo.opengeometry.io](https://demo.opengeometry.io)**
52
77
 
53
78
  Demos include primitives rendering, shape generation, sweep operations, boolean operations, file exports, and more. All running client-side via WebAssembly.
54
79
 
@@ -70,6 +95,7 @@ await OpenGeometry.create({
70
95
  ).href,
71
96
  });
72
97
 
98
+ // Initialize once before constructing Vector3 or any wrapper.
73
99
  const cuboid = new Cuboid({
74
100
  center: new Vector3(0, 0, 0),
75
101
  width: 2,
@@ -140,7 +166,7 @@ npm test
140
166
  - Contributors interested in the **Rust → WASM geometry pipeline**
141
167
  - Anyone exploring **open-source CAD kernel internals**
142
168
 
143
- If you just want a quick look, start with the [hosted demos](https://demos.opengeometry.io) or the [quickstart repo](https://github.com/OpenGeometry-io/quickstart-js).
169
+ If you just want a quick look, start with the [hosted demos](https://demo.opengeometry.io) or the [quickstart repo](https://github.com/OpenGeometry-io/quickstart-js).
144
170
 
145
171
  ## Community
146
172
 
@@ -159,6 +185,8 @@ OpenGeometry is open source under the [MPL-2.0 license](./LICENSE.md). Contribut
159
185
  ## AI Agent Docs Policy
160
186
 
161
187
  - Repository-level AI agent instructions are in [AGENTS.md](./AGENTS.md).
188
+ - LLM-friendly repo entrypoints are [llms.txt](./llms.txt), [llms-full.txt](./llms-full.txt), and
189
+ [llm.txt](./llm.txt).
162
190
  - All AI-generated documentation must live under [`AI-DOCs/`](./AI-DOCs/).
163
191
  - AI-generated docs should not be added under app/code folders unless explicitly requested.
164
192
 
package/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  /**
2
- * OpenGeometry Three.js adapter entrypoint.
3
- * @module @opengeometry/kernel-three
2
+ * Public OpenGeometry JavaScript entrypoint.
4
3
  */
5
4
  import { OGSceneManager, Vector3 } from "./opengeometry/pkg/opengeometry.js";
6
5
  import { SpotLabel } from "./src/markup/spotMarker.js";
@@ -47,30 +46,36 @@ export declare class OpenGeometry {
47
46
  set enableDebug(value: boolean);
48
47
  constructor();
49
48
  /**
50
- * Asynchronously creates and initializes an instance of OpenGeometry.
49
+ * Asynchronously initializes the OpenGeometry wasm runtime and returns a
50
+ * cached singleton instance on subsequent calls.
51
51
  *
52
- * This factory method sets up the OpenGeometry engine by linking it with the
53
- * rendering context and the WebAssembly module. It ensures all required
54
- * options are provided and prepares the instance for 3D geometry operations.
52
+ * Call this before constructing `Vector3` or any kernel-backed wrapper.
55
53
  *
56
54
  * @param options - Configuration object for initializing OpenGeometry.
57
55
  * @returns A promise that resolves to a fully initialized OpenGeometry instance.
58
- * @throws If any of the required options (`container`, `scene`, or `camera`) are missing.
59
56
  *
60
57
  * @example
61
58
  * ```ts
62
- * const openGeometry = await OpenGeometry.create({
63
- * container: document.getElementById('myContainer')!,
64
- * scene: threeScene,
65
- * camera: threeCamera,
66
- * wasmURL: '/assets/opengeometry.wasm'
59
+ * await OpenGeometry.create({
60
+ * wasmURL: "/opengeometry_bg.wasm",
67
61
  * });
68
62
  * ```
69
63
  */
70
64
  static create(options: OpenGeometryOptions): Promise<OpenGeometry>;
71
65
  private setup;
72
66
  }
73
- export { OGSceneManager, Vector3, SpotLabel, };
67
+ /**
68
+ * Scene manager that stores serialized BRep snapshots in wasm for projection,
69
+ * export, and other scene-level workflows.
70
+ */
71
+ export { OGSceneManager };
72
+ /**
73
+ * Shared wasm-backed vector type used throughout the public API.
74
+ *
75
+ * Initialize `OpenGeometry.create(...)` before constructing `Vector3`.
76
+ */
77
+ export { Vector3 };
78
+ export { SpotLabel };
74
79
  /**
75
80
  * Primitive wrappers (line/polyline/arc/rectangle/curve).
76
81
  */
package/index.js CHANGED
@@ -159,6 +159,32 @@ function getArrayF64FromWasm0(ptr, len) {
159
159
  ptr = ptr >>> 0;
160
160
  return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
161
161
  }
162
+ /**
163
+ * @param {string} local_brep_serialized
164
+ * @param {number} height
165
+ * @returns {string}
166
+ */
167
+ function extrudeBrepFace$1(local_brep_serialized, height) {
168
+ let deferred3_0;
169
+ let deferred3_1;
170
+ try {
171
+ const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
172
+ const len0 = WASM_VECTOR_LEN;
173
+ const ret = wasm.extrudeBrepFace(ptr0, len0, height);
174
+ var ptr2 = ret[0];
175
+ var len2 = ret[1];
176
+ if (ret[3]) {
177
+ ptr2 = 0;
178
+ len2 = 0;
179
+ throw takeFromExternrefTable0(ret[2]);
180
+ }
181
+ deferred3_0 = ptr2;
182
+ deferred3_1 = len2;
183
+ return getStringFromWasm0(ptr2, len2);
184
+ } finally {
185
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
186
+ }
187
+ }
162
188
  let cachedDataViewMemory0 = null;
163
189
  function getDataViewMemory0() {
164
190
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
@@ -175,6 +201,16 @@ function passArrayJsValueToWasm0(array, malloc) {
175
201
  WASM_VECTOR_LEN = array.length;
176
202
  return ptr;
177
203
  }
204
+ function getArrayJsValueFromWasm0(ptr, len) {
205
+ ptr = ptr >>> 0;
206
+ const mem = getDataViewMemory0();
207
+ const result = [];
208
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
209
+ result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
210
+ }
211
+ wasm.__externref_drop_slice(ptr, len);
212
+ return result;
213
+ }
178
214
  function isLikeNone(x) {
179
215
  return x === undefined || x === null;
180
216
  }
@@ -242,40 +278,24 @@ function booleanSubtraction$1(lhs_brep_serialized, rhs_brep_serialized, options_
242
278
  }
243
279
 
244
280
  /**
245
- * @param {string} local_brep_serialized
246
- * @param {number} height
247
- * @returns {string}
281
+ * Wasm entry point for array-backed repeated subtraction.
282
+ * @param {string} lhs_brep_serialized
283
+ * @param {string} cutters_brep_serialized
284
+ * @param {string | null} [options_json]
285
+ * @returns {OGBooleanResult}
248
286
  */
249
- function extrudeBrepFace$1(local_brep_serialized, height) {
250
- let deferred3_0;
251
- let deferred3_1;
252
- try {
253
- const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
254
- const len0 = WASM_VECTOR_LEN;
255
- const ret = wasm.extrudeBrepFace(ptr0, len0, height);
256
- var ptr2 = ret[0];
257
- var len2 = ret[1];
258
- if (ret[3]) {
259
- ptr2 = 0;
260
- len2 = 0;
261
- throw takeFromExternrefTable0(ret[2]);
262
- }
263
- deferred3_0 = ptr2;
264
- deferred3_1 = len2;
265
- return getStringFromWasm0(ptr2, len2);
266
- } finally {
267
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
268
- }
269
- }
270
- function getArrayJsValueFromWasm0(ptr, len) {
271
- ptr = ptr >>> 0;
272
- const mem = getDataViewMemory0();
273
- const result = [];
274
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
275
- result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
287
+ function booleanSubtractionMany(lhs_brep_serialized, cutters_brep_serialized, options_json) {
288
+ const ptr0 = passStringToWasm0(lhs_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
289
+ const len0 = WASM_VECTOR_LEN;
290
+ const ptr1 = passStringToWasm0(cutters_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
291
+ const len1 = WASM_VECTOR_LEN;
292
+ var ptr2 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
293
+ var len2 = WASM_VECTOR_LEN;
294
+ const ret = wasm.booleanSubtractionMany(ptr0, len0, ptr1, len1, ptr2, len2);
295
+ if (ret[2]) {
296
+ throw takeFromExternrefTable0(ret[1]);
276
297
  }
277
- wasm.__externref_drop_slice(ptr, len);
278
- return result;
298
+ return OGBooleanResult.__wrap(ret[0]);
279
299
  }
280
300
  const Matrix3Finalization = typeof FinalizationRegistry === 'undefined' ? {
281
301
  register: () => {},
@@ -5688,6 +5708,7 @@ var OGKernel = /*#__PURE__*/Object.freeze({
5688
5708
  Vector3: Vector3,
5689
5709
  booleanIntersection: booleanIntersection$1,
5690
5710
  booleanSubtraction: booleanSubtraction$1,
5711
+ booleanSubtractionMany: booleanSubtractionMany,
5691
5712
  booleanUnion: booleanUnion$1,
5692
5713
  default: __wbg_init,
5693
5714
  extrudeBrepFace: extrudeBrepFace$1,
@@ -7546,6 +7567,9 @@ class BooleanResult extends THREE.Mesh {
7546
7567
  _BooleanResult_outlineMesh = new WeakMap();
7547
7568
  /**
7548
7569
  * Computes a kernel-backed boolean union and returns a renderable result mesh.
7570
+ *
7571
+ * Accepts wrapper objects directly, including `Solid`, `Cuboid`, `Opening`,
7572
+ * and other shapes that expose BRep accessors.
7549
7573
  */
7550
7574
  function booleanUnion(lhs, rhs, options) {
7551
7575
  return executeBoolean("booleanUnion", lhs, rhs, options);
@@ -7558,16 +7582,34 @@ function booleanIntersection(lhs, rhs, options) {
7558
7582
  }
7559
7583
  /**
7560
7584
  * Computes a kernel-backed boolean subtraction and returns a renderable result mesh.
7585
+ *
7586
+ * Use this when you want a standalone helper rather than a shape-level
7587
+ * convenience method like `opening.subtractFrom(host)`.
7561
7588
  */
7562
7589
  function booleanSubtraction(lhs, rhs, options) {
7563
7590
  return executeBoolean("booleanSubtraction", lhs, rhs, options);
7564
7591
  }
7592
+ /**
7593
+ * Computes a kernel-backed repeated subtraction using a left-to-right cutter array.
7594
+ *
7595
+ * This is used by the shape-level `.subtract([...])` helpers so the heavy
7596
+ * boolean orchestration stays in the Rust/WASM layer instead of JavaScript.
7597
+ */
7598
+ function executeBooleanSubtractionMany(lhs, cutters, options) {
7599
+ const booleanExport = booleanSubtractionMany;
7600
+ if (typeof booleanExport !== "function") {
7601
+ throw new Error("booleanSubtractionMany is not available in the loaded wasm package. Rebuild opengeometry wasm bindings.");
7602
+ }
7603
+ const kernelFunction = booleanExport;
7604
+ const kernelOptions = serializeKernelOptions(options === null || options === void 0 ? void 0 : options.kernel);
7605
+ const kernelResult = kernelFunction(resolveOperandSerialized(lhs), JSON.stringify(cutters.map(resolveOperandPayload)), kernelOptions);
7606
+ return createBooleanResult(kernelResult, options);
7607
+ }
7565
7608
  /**
7566
7609
  * Normalizes mixed wrapper/raw operands, invokes the wasm boolean export, and
7567
7610
  * returns the renderable result wrapper.
7568
7611
  */
7569
7612
  function executeBoolean(exportName, lhs, rhs, options) {
7570
- var _a;
7571
7613
  const booleanExport = OGKernel[exportName];
7572
7614
  if (typeof booleanExport !== "function") {
7573
7615
  throw new Error(`${exportName} is not available in the loaded wasm package. Rebuild opengeometry wasm bindings.`);
@@ -7575,11 +7617,7 @@ function executeBoolean(exportName, lhs, rhs, options) {
7575
7617
  const kernelFunction = booleanExport;
7576
7618
  const kernelOptions = serializeKernelOptions(options === null || options === void 0 ? void 0 : options.kernel);
7577
7619
  const kernelResult = kernelFunction(resolveOperandSerialized(lhs), resolveOperandSerialized(rhs), kernelOptions);
7578
- const result = new BooleanResult(kernelResult, options);
7579
- if ((_a = options === null || options === void 0 ? void 0 : options.outline) !== null && _a !== void 0 ? _a : true) {
7580
- result.outline = true;
7581
- }
7582
- return result;
7620
+ return createBooleanResult(kernelResult, options);
7583
7621
  }
7584
7622
  /**
7585
7623
  * Accepts wrapper objects, raw BRep data, or serialized JSON and normalizes
@@ -7600,6 +7638,19 @@ function resolveOperandSerialized(operand) {
7600
7638
  }
7601
7639
  return serializeBrepLike(operand);
7602
7640
  }
7641
+ /**
7642
+ * Parses a boolean operand into a raw BRep payload so array-backed boolean
7643
+ * calls can serialize a JSON array of BReps instead of a JSON array of strings.
7644
+ */
7645
+ function resolveOperandPayload(operand) {
7646
+ const serialized = resolveOperandSerialized(operand);
7647
+ try {
7648
+ return JSON.parse(serialized);
7649
+ }
7650
+ catch (_a) {
7651
+ throw new Error("Boolean operands must resolve to valid serialized BRep JSON before array subtraction.");
7652
+ }
7653
+ }
7603
7654
  /**
7604
7655
  * Accepts either a parsed BRep object or an already serialized JSON payload
7605
7656
  * and always returns the canonical serialized form expected by the wasm API.
@@ -7622,6 +7673,14 @@ function serializeKernelOptions(options) {
7622
7673
  merge_coplanar_faces: options.mergeCoplanarFaces,
7623
7674
  });
7624
7675
  }
7676
+ function createBooleanResult(kernelResult, options) {
7677
+ var _a;
7678
+ const result = new BooleanResult(kernelResult, options);
7679
+ if ((_a = options === null || options === void 0 ? void 0 : options.outline) !== null && _a !== void 0 ? _a : true) {
7680
+ result.outline = true;
7681
+ }
7682
+ return result;
7683
+ }
7625
7684
  /**
7626
7685
  * Builds a display-quality outline buffer from the rendered mesh and falls back
7627
7686
  * to the kernel-provided edges when the client-side extraction is empty.
@@ -7642,8 +7701,11 @@ function getRenderableOutlinePositions(geometry, fallbackSerialized) {
7642
7701
  /**
7643
7702
  * Executes a kernel-backed subtraction for a shape wrapper against another boolean operand.
7644
7703
  */
7645
- function subtractShapeOperand(host, operand, options) {
7646
- return booleanSubtraction(host, operand, options);
7704
+ function subtractShapeOperand(host, operands, options) {
7705
+ if (!Array.isArray(operands)) {
7706
+ throw new Error("shape.subtract(...) now requires an operand array. Pass shape.subtract([operand], options) even for a single cutter.");
7707
+ }
7708
+ return executeBooleanSubtractionMany(host, operands, options);
7647
7709
  }
7648
7710
 
7649
7711
  var _Solid_outlineMesh;
@@ -7693,6 +7755,8 @@ class Solid extends THREE.Mesh {
7693
7755
  }
7694
7756
  /**
7695
7757
  * Extrudes a face-like BRep source and wraps the result as a renderable solid.
7758
+ *
7759
+ * Prefer `polygon.extrude(height)` when the source is already a `Polygon`.
7696
7760
  */
7697
7761
  static extrude(source, height, options) {
7698
7762
  return new Solid(Object.assign(Object.assign({}, options), { brep: extrudeBrepFace(source, height) }));
@@ -7779,10 +7843,13 @@ class Solid extends THREE.Mesh {
7779
7843
  return JSON.parse(brepSerialized);
7780
7844
  }
7781
7845
  /**
7782
- * Subtracts another boolean operand from this solid.
7846
+ * Subtracts one or more boolean operands from this solid.
7847
+ *
7848
+ * This is the main shape-level boolean workflow after operations like
7849
+ * `polygon.extrude(height)` or `Solid.extrude(...)`.
7783
7850
  */
7784
- subtract(operand, options) {
7785
- return subtractShapeOperand(this, operand, options);
7851
+ subtract(operands, options) {
7852
+ return subtractShapeOperand(this, operands, options);
7786
7853
  }
7787
7854
  /**
7788
7855
  * Rebuilds the visible mesh and outline from the current freeform geometry.
@@ -8141,6 +8208,9 @@ class Polygon extends THREE.Mesh {
8141
8208
  }
8142
8209
  /**
8143
8210
  * Builds a kernel-backed `Solid` by extruding this polygon face by `height`.
8211
+ *
8212
+ * This is the recommended public path when a browser CAD or AEC workflow
8213
+ * starts from a planar profile and needs a boolean-ready solid.
8144
8214
  */
8145
8215
  extrude(height) {
8146
8216
  const config = this.getConfig();
@@ -8169,10 +8239,10 @@ class Polygon extends THREE.Mesh {
8169
8239
  return brepData;
8170
8240
  }
8171
8241
  /**
8172
- * Subtracts another boolean operand from this polygon.
8242
+ * Subtracts one or more boolean operands from this polygon.
8173
8243
  */
8174
- subtract(operand, options) {
8175
- return subtractShapeOperand(this, operand, options);
8244
+ subtract(operands, options) {
8245
+ return subtractShapeOperand(this, operands, options);
8176
8246
  }
8177
8247
  set outlineColor(color) {
8178
8248
  this._outlineColor = color;
@@ -8464,10 +8534,10 @@ class Cylinder extends THREE.Mesh {
8464
8534
  return JSON.parse(brepData);
8465
8535
  }
8466
8536
  /**
8467
- * Subtracts another boolean operand, such as an Opening, from this cylinder.
8537
+ * Subtracts one or more boolean operands, such as Opening volumes, from this cylinder.
8468
8538
  */
8469
- subtract(operand, options) {
8470
- return subtractShapeOperand(this, operand, options);
8539
+ subtract(operands, options) {
8540
+ return subtractShapeOperand(this, operands, options);
8471
8541
  }
8472
8542
  set outline(enable) {
8473
8543
  this._outlineEnabled = enable;
@@ -8675,10 +8745,10 @@ class Cuboid extends THREE.Mesh {
8675
8745
  return JSON.parse(brepData);
8676
8746
  }
8677
8747
  /**
8678
- * Subtracts another boolean operand, such as an Opening, from this cuboid.
8748
+ * Subtracts one or more boolean operands, such as Opening volumes, from this cuboid.
8679
8749
  */
8680
- subtract(operand, options) {
8681
- return subtractShapeOperand(this, operand, options);
8750
+ subtract(operands, options) {
8751
+ return subtractShapeOperand(this, operands, options);
8682
8752
  }
8683
8753
  set outline(enable) {
8684
8754
  this._outlineEnabled = enable;
@@ -9000,16 +9070,19 @@ class Opening extends THREE.Mesh {
9000
9070
  return JSON.parse(brepData);
9001
9071
  }
9002
9072
  /**
9003
- * Subtracts another boolean operand from this opening volume.
9073
+ * Subtracts one or more boolean operands from this opening volume.
9004
9074
  */
9005
- subtract(operand, options) {
9006
- return subtractShapeOperand(this, operand, options);
9075
+ subtract(operands, options) {
9076
+ return subtractShapeOperand(this, operands, options);
9007
9077
  }
9008
9078
  /**
9009
9079
  * Uses this opening volume to cut a host shape.
9080
+ *
9081
+ * Prefer this helper for wall, slab, and other host-cutting workflows in
9082
+ * browser-based AEC/BIM tools.
9010
9083
  */
9011
9084
  subtractFrom(host, options) {
9012
- return subtractShapeOperand(host, this, options);
9085
+ return booleanSubtraction(host, this, options);
9013
9086
  }
9014
9087
  set outline(enable) {
9015
9088
  this._outlineEnabled = enable;
@@ -9283,10 +9356,10 @@ class Sphere extends THREE.Mesh {
9283
9356
  return JSON.parse(brepData);
9284
9357
  }
9285
9358
  /**
9286
- * Subtracts another boolean operand, such as an Opening, from this sphere.
9359
+ * Subtracts one or more boolean operands, such as Opening volumes, from this sphere.
9287
9360
  */
9288
- subtract(operand, options) {
9289
- return subtractShapeOperand(this, operand, options);
9361
+ subtract(operands, options) {
9362
+ return subtractShapeOperand(this, operands, options);
9290
9363
  }
9291
9364
  set outline(enable) {
9292
9365
  this._outlineEnabled = enable;
@@ -9551,10 +9624,10 @@ class Wedge extends THREE.Mesh {
9551
9624
  return JSON.parse(brepData);
9552
9625
  }
9553
9626
  /**
9554
- * Subtracts another boolean operand, such as an Opening, from this wedge.
9627
+ * Subtracts one or more boolean operands, such as Opening volumes, from this wedge.
9555
9628
  */
9556
- subtract(operand, options) {
9557
- return subtractShapeOperand(this, operand, options);
9629
+ subtract(operands, options) {
9630
+ return subtractShapeOperand(this, operands, options);
9558
9631
  }
9559
9632
  set outline(enable) {
9560
9633
  this._outlineEnabled = enable;
@@ -9850,10 +9923,10 @@ class Sweep extends THREE.Mesh {
9850
9923
  return JSON.parse(brepData);
9851
9924
  }
9852
9925
  /**
9853
- * Subtracts another boolean operand, such as an Opening, from this sweep.
9926
+ * Subtracts one or more boolean operands, such as Opening volumes, from this sweep.
9854
9927
  */
9855
- subtract(operand, options) {
9856
- return subtractShapeOperand(this, operand, options);
9928
+ subtract(operands, options) {
9929
+ return subtractShapeOperand(this, operands, options);
9857
9930
  }
9858
9931
  set outline(enable) {
9859
9932
  this._outlineEnabled = enable;
@@ -10591,23 +10664,18 @@ class OpenGeometry {
10591
10664
  this._enableDebug = false;
10592
10665
  }
10593
10666
  /**
10594
- * Asynchronously creates and initializes an instance of OpenGeometry.
10667
+ * Asynchronously initializes the OpenGeometry wasm runtime and returns a
10668
+ * cached singleton instance on subsequent calls.
10595
10669
  *
10596
- * This factory method sets up the OpenGeometry engine by linking it with the
10597
- * rendering context and the WebAssembly module. It ensures all required
10598
- * options are provided and prepares the instance for 3D geometry operations.
10670
+ * Call this before constructing `Vector3` or any kernel-backed wrapper.
10599
10671
  *
10600
10672
  * @param options - Configuration object for initializing OpenGeometry.
10601
10673
  * @returns A promise that resolves to a fully initialized OpenGeometry instance.
10602
- * @throws If any of the required options (`container`, `scene`, or `camera`) are missing.
10603
10674
  *
10604
10675
  * @example
10605
10676
  * ```ts
10606
- * const openGeometry = await OpenGeometry.create({
10607
- * container: document.getElementById('myContainer')!,
10608
- * scene: threeScene,
10609
- * camera: threeCamera,
10610
- * wasmURL: '/assets/opengeometry.wasm'
10677
+ * await OpenGeometry.create({
10678
+ * wasmURL: "/opengeometry_bg.wasm",
10611
10679
  * });
10612
10680
  * ```
10613
10681
  */
@@ -10634,5 +10702,5 @@ class OpenGeometry {
10634
10702
  OpenGeometry.version = OPEN_GEOMETRY_THREE_VERSION;
10635
10703
  OpenGeometry.instance = null;
10636
10704
 
10637
- export { Arc, BooleanResult, Cuboid, Curve, Cylinder, FreeformEditor, FreeformGeometry, Line, OGSceneManager, OpenGeometry, Opening, Polygon, Polyline, Rectangle, Solid, Sphere, SpotLabel, Sweep, Vector3, Wedge, booleanIntersection, booleanSubtraction, booleanUnion, clonePlacement, createBooleanExample, createEditorModesExample, createFreeformEditor, createFreeformGeometry, createOffsetExample, createParametricEditCapabilities, createPrimitivesExample, createShapesExample, createSweepExample, createWallFromOffsetsExample, extrudeBrepFace, toObjectTransformation$1 as toObjectTransformation };
10705
+ export { Arc, BooleanResult, Cuboid, Curve, Cylinder, FreeformEditor, FreeformGeometry, Line, OGSceneManager, OpenGeometry, Opening, Polygon, Polyline, Rectangle, Solid, Sphere, SpotLabel, Sweep, Vector3, Wedge, booleanIntersection, booleanSubtraction, booleanUnion, clonePlacement, createBooleanExample, createEditorModesExample, createFreeformEditor, createFreeformGeometry, createOffsetExample, createParametricEditCapabilities, createPrimitivesExample, createShapesExample, createSweepExample, createWallFromOffsetsExample, executeBooleanSubtractionMany, extrudeBrepFace, toObjectTransformation$1 as toObjectTransformation };
10638
10706
  //# sourceMappingURL=index.js.map