replicad-opencascadejs is a specialized, minified build of opencascade.js, which itself is a JavaScript and WebAssembly port of the Open CASCADE Technology (OCCT) CAD kernel. This package is specifically tailored to include only the necessary APIs for the replicad library, aiming to significantly reduce the overall bundle size and improve load times for web-based 3D modeling applications. The current stable version, as per the request, is 0.23.0, though npm often shows slightly older versions like 0.20.2 or 0.21.0 as most recently published, indicating an irregular release cadence tied to upstream opencascade.js updates and replicad's needs. Its key differentiator is providing a lightweight, optimized WebAssembly CAD backend for replicad, enabling efficient browser-based parametric 3D design without the full footprint of the generic opencascade.js library. It leverages the robust geometry capabilities of OCCT, exposed through a developer-friendly API for code-driven 3D model generation.
npm install replicad-opencascadejsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to asynchronously initialize replicad-opencascadejs, inject the resulting OC object into replicad using `setOC`, and then use replicad's API to construct a basic 3D shape (a cylinder with a hole). It highlights the core integration pattern for browser-based CAD applications.
Always check the `opencascade.js` and `replicad` release notes when upgrading for specific API adjustments. Review console errors carefully for clues about method or class deprecations.
Implement a Web Worker to handle the `initOpenCascade` call and all subsequent `replicad` operations that involve heavy computation. Transfer results back to the main thread for rendering or display.
Ensure Docker and `ytt` are installed and correctly configured if you intend to create or modify custom `opencascade.js` builds. For standard usage, simply install the `replicad-opencascadejs` npm package.
When using raw OCCT calls (if ever), avoid relying on fixed indices or names for topological elements across modifications. Use `replicad`'s higher-level abstractions and 'finders' (e.g., `FaceFinder`, `EdgeFinder`) where possible, as they are designed to provide more robust referencing.
Ensure you are using `import initOpenCascade from 'replicad-opencascadejs';` for ESM environments. Verify your build system correctly handles default exports.
Adjust the `locateFile` function passed to `initOpenCascade` to return the correct URL path for the `replicad-opencascadejs.wasm` file. Ensure the `.wasm` file is deployed to that accessible path relative to your application's entry point.
Ensure that the asynchronous `initOpenCascade()` call has completed and `setOC(OC)` has been successfully executed *before* any `replicad` functions that depend on the CAD kernel are invoked. Wrap your `replicad` logic in an `async` function and `await` the initialization.
No dependency data recorded yet.