I wonder how many OpenSCAD wrappers now exist? I know of scad-clj [0], openpyscad [1], and solidpython [2].
I particularly like scad-clj, because of `lein auto generate`. It watches source files, and regenerates the OpenSCAD files automatically, which OpenSCAD then also picks up. Although I'm not well versed in Clojure, and find debugging Clojure tricky, the workflow is just so good.
I don't recommend anyone try to use it, but there's also OpenCSCAD[1], which allows metaprogramming openscad from C. I wrote it ages ago, back when OpenSCAD didn't support recursion[2]. Back in the early days of openscad, (as I recall it) there were quite a few annoying things missing which I suspect caused some of the proliferation of metaprogramming attempts.
[2] At least I think OpenSCAD didn't support recursion back then, though now, this seems so unlikely that I find myself doubting it. But I also feel like I must have tried it, found it not working, and went on to write this toy OpenCSCAD thing as a result. It was a long time ago, and I don't really remember.
Edit: A previous discussion here about Amazon banning the word "union" from chat rooms (among other words) recently reminded me of this too, as "union" in OpenSCAD is obviously a thing, but it's also a reserved word in C. In OpenCSCAD, a union is therefore called an "onion". This could also work at Amazon. Until they banned onions.
I always thought it would be interesting to use the solution seeking of Prolog to design a physical object, but haven't figured out a usecase. Funny that in my house it would be possible to trigger the design of an object by a MQTT message of an event, slice that object, then turn on my 3D printer and print it with no manual intervention.
For example: You could enter some fragile object and then let the Prolog search for best shape of box for it.
Only problem is that all (most?) Prologs suck, the realm of natural numbers is not in the search space. In this case there is also good cause to limit this realm by available printing area and accuracy.
Yeah the Prolog part would probably have to just do a yes/no analysis of whether the proposed solution is even a candidate, but then maybe something else would score the quality of the remaining candidates.
Another possibility might be using Prolog's list/object composing ability. As a fun example let's imagine that you have a Flintstone's AirBNB. You write Prolog code to capture some pieces like a weather forecast icon and a headline or two, then compose that into a design that looks like this info on a stone tablet and send it to the printer loaded with marble colored filament, then have it on the table with breakfast.
There's also inotifywatch on linux and fswatch on mac which makes it stupidly simple to do the same thing in a shell script. I'm sure there's alternatives for BSD Unix and Windows, but I care the least about those OS's.
you know the language is limited/poorly thought out when dozens of people re putting time into making tools that do nothing but wrap it in order to make it usable.
OpenSCAD is a terrible programming language. It's a bull moose on bad acid of a specification language, tho. So much so that its easy to mistake it for the programming language it isn't, and hurt yourself trying to milk it in the same way.
> CadQuery is often compared to OpenSCAD. Like OpenSCAD, CadQuery is an open-source, script based, parametric model generator. However, CadQuery stands out in many ways and has several key advantages:
> The scripts use a standard programming language, Python, and thus can benefit from the associated infrastructure. This includes many standard libraries and IDEs.
> CadQuery's CAD kernel Open CASCADE Technology (OCCT) is much more powerful than the CGAL used by OpenSCAD. Features supported natively by OCCT include NURBS, splines, surface sewing, STL repair, STEP import/export, and other complex operations, in addition to the standard CSG operations supported by CGAL
> Ability to import/export STEP and the ability to begin with a STEP model, created in a CAD package, and then add parametric features. This is possible in OpenSCAD using STL, but STL is a lossy format.
> CadQuery scripts require less code to create most objects, because it is possible to locate features based on the position of other features, workplanes, vertices, etc.
> CadQuery scripts can build STL, STEP, and AMF faster than OpenSCAD.
What are some of the advantages of OpenSCAD tooling?
From the limited work I've done in it, it comes off as poor for it's specific use as well.
As an example, one thing that frustrates me is not having access to the geometry of an object. I fairly frequently want to do something like "add this piece so that it's 20% down from the upper edge of this other piece". I've yet to find any way to do that cleanly, despite it seeming like a common use case. The absolute addressing system can be painful, since updating a piece can require updating locations in lots of place. Likewise, but worse, it's extremely painful to rotate and object, because your algorithms for finding the location break.
I've largely given up and use Fusion. I like being able to version control my models, but SCAD feels like I'm working blind with a hand tied behind my back, rather than making things feel expressive like they usually do.
Also all of your base points should be variables and your placements operations on those variables. Anything that is dynamically sized should also be built from variables. I usually use a single function per distinct piece of geometry, then use composition.
openscad could definitely use at least a few things the article mentioned even if it remains a low level layer, and I don't generally like transpilers, but there is nothing automatically wrong with a language that provides mostly primitives and other languages build higher level things out of those.
I don't think the problem is the language but rather the fact that it should have been a pure library to begin with. The fact that libraries are used by many languages isn't surprising. What's surprising is that using the library requires compiling to another language.
I particularly like scad-clj, because of `lein auto generate`. It watches source files, and regenerates the OpenSCAD files automatically, which OpenSCAD then also picks up. Although I'm not well versed in Clojure, and find debugging Clojure tricky, the workflow is just so good.
[0] https://github.com/farrellm/scad-clj
[1] https://github.com/taxpon/openpyscad
[2] https://github.com/SolidCode/SolidPython