feat: add B-Rep STEP export via brepjs + OpenCascade

Reconstruct parametric box/cylinder/sphere shapes as exact OpenCascade
B-Rep solids and write a named, colored multi-body STEP assembly, cutting
holes via boolean subtraction (only against bodies they overlap). brepjs
and the 22 MB occt-wasm kernel load lazily on first export, so the initial
bundle is unchanged.

Unsupported shape kinds are skipped with an in-app notice. Cones are exact
in the kernel but skipped pending an upstream occt-wasm multi-solid STEP
writer fix that drops conical surfaces.

occt-wasm runtime is staged into public/occt by scripts/copy-occt-wasm.mjs
(gitignored) and loaded outside the bundler; the optional brepkit /
opencascade kernel backends are aliased away in next.config.
This commit is contained in:
Andy Aragon
2026-06-29 15:03:32 +03:00
committed by Formsmith
parent a4901007b9
commit b292cc14eb
8 changed files with 417 additions and 6 deletions
+94 -4
View File
@@ -10,11 +10,12 @@
"dependencies": {
"@tailwindcss/postcss": "^4.1.8",
"@types/three": "^0.184.1",
"brepjs": "^18.118.0",
"clsx": "^2.1.1",
"lucide-react": "^0.511.0",
"manifold-3d": "^3.5.0",
"next": "^15.3.2",
"occt-wasm": "^3.5.0",
"occt-wasm": "^3.6.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"tailwind-merge": "^3.3.0",
@@ -1573,6 +1574,52 @@
"node": ">=12"
}
},
"node_modules/brepjs": {
"version": "18.118.0",
"resolved": "https://registry.npmjs.org/brepjs/-/brepjs-18.118.0.tgz",
"integrity": "sha512-rFO8xDh0RE8mF1hiP7vxiSI/DRQqA2znKGfojMTHg9p6AjFg3J+MGoVvo0r9z0bWC6SgT33LYZe57neZ3fAm2w==",
"license": "Apache-2.0",
"workspaces": [
"packages/brepjs-opencascade",
"packages/brepjs-bim",
"packages/brepjs-sheetmetal",
"packages/brepjs-manifold",
"packages/brepjs-voxel-wasm",
"packages/brepjs-voxel",
"packages/brepjs-cad",
"packages/brepjs-viewer",
"packages/brepjs-vscode",
"apps/playground",
"apps/docs"
],
"dependencies": {
"flatbush": "4.6.2",
"opentype.js": "1.3.4"
},
"engines": {
"node": ">=24"
},
"peerDependencies": {
"brepjs-manifold": "^0.1.0",
"brepjs-opencascade": "^0.5.1 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^0.14.0 || ^0.15.0 || ^0.16.0",
"brepkit-wasm": "^0.10.1 || ^1.0.0 || ^2.0.0",
"occt-wasm": "^3.6.0"
},
"peerDependenciesMeta": {
"brepjs-manifold": {
"optional": true
},
"brepjs-opencascade": {
"optional": true
},
"brepkit-wasm": {
"optional": true
},
"occt-wasm": {
"optional": true
}
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001792",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001792.tgz",
@@ -1779,6 +1826,21 @@
"integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==",
"license": "MIT"
},
"node_modules/flatbush": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/flatbush/-/flatbush-4.6.2.tgz",
"integrity": "sha512-nNT7MFJ58Q4IAm3aYsEg+zgZGpdRcmR1i4U+aa8c+r91jmYZg7FTQwNnIMC0FyBqVZTbClKdAnrJkKkfp1BOvw==",
"license": "ISC",
"dependencies": {
"flatqueue": "^3.1.0"
}
},
"node_modules/flatqueue": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/flatqueue/-/flatqueue-3.1.0.tgz",
"integrity": "sha512-Ia4qIYrrsEqIRx3c3XhkT+QDLQuUV5ovsr6ah1rIgKT5wclhoGK3lAMS1bWRAWxlx7wtlTBpV7QXB5d9fOSRxA==",
"license": "ISC"
},
"node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
@@ -2282,14 +2344,30 @@
}
},
"node_modules/occt-wasm": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/occt-wasm/-/occt-wasm-3.5.0.tgz",
"integrity": "sha512-aKcaX7S2MKMafTFXFNCXrVQgQjK6kfvcTtlxDFtqoZHb+gx5Vzh4pH8P6mIobBhmLcyCiKbwyQrXWFj2zVX5jw==",
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/occt-wasm/-/occt-wasm-3.6.0.tgz",
"integrity": "sha512-qDTnqaRL73DkrqM7cdCJN8FStJm28W9TVXqJXofZQihlA/mX6mnkmE19FkWNrSsixVE676FMtL3V80lzAbG+GQ==",
"license": "MIT OR Apache-2.0",
"dependencies": {
"comlink": "^4.4.2"
}
},
"node_modules/opentype.js": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/opentype.js/-/opentype.js-1.3.4.tgz",
"integrity": "sha512-d2JE9RP/6uagpQAVtJoF0pJJA/fgai89Cc50Yp0EJHk+eLp6QQ7gBoblsnubRULNY132I0J1QKMJ+JTbMqz4sw==",
"license": "MIT",
"dependencies": {
"string.prototype.codepointat": "^0.2.1",
"tiny-inflate": "^1.0.3"
},
"bin": {
"ot": "bin/ot"
},
"engines": {
"node": ">= 8.0.0"
}
},
"node_modules/path-expression-matcher": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.5.0.tgz",
@@ -2512,6 +2590,12 @@
"dev": true,
"license": "MIT"
},
"node_modules/string.prototype.codepointat": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/string.prototype.codepointat/-/string.prototype.codepointat-0.2.1.tgz",
"integrity": "sha512-2cBVCj6I4IOvEnjgO/hWqXjqBGsY+zwPmHl12Srk9IXSZ56Jwwmy+66XO5Iut/oQVR7t5ihYdLB0GMa4alEUcg==",
"license": "MIT"
},
"node_modules/strnum": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/strnum/-/strnum-2.3.0.tgz",
@@ -2602,6 +2686,12 @@
"three": ">= 0.159.0"
}
},
"node_modules/tiny-inflate": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz",
"integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==",
"license": "MIT"
},
"node_modules/tinybench": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz",