opengeometry 2.0.2 → 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.
Files changed (39) hide show
  1. package/README.md +34 -6
  2. package/index.d.ts +30 -13
  3. package/index.js +794 -326
  4. package/index.js.map +1 -1
  5. package/opengeometry/pkg/opengeometry.d.ts +152 -137
  6. package/opengeometry/pkg/opengeometry.js +89 -7
  7. package/opengeometry/pkg/opengeometry_bg.wasm +0 -0
  8. package/opengeometry/pkg/opengeometry_bg.wasm.d.ts +143 -137
  9. package/opengeometry_bg.wasm +0 -0
  10. package/opengeometry_bg.wasm.d.ts +143 -137
  11. package/package.json +18 -8
  12. package/src/base-types.d.ts +7 -1
  13. package/src/editor/freeform.d.ts +63 -0
  14. package/src/editor/index.d.ts +3 -0
  15. package/src/editor/parametric.d.ts +10 -0
  16. package/src/editor/types.d.ts +72 -0
  17. package/src/freeform/geometry.d.ts +59 -0
  18. package/src/freeform/index.d.ts +3 -0
  19. package/src/freeform/types.d.ts +12 -0
  20. package/src/operations/boolean.d.ts +28 -0
  21. package/src/operations/extrude.d.ts +9 -0
  22. package/src/operations/index.d.ts +1 -0
  23. package/src/primitives/arc.d.ts +15 -0
  24. package/src/primitives/curve.d.ts +18 -0
  25. package/src/primitives/line.d.ts +15 -0
  26. package/src/primitives/polyline.d.ts +18 -0
  27. package/src/primitives/rectangle.d.ts +18 -0
  28. package/src/shapes/boolean-subtract.d.ts +14 -1
  29. package/src/shapes/cuboid.d.ts +18 -3
  30. package/src/shapes/cylinder.d.ts +18 -3
  31. package/src/shapes/extrusion.d.ts +64 -0
  32. package/src/shapes/index.d.ts +1 -0
  33. package/src/shapes/opening.d.ts +21 -3
  34. package/src/shapes/outline-utils.d.ts +21 -0
  35. package/src/shapes/polygon.d.ts +36 -6
  36. package/src/shapes/solid.d.ts +116 -0
  37. package/src/shapes/sphere.d.ts +18 -3
  38. package/src/shapes/sweep.d.ts +18 -3
  39. package/src/shapes/wedge.d.ts +18 -3
package/README.md CHANGED
@@ -19,12 +19,12 @@
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
  ---
26
26
 
27
- > **Actively under development.** We're building OpenGeometry in the open. APIs, examples, and package structure are evolving — breaking changes are still possible. Star the repo to follow along.
27
+ > **Actively maintained and growing.** We're building OpenGeometry in the open. APIs, examples, and package structure are evolving, we are actively improving and expanding the project. Star the repo to follow along. If you have questions or want to get involved, join the [Discord](https://discord.com/invite/cZY2Vm6E) or check out the [issues](https://github.com/OpenGeometry-io/OpenGeometry/issues)
28
28
 
29
29
  ---
30
30
 
@@ -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,23 +1,34 @@
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";
7
6
  import { OpenGeometryOptions } from "./src/base-types.js";
8
7
  export type OUTLINE_TYPE = "front" | "side" | "top";
8
+ /**
9
+ * Binary STL export payload returned by export helpers.
10
+ */
9
11
  export interface OGStlExportResult {
10
12
  bytes: Uint8Array;
11
13
  reportJson: string;
12
14
  }
15
+ /**
16
+ * STEP text export payload returned by export helpers.
17
+ */
13
18
  export interface OGStepExportResult {
14
19
  text: string;
15
20
  reportJson: string;
16
21
  }
22
+ /**
23
+ * IFC text export payload returned by export helpers.
24
+ */
17
25
  export interface OGIfcExportResult {
18
26
  text: string;
19
27
  reportJson: string;
20
28
  }
29
+ /**
30
+ * Shared runtime entrypoint used to initialize the OpenGeometry wasm module.
31
+ */
21
32
  export declare class OpenGeometry {
22
33
  static version: string;
23
34
  static instance: OpenGeometry | null;
@@ -35,30 +46,36 @@ export declare class OpenGeometry {
35
46
  set enableDebug(value: boolean);
36
47
  constructor();
37
48
  /**
38
- * 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.
39
51
  *
40
- * This factory method sets up the OpenGeometry engine by linking it with the
41
- * rendering context and the WebAssembly module. It ensures all required
42
- * options are provided and prepares the instance for 3D geometry operations.
52
+ * Call this before constructing `Vector3` or any kernel-backed wrapper.
43
53
  *
44
54
  * @param options - Configuration object for initializing OpenGeometry.
45
55
  * @returns A promise that resolves to a fully initialized OpenGeometry instance.
46
- * @throws If any of the required options (`container`, `scene`, or `camera`) are missing.
47
56
  *
48
57
  * @example
49
58
  * ```ts
50
- * const openGeometry = await OpenGeometry.create({
51
- * container: document.getElementById('myContainer')!,
52
- * scene: threeScene,
53
- * camera: threeCamera,
54
- * wasmURL: '/assets/opengeometry.wasm'
59
+ * await OpenGeometry.create({
60
+ * wasmURL: "/opengeometry_bg.wasm",
55
61
  * });
56
62
  * ```
57
63
  */
58
64
  static create(options: OpenGeometryOptions): Promise<OpenGeometry>;
59
65
  private setup;
60
66
  }
61
- 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 };
62
79
  /**
63
80
  * Primitive wrappers (line/polyline/arc/rectangle/curve).
64
81
  */