Using Snap! to generate OpenSCAD scripts

I use TinkerCAD as my main 3D tool and decided to try out it’s Codeblocks option to parametrically construct a 3D object (namely a gridFinity bin)

I managed to do it but then got an error message about exceeding 200 primitives and realised that I’d hit its limits

So, I decided to look into using OpenSCAD instead but then had an idea!

Snap! has an example project called Codification which shows how Snap! blocks can be transcoded into JavaScript, Smalltalk, Python and C

So, I thought – I wonder if I could adapt this into generating OpenSCAD scripts.

And the project went very well. Not only was it relatively easy to modify the Codification example to cope with simple OpenSCAD syntax, it turned out that OpenSCAD has a great feature to monitor changes in .scad files.

So every time I exported an updated .scad file from Snap!, OpenSCAD would updates its preview automatically 🙂 This meant the workflow was nearly as good as using Codeblocks in TinkerCAD – but with al lthe power and customisation offered by Snap!

I started a thread on the Snap! forum but I’ve realised that I’m going to have to document the project a bit more than that. So this is the place that I’m going to do that