Generate STL file in NodeJS #610
-
Hello!! I just found out about maker.js and I think it is great. I'm trying to generate an STL file using NodeJS but I'm having some trouble. const makerjs = require('makerjs');
const { CAG } = require('@jscad/csg');
const stlSerializer = require('@jscad/stl-serializer');
const fs = require('fs');
const star = new makerjs.models.Star(7, 100, 50);
const svg = makerjs.exporter.toSVG(star);
// save svg to file
fs.writeFileSync('star.svg', svg);
const stl = makerjs.exporter.toJscadSTL(CAG, stlSerializer, star, { extrude: 50 });
// save stl to file
fs.writeFileSync('star.stl', stl); The SVG file is generated correctly, I can open the SVG and I see the star drawing.
Any ideas of what I may be doing wrong? Thanks!! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello, sorry but the Jscad implementation in Maker.js is way out of date. (The versions on the website are old frozen copies). The Jscad project has matured to the level of importing SVG, so you are probably best off with exporting to SVG then bringing that into Jscad's svg deserializer. |
Beta Was this translation helpful? Give feedback.
Hello, sorry but the Jscad implementation in Maker.js is way out of date. (The versions on the website are old frozen copies). The Jscad project has matured to the level of importing SVG, so you are probably best off with exporting to SVG then bringing that into Jscad's svg deserializer.