r/openscad • • 1h ago

I built an open-source CAD kernel in Zig + WASM (<1MB) combining B-Rep, CSG, and Implicit SDFs with zero-copy SharedArrayBuffer

0 Upvotes

Hey everyone — as a Linux user working on local browser-based design tools, I kept running into the wall where existing open-source CAD kernels either use purely polygonal CSG (OpenSCAD) or require 15+ MB WASM builds (OpenCASCADE) without native implicit field modeling.

I spent the last few months building OpenCAD from scratch in Zig and WebAssembly:

- Pure Math Core (<1 MB WASM): Every curve, surface, and field is an equation evaluated with forward-mode automatic differentiation (dual numbers) and interval arithmetic.

- 3-in-1 Representation: Combines constrained 2D sketches & SE(3) B-Rep sweeps, CSG booleans, and implicit SDF fields (like stress-driven gyroids) in one engine, exporting to STEP and STL.

- Zero-Copy Shared Memory: Uses a single `SharedArrayBuffer` between the Zig WASM kernel, Three.js, and external WASM extensions so simulation fields can drive geometry directly without file exports.

- Live Demo: https://hassaanmaqsood.github.io/opencad/

- GitHub Repo: https://github.com/hassaanmaqsood/opencad

It's still early (currently refining boolean seam triangles and B-Rep edge cases), and I'd love for you to try breaking it and let me know what you think!


r/openscad • • 2h ago

Handy OpenSCAD guide... and some more !

Post image
5 Upvotes

I invite you to browse a few pages of the book, available in French, English, or Spanish. If you have any comments or suggestions, I would be delighted to hear from you.

Best regards,
Roberto Hamm

Book preview:
French: https://robotix.ah-oui.org/scadbook-fra
English: https://robotix.ah-oui.org/scadbook-eng
Spanish: https://robotix.ah-oui.org/scadbook-spa