--- title: STL ---
To use this functionality you will need the OpenJsCsg library which is a fork of OpenJsCad without the GUI.
Note: This is here for your debugging convenience. For complex models, 3D rendering on the main thread of the browser can make your page unresponsive. It is advised that you use a web worker instead.
From the command line:
{% highlight bash %} npm install openjscad-csg --save {% endhighlight %}In your Node.js code:
{% highlight javascript %} var makerjs = require('makerjs'); var fs = require('fs'); var model = new makerjs.models.Star(5, 100); model.paths.c = new makerjs.paths.Circle([0, 0], 20); fs.writeFileSync('star.stl', makerjs.exporter.toSTL(model)); {% endhighlight %}
Call makerjs.exporter.toSTL(model) passing your model.
This function returns a string of STL.
Call makerjs.exporter.toSTL(model, options) passing your model and an options object.