Profile cover photo
Profile photo
OpenSCAD + JavaScript =
OpenSCAD + JavaScript =

About's interests's posts

Post has attachment
Update 2013/04/11: 0.017

Main new feature is alpha channel (alpha 0: transparent, alpha 1: opaque) contributed by +Eduard Bespalov.


or OpenSCAD-like:
color([r,g,b], object, object2... or []);
color([r,g,b,a], object, object2 .. or []);
color(namedColor, object .. or []);  // like color('red',sphere());
color(namedColor, a, object, object2... or []);  // like color('red',0.5,sphere());

so, transparency should work fine given the OpenGL limitation as mentioned

Also, the AMF import & export has been refined to comply closer to the official specs and support of metadata (which will be extended further), and support now of alpha channel as well, see "Transparency" examples (JSCAD and AMF): (the same as above, yet in AMF)

Further, the hull() of 2D forms has been added, see and read more in the User Manual - essentially throw a couple of 2D forms, e.g. place 4x circles, and hull them and extrude, you get a cube with vertical round edges.

As well axis dependent center, e.g.
cube({ size: [1,2,3], center: true });
cube({ size: [1,2,3], center: [true, false, true] });
see an elaborate example at

Note: since this feature and notion comes from OpenSCAD, also the defaults of such have been adapted, check the documentation.

-- Rene

Post has attachment
Update 2013/04/07: 0.016

solidFromSlices() by +Eduard Bespalov - and a bunch of beautiful examples (essentially 2d polygons extruded into a solid), see the new examples, and the source files at
Eduard and I will update the documentation later today as well.

single polygon setColor() implemented; .setColor(r,g,b) or .setColor([r,g,b]);  (and thinking ahead for multi-material objects for proper AMF support)

AMF export / import stabilized, those .amf from the AMF web-site all can be imported, geometrically correct, coloring also correct (polygon-level); which means you can now save rendered .jscad into .amf and when loading all polygons are colored correctly.

-- Rene

Post has attachment
Update 2013/04/05 0.015

Essentially AMF export and import, very very experimental (not even sure it's a valid AMF), so don't rely on it yet.

If you are working on CLI (command-line interface), be aware nodejs > 0.8.1 is required (best update to 0.10.3), and default path changed from /usr/bin/nodejs to /usr/local/bin/node - this was required as I use jquery on nodejs to parse XML (AMF).

There are various small changes, some code clean up in openjscad.js and preparing to support multiple CSG without being united (union()).

-- Rene

Post has attachment
Update 2013/04/03 0.014:

Drag & Drop of multiple files (Chrome & Firefox) and folder(s) (Chrome only), essentially you develop locally with your favorite editor, and (actual site, local web-server or offline) tracks the changes and if [x] Auto Reload and reloads and re-renders the construction/scene.

This is very experimental feature, and handling for more than 5+ files hasn't been tested (what happens when large amount of files are tracked at Auto Reload), I have to see how scaleable and feasible it will remain.

I also suggest a style how to compose larger projects:

Example 050 and Example 051 show the include() example as available since 0.013, which you can drag & drop (given you did a local installation) the local files into the browser, and change it with your own editor.

Firefox: I noticed middle/right button didn't work, you use SHIFT or ALT to pan and rotate XY alternatively. 

Comment: I have been reluctant to extend OpenJSCAD's GUI much further, e.g. reimplement an entire desktop app again (File -> Open/Save/Export/etc) for now, as it redo's what outside of the browser already works. I am also not so convinced of the browser filesystem to save files - so for now it's drag & drop which ties local files to the browser (one way); this is also why the built-in editor vanishes once more than one file is dropped into OpenJSCAD.

-- Rene

Post has attachment
Update 2013/04/01 0.013:

include() works on web-online & drag'n'drop and cli (command line interface/server-side), but not offline (+Derrick Oswald  , sorry not yet, but I will look into it), in other words, you have to run a local web-server so the dependencies (includes()) can be resolved. There might be a way around to support Dropbox connection via one's local dropbox, but I have to take a close look to it.

Anyway, see the online example:

or click on Examples: "Recursive Include(): Platonics", and see related sources of tests:

The remote and local web reference as of or I haven't documented yet and put into the announcement, because I like to gather some more experiences and decide then to keep it or remove it (e.g. due security concerns).

Also, include() and includePath() (only required when doing drag'n'drop) is a very preliminary functionality, and it might change later - as I like to coordinate with +Mark Moissette  a possible sharing of common JavaScript/CoffeeScript libraries among and

So I perhaps will document the include() mechanism in the wiki tonight with the disclaimer that it might change at a later time (hopefully insignificantly) - this is when you are able to experience bleeding edge software development ;-) -- Rene

Update 2013/03/30 0.012:

Improved the UI with a sliding menu on the left, helps when one plays with "Interactive param" examples, see

Post has attachment
Update 2013/03/28 0.011:

Added rectangular_extrude() along a 2D path, rotate_extrude() and torus(), see example025, 028 and 029 in and "Rectangular_extrude()", "Rotate_extrude()" and "Torus()" example at direct.

Also the documentation as been updated accordingly.

-- Rene

Inquery about include() functionality, I still have been testing around, but I think it's better I get some feedback from others:

How should include() actually behave:
- self-contained, like a module (e.g. like require() in nodejs) which has to export function/methods etc
- be just unstructured, have all variables global, e.g. concate all include() into one big file to execute (might cause problems with error messages as line count being no longer accurate) as web-browser <script src="a.js"/> does?

Right now I focus on the drag'n'drop of entire folder, in order to have include() work on the browser, and on openjscad cli level there ain't alike restrictions.

-- Rene

First post .. just testing
Wait while more posts are being loaded