# CAD engine source and replacement instructions

The STEP/IGES/BREP engine is occt-import-js 0.0.23, LGPL-2.1, with Open CASCADE and its additional exception. Full license texts are included in the app's notices and as separate viewer assets. No proprietary restriction is imposed here on modifying or debugging these library components.

Upstream wrapper revision: c2148e54b456b571238d35cac037d304053d64b2 (tag 0.0.23).
Upstream OCCT submodule revision: d2abb6d844231cb8f29be6894440874a4700e4a5.
The npm WASM file matches the tag's WASM byte-for-byte (SHA256 33391fc9d94ea5c869a6718488bf0a9a464222bac9bdc764dfe1690cef281952).

Corresponding-source archives are supplied alongside the app source in deliverables/cad-engine-sources:
- occt-import-js-0.0.23-source.zip: wrapper source, build scripts, licenses and upstream examples.
- OCCT-d2abb6d-source.zip: the matching full OCCT source tree.

To rebuild the library, extract the wrapper source, extract the OCCT source into its occt subdirectory, and follow the upstream README/build scripts. The upstream Windows setup script specifies Emscripten 3.1.69. Compiler/toolchain dependencies must be installed separately. Rebuilding the upstream engine itself has not been independently reproduced here.

To replace the engine, place compatible rebuilt occt-import-js.js and occt-import-js.wasm in node_modules/occt-import-js/dist, retaining the license texts. Run node scripts/build-web.mjs. That script copies these files without bundling them into our application JavaScript. The adapter is web/cad-worker.js and uses the public ReadStepFile, ReadIgesFile and ReadBrepFile functions.

The complete application source is also supplied to allow rebuilding the Android package with the replacement library. Install dependencies with npm ci, build web assets, then run gradlew.bat :app:assembleDebug with JDK 21 and Android SDK 36/build-tools 35.0.1 configured. Gradle generates a development signing key as needed. A build signed with your own key cannot update an installation signed with a different key; use a distinct application ID or back up data before replacing that installation. No production signing secrets are required or supplied.

Do not distribute the new APK without its accompanying license notices and corresponding-source materials. Public Play distribution still needs a durable public source-download arrangement and accurate store notices; local archives alone are not a public hosting solution.
