Open apla opened 2 years ago
Excellent, let me know if you will need help.
Join discord if you are in a mood to discuss jscad related stuff. Beware, tho, I am rather chatty and opinionated. https://discord.gg/UXtQcA6
not sure if you changed your jscad impl, but current master branch param name for precision is segments
cylinder({radius: 3.1, height: 20, center: [0, 0, 10], resolution: 30}))
-->
cylinder({radius: 3.1, height: 20, center: [0, 0, 10], segments: 30}))
No, I haven't changed anything in jscad
. I'll fix it.
This is my modifications https://github.com/protobor/OpenJSCAD.org/commit/d0e49bebe4b243af984047c7b09947eafdfd9f60
If somebody wants to try it out, I test changes with simple script
// const parser = require('@jscad/openscad-openjscad-translator');
const parser = require('scad-deserializer');
const fs = require('fs').promises;
fs.readFile(process.argv[2], "UTF8").then (openSCADText => {
const openJSCADResult = parser.parse(openSCADText);
const jscadFilename = process.argv[2].replace (/\.scad$/, '.jscad');
return fs.writeFile (jscadFilename, openJSCADResult);
});
as an input file I'm using x-carriage-back.scad
from Prusa i3 repo
Some related issues just in case you feel motivated. 😃
@z3dev I've already found some bugs in jison file, some valid constructs like one below cannot be processed:
module selective_infill()
mirror([0,1,0]) translate([-50, -33, 0.6])
{ ... }
User needs to wrap module contents with {}
like this
module selective_infill() {
mirror([0,1,0]) translate([-50, -33, 0.6])
{ ... }
}
So, jison grammar should be modified. Problem is — output is unreadable. Even slightest modification impossible. I modified the output to return same constructs in JSCAD. Now it lookalike and can be hacked by other people.
Adding diameter for cylinder #392 is trivial, others probably not.
@apla Did you manage to create a new version of the serializer? Any chance that we can play with it and give some feedback?
I did some OpenSCAD improvements to generate human readable results.
scad file:
jscad
It's still WIP, but allows me to convert some files from Prusa i3 printer repo.
Can't show my fork at this time; instead of using last version from
git
I've used last version fromnpm
. It will take some time to commit my changes.This issue just for indication I'm working on this part.