Not sure how many programmers we have here but I have created a Rust library that generates OpenSCAD code. My motivation for doing so was mainly because of the weird scoping rules for variables. Not being able to modify variables in a loop made it hard to do some of things I wanted to do.
The library is called scad_tree because it builds a tree that represents OpenSCAD operations that is then processed to generate the OpenSCAD code. It can be found on Github and on Crates.io. The library is licensed under the MIT license.
Here is a visualization of a chain of cubic bezier curves that comes in handy to create interesting shapes.
I learned a lot making this library and hope someone finds it useful. Thanks for reading and if anyone creates something cool with the library I would love to see it!
I think programmatic CAD, PCAD from now on, is still pretty niche but if your used to writing programs it’s pretty cool IMHO. There are some things that are definitely harder in OpenSCAD, like fillets, compared to graphical CAD though.
One of the nice things about PCAD is your models are just text files so it’s easy to use a version control system and store them online, I use GitHub. So I have a history of the changes that I have I made and a backup in case my computer fails.
You get the history and backup with some graphical CAD systems, Fusion360 comes to mind but I think the history is linear, you can’t back up and create a new branch without losing the first one. Thinking more I guess if you create a new version before you back up the history in F360 you don’t lose the original.
Also if you use PCAD you end up with a library of functions to do the things that you do often.
My library has almost 3,000 downloads on crates dot io which is way more interest than I thought when I wrote it!