Things that I've 3D Printed Using Haskell

Posted on June 30, 2024

Last year, I released a library for doing Programmable CAD in Haskell, called Waterfall-CAD

I’ve written about that library before, but now that I’ve had a chance to actually use it to design some things, I wanted to post about my experience making them.

This isn’t a tutorial for the library (I really ought to write one of those). Neither is it a tour of the API; if you’re looking for that, I’d highly recommend you check out the waterfall-cad-examples project, either on Github or on Hackage.

If this article sparks your interest in Waterfall-CAD, or you want to try designing something in it yourself, there’s a Waterfall-CAD Discord server1.

Compound of 5 Cubes


I got the idea to print this after seeing a picture of one in that “Stop Doing Math” meme.

This was a super easy to design in programmable CAD, because it’s literally just a cube, rotated around an axis five times.

I did find “figuring out the correct axis of rotation” a little tricky. The best source I could find for this was Wolfram Mathworld, which said:

The first 5-compound compound can be generated by starting with an initial cube centered at the origin and oriented along the axes, then adding four more cubes obtained from the initial cube by rotations through angles -2nπ/5 about the axis (1,φ,0) for n=1, 2, 3, 4.

Maybe I was being dim, but it took me a fair while to realize that φ (phi) here was referring to the golden ratio.

I find that rotating an object a set number of times around an axis to produce a result with rotational symmetry is a moderately common pattern in programmable CAD.

I’ve found that my favourite way to write this is using iterate, like so:

spin :: V3 Double -> Integer -> Waterfall.Solid -> Waterfall.Solid
spin axis n = 
    let angle = 2 * pi/ fromInteger n
     in mconcat . take n . iterate (Waterfall.rotate axis angle) 

I keep wondering if it’d be worth including this in some part of the Waterfall-CAD API. For the time being, my thinking is that it’s easy enough to rewrite on a case by case basis; the function doesn’t pass the Fairbairn threshold.

I’ve printed a couple of these. One I printed split, and one I printed whole, both methods of printing it came out more or less fine.

I painted the split one, and then varnished it, and slightly messed up the varnishing, because it’s still slightly tacky to the touch.

Tommy’s Knobs

A pal of mine DJs under the name Syntax Terror.

A while back, he contacted me about printing some replacement dials for his Traktor Kontrol X1 MK2, as these had apparently fallen off during transit.

He sent me a list of possible knob designs from Thingiverse.

Now, I’m broadly of the opinion that the point of having a 3d printer is that you can make custom parts. Thingiverse is great, but if you’re just going to print stuff from Thingiverse all the time, you’d be better off with an Alibaba account.

With this in mind, I thought I’d have a go at designing some custom knobs, instead.


This meant I was able to use the line “I’ve got some knobs here with your name on them”, while we were arranging postage.

While I’m relatively happy with how these came out, I regret not playing around with the bevel radius and number of cuts a little more than I did.

Hook Endcap for T-Slot


I’ve got a bunch of 2020 t-slot bolted to the back of my monitors, which I use to mount stuff to.

I wanted a way to terminate these, while also giving me a place to hang stuff off it, so I designed this hook.

I printed it in two halves, to avoid printing overhangs. The nice thing about printing split parts to fit on t-slot, was that I found fitting each half to the t-slot before gluing them worked really well to align them.

This was the first functional print I designed using the Waterfall-CAD framework, I uploaded it to Thingiverse here.

A Lid for a Coffee Grinder


I own a Sage coffee grinder.

A while back, I purchased a separate “bean caddy” for it, so I could conveniently swap between regular, and novelty high-caffeine beans.

It turns out, that when you buy a new sage caddy, it doesn’t come with a lid, those are sold separately.

I figure; that’s a pain, but no biggie, I can print that.

The lid uses plumber’s tape to form a seal with the caddy.

I think if I was being super serious about iterating on the design, I’d probably add a recess for an o-ring, but the plumbers tape works.

Plant Tags


I’m growing tomatoes this year; three varieties: Costoluto – Moneymaker – Tiny Tim’s.

I printed a bunch of tags to help tell these apart.

While this isn’t the most exciting code, I think it makes fairly good use of both the text and the bounding box functionality in Waterfall-CAD.

The code doesn’t directly specify the width of the tag, it just generates the text at a specific font size, and creates a tag that’s slightly larger than that.

  1. This is currently fairly quiet and empty↩︎