This project is no longer actively maintained, and was written against an older version of OpenSCAD (v 2011.06) which has now been superseded.
npm install openscad-openjscad-translator
var parser = require('openscad-openjscad-translator') var fs = require("fs"); var openSCADText = fs.readFileSync("test.scad", "UTF8"); var openJSCADResult = parser.parse(openSCADText); console.log(openJSCADResult);
dist/web-built.js and the openscadOpenJscadParser object will be available. This has two attributes:
- parse - a function which accepts OpenSCAD text and returns OpenJsCAD text.
- parser - a Jison parser object which can be used for more advanced parsing (e.g. the parse method returns the text and the context object, allowing for processing of use statements.)
node tools/r.js -o build-web.js
Creates a optimised script (with Almond AMD loader) in the
Compiles the Jison lexer/parser to an AMD module in the
src folder called
As this work is predominantly a port of the OpenSCAD it is therefore also released under the General Public License version 2.