Openscad: libopenscad? C(++)-library that is largely analogous to the .scad files?

Created on 31 Aug 2012  路  4Comments  路  Source: openscad/openscad

Could openscad by split up into a C(++) library and a program that basically parses and uses the analogous library function? The 'objects building' interface could basically be analogous to Cairo, instead of translate and scale directly, you do so modifying the context. (And you can openscad_push_matrix and such.)

On the 'have an object and want to do stuff with it side' It would also be nice to have some functions for determine if a point or line is inside objects, and which, and for the line, which, length of line section, where. And basic drawing primitives, of course.

I guess the CGAL and OpenCSG have something like this, but people would basically be able to pick up libopenscad immediately if it worked the same as cairo.(given some example code that worked) (I could pick up cairo easily.) Can't say the same about CGAL, just look at the tutorials.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Enhancement

All 4 comments

I'm not familiar with Cairo, but in terms of an OpenSCAD library, this has been discussed earlier on the mailing list. There's been done some work to split out the GUI from the front-end. If you look at the cmd-line tools in tests/, you'll see how they use the back-end directly. This still involves parsing files, but a next step could be to clean up the underlying APIs and provide a more low-level way of building primitives. In the end, you could build a tree of module/module instantiations, or construct nodes directly. Once you have a concrete node tree, you can transform that to OpenCSG, CGAL or whatever other method you choose to implement.

Building clean C++ APIs is not trivial though, and I think the main obstacle would be to keep such an API backwards compatible across internal refactoring jobs.

Working towards this is, on the other hand, a good thing.

Is being partially addressed by #1743

Hello just to clarify myself. The possibility to link to a lib(_libopenscad_?) which would provide me some kind of API that I could indicate a scad file, and get back some _kind of vertex/faces list_, is still not possible, right?

There is no library at this point. So the only way right now would be to call the openscad binary to generate the output.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iasj picture iasj  路  8Comments

t-paul picture t-paul  路  6Comments

traverseda picture traverseda  路  7Comments

ghost picture ghost  路  15Comments

andrewwutw picture andrewwutw  路  9Comments