Welcome! Log In Create A New Profile

Advanced

OpenSCAD in the browser - now using csg.js for simple boolean ops

Posted by marcosscriven 
OpenSCAD in the browser - now using csg.js for simple boolean ops
April 20, 2013 04:45PM
Hi

I've just updated http://www.fabfabbers.com/openscad/

It now uses csg.js to do the simple boolean CSG ops (union, difference, intersection), but still uses the OpenSCAD parsing and primitive mesh generation. This is an awful lot faster, and makes it useable for iterative designing, as well as just one-off STL generation.

A few things to note:

1) I still recommend Firefox 23 (nightly build), as it supports a subset of Javascript called asm.js, which runs a lot faster for the complex CGAL ops like Minkowski etc.
2) While this is using csg.js, it's not using that for any kind of parsing or primitive generation. The cubes/spheres etc are exactly as you'd get in OpenSCAD
3) For those wondering, why not cross-compile OpenCSG to Javascript as well; I looked into that, but realised that WebGL doesn't support OpenGL querys
4) Although csg.js is slower than OpenCSG, the good news is that the 3d model you see is actually a calculated mesh - not just an OpenGL trick. That means there'll be no need for the lengthy CGAL step! At the moment however, csg.js seems to give the odd artifact, so until I'm sure the STL generated from the csg.js mesh is perfectly accurate, I'm leaving the original 'Generate STL' option there.
5) As mentioned before, if you load OpenSCAD code from models on the site, all the .scad files will be loaded into the context, so 'use', 'import' etc should work.

I'd be really pleased for any feedback on this - there's a huge list of features that could be added, but not entirely sure what (if at all) people want.

Thanks

Marcos

Edited 3 time(s). Last edit at 04/20/2013 04:50PM by marcosscriven.
Sorry, only registered users may post in this forum.

Click here to login