jscad

OpenJSCAD

Usage no npm install needed!

<script type="module">
  import jscad from 'https://cdn.skypack.dev/jscad';
</script>

README

Origin

This is from https://openjscad.org. I just made a few changes to use it as a Node library. (Made a PR that's been open for awhile.)

Node.js (as library)

Add to project:

npm i --save jscad 

Create a 'lumber' module:


require('jscad');

exports._2x4 = function _2x4() {
  return cube({size:[2,4,96]});
}

Use your module to build something and render to STL file:

var cad = require('jscad');
inc('./lumber.js');

function board(n) {
  return [ color('yellow', _2x4().rotateY(210).translate([0,n*24,0])) ] 
}

cad.renderFile(board(0), 'boards.stl');

Documentation