Rust library that generates OpenSCAD code

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 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.

Here is a bottle that I made as an example of library usage.

This was made with bezier curves and a sweep function that takes a 2D profile and extrudes it along a path with a twist.

The library can also easily make metric threaded parts, rendered here with Blender.

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!


1 Like

@_Michael It looks fascinating, Michael. Now, if only I understood one word you said … :smiley: