GhostSCAD: Marrying OpenSCAD and Golang
jany.st
jany.st
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
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.
[1] http://smcameron.github.io/opencscad/
[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.
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.
The geometry is the effect, not the cause.
So it doesn't really matter how good the language is.
Much like sendmail.cf files.
That's an exaggeration, being as bad as sendmail.cf is really hard. You have to get to Brainfuck[1] level to beat sendmail.cf
However, I agree, the OpenSCAD language is pretty darn bad.
So bad in fact that someone had to write an OpenSCAD parser in OpenSCAD just to be able to do what he wanted:
https://github.com/davidson16807/relativity.scad/blob/master...
> 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?
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.
inotify() is awesome. Here's a library in python that does it.
https://michaelcho.me/article/using-pythons-watchdog-to-moni...
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.
https://github.com/emcrisostomo/fswatch https://linux.die.net/man/1/inotifywatch
I used it to design this piece for use with Gravitrax, for example: https://share.icloud.com/photos/0b2yeTGdLftZV17btg-KTEYog
Heavy bias on 3D printing though.
At first glance, doesn't look as general as other CAD tools.
The code isn't at all well-structured or documented. It needs external power and is designed around this motor: https://www.amazon.co.uk/gp/product/B009AQLDSS.