cookiecad / Openscad-to-JSCAD-converter

6 stars 1 forks source link

And ManifoldCAD? #10

Open elalish opened 2 months ago

elalish commented 2 months ago

So excited to see this project! JSCAD and ManifoldCAD bear much resemblance - might it be possible to translate to our API? I've actually been considering releasing our worker code on npm to make it easy for anyone to take manifold-style JS/TS scripts and generate GLB/3MF models. This OpenSCAD conversion would give that a lot more value.

FYI @pca006132, since we've occasionally chatted about how to make a converter like this.

napter commented 2 months ago

Yes, definitely. I'll upload a POC soon. It won't be terribly difficult to change the jscad generator to a manifold generator.

napter commented 2 months ago

@elalish I've added the scaffolding for Manifold. It can now convert all manner of openscad cubes (below) to manifoldcad:

cube();
cube(1);
cube(size=2);
cube(3,true);
cube(size=4, center=true);
cube([1,2,3]);
cube([2,3,4],true);
cube(size=[3,4,5]);
cube(size=[4,5,6], center=true);
napter commented 2 months ago

@elalish Can you see if anyone in your community wants to help out in writing the manifold syntax generator? That would be really helpful in getting this off the ground.

I'll spin up a hosted version shortly so once it is useful, people don't have to download the repo to do the conversions.

elalish commented 2 months ago

Sure, I'll ask around. Could you maybe make a PR with some example Manifold syntax additions that we can use as an example? Ideally with some variety so we can understand how to handle different kinds of syntax.

napter commented 1 month ago

@elalish not a lot of variety yet, but here is a PR implementing cylinder: https://github.com/cookiecad/Openscad-to-JSCAD-converter/pull/11

napter commented 1 month ago

@elalish is there documentation that covers the manifold javascript syntax? I was having trouble locating it - the link from the npm package is 404.

Can you also please point me to the code where the objects and functions are all declared?

Thanks!

elalish commented 1 month ago

Yes, sorry we just fixed that, but that page won't update till we release a new npm version. Here's our brand new TS docs page: https://manifoldcad.org/jsdocs/

napter commented 1 month ago

@elalish great! Those pages look like they are generated by something. Do you have the data that built those pages in a structured format? If you can send that over that could be very helpful.

elalish commented 1 month ago

They're from our TS type declarations.