OpenSCAD Web Playground
See the codeThis is a limited port of OpenSCAD to WebAssembly, using at its core a headless WASM build of OpenSCAD (done by @DSchroer), wrapped in a UI made of pretty PrimeReact components, a React Monaco editor (VS Codesque power!), and an interactive model-viewer renderer.
It defaults to the Manifold backend so it's super fast.
Enjoy!
Licenses: see LICENSES.
The project uses a webpack-based build system that reads library metadata from libs-config.json to automatically download, clone, and package OpenSCAD libraries and dependencies. This replaces the previous Makefile approach with a more standard, maintainable solution.
Prerequisites:
docker run --privileged --rm tonistiigi/binfmt --install all
Local dev:
npm run build:libs # Download WASM and build all OpenSCAD libraries
npm install
npm run start
# http://localhost:4000/
Local prod (test both the different inlining and serving under a prefix):
npm run build:libs # Download WASM and build all OpenSCAD libraries
npm install
npm run start:production
# http://localhost:3000/dist/
Deployment (edit "homepage" in package.json to match your deployment root!):
npm run build:all # Build libraries and compile the application
npm install
rm -fR ../ochafik.github.io/openscad2 && cp -R dist ../ochafik.github.io/openscad2
# Now commit and push changes, wait for site update and enjoy!
The build system fetches a prebuilt OpenSCAD web WASM binary, but you can build your own in a couple of minutes:
Optional: use your own openscad fork / branch:
rm -fR libs/openscad
ln -s $PWD/../absolute/path/to/your/openscad libs/openscad
# If you had a native build directory, delete it.
rm -fR libs/openscad/build
Build WASM binary (add WASM_BUILD=Debug argument if you'd like to debug any cryptic crashes):
npm run build:libs:wasm
Then continue the build:
npm run build:libs
npm run start
The build system uses a webpack plugin that reads from libs-config.json to manage all library dependencies. You'll need to update 3 files (search for BOSL2 for an example):
libs-config.json: to add the library's metadata including repository URL, branch, and files to include/exclude in the zip archive
src/fs/zip-archives.ts: to use the .zip archive in the UI (both for file explorer and automatic imports mounting)
LICENSE.md: most libraries require proper disclosure of their usage and of their license. If a license is unique, paste it in full, otherwise, link to one of the standard ones already there.
In libs-config.json, add an entry like this:
{
"name": "LibraryName",
"repo": "https://github.com/user/repo.git",
"branch": "main",
"zipIncludes": ["*.scad", "LICENSE", "examples"],
"zipExcludes": ["**/tests/**"],
"workingDir": "."
}
Available build commands:
npm run build:libs - Build all librariesnpm run build:libs:clean - Clean all build artifactsnpm run build:libs:wasm - Download/build just the WASM binarynpm run build:libs:fonts - Download/build just the fontsSend us a PR, then once it's merged request an update to the hosted https://ochafik.com/openscad2 demo.
TypeScript
85.3%
JavaScript
11.5%
HTML
2.4%
OpenSCAD Web Playground
See the codeThis is a limited port of OpenSCAD to WebAssembly, using at its core a headless WASM build of OpenSCAD (done by @DSchroer), wrapped in a UI made of pretty PrimeReact components, a React Monaco editor (VS Codesque power!), and an interactive model-viewer renderer.
It defaults to the Manifold backend so it's super fast.
Enjoy!
Licenses: see LICENSES.
The project uses a webpack-based build system that reads library metadata from libs-config.json to automatically download, clone, and package OpenSCAD libraries and dependencies. This replaces the previous Makefile approach with a more standard, maintainable solution.
Prerequisites:
docker run --privileged --rm tonistiigi/binfmt --install all
Local dev:
npm run build:libs # Download WASM and build all OpenSCAD libraries
npm install
npm run start
# http://localhost:4000/
Local prod (test both the different inlining and serving under a prefix):
npm run build:libs # Download WASM and build all OpenSCAD libraries
npm install
npm run start:production
# http://localhost:3000/dist/
Deployment (edit "homepage" in package.json to match your deployment root!):
npm run build:all # Build libraries and compile the application
npm install
rm -fR ../ochafik.github.io/openscad2 && cp -R dist ../ochafik.github.io/openscad2
# Now commit and push changes, wait for site update and enjoy!
The build system fetches a prebuilt OpenSCAD web WASM binary, but you can build your own in a couple of minutes:
Optional: use your own openscad fork / branch:
rm -fR libs/openscad
ln -s $PWD/../absolute/path/to/your/openscad libs/openscad
# If you had a native build directory, delete it.
rm -fR libs/openscad/build
Build WASM binary (add WASM_BUILD=Debug argument if you'd like to debug any cryptic crashes):
npm run build:libs:wasm
Then continue the build:
npm run build:libs
npm run start
The build system uses a webpack plugin that reads from libs-config.json to manage all library dependencies. You'll need to update 3 files (search for BOSL2 for an example):
libs-config.json: to add the library's metadata including repository URL, branch, and files to include/exclude in the zip archive
src/fs/zip-archives.ts: to use the .zip archive in the UI (both for file explorer and automatic imports mounting)
LICENSE.md: most libraries require proper disclosure of their usage and of their license. If a license is unique, paste it in full, otherwise, link to one of the standard ones already there.
In libs-config.json, add an entry like this:
{
"name": "LibraryName",
"repo": "https://github.com/user/repo.git",
"branch": "main",
"zipIncludes": ["*.scad", "LICENSE", "examples"],
"zipExcludes": ["**/tests/**"],
"workingDir": "."
}
Available build commands:
npm run build:libs - Build all librariesnpm run build:libs:clean - Clean all build artifactsnpm run build:libs:wasm - Download/build just the WASM binarynpm run build:libs:fonts - Download/build just the fontsSend us a PR, then once it's merged request an update to the hosted https://ochafik.com/openscad2 demo.
TypeScript
85.3%
JavaScript
11.5%
HTML
2.4%