Dreidel in OpenScad

I just about had a heart attack when I heard we would be coding. I come from a family of computer engineers and seem to be the only one who didn’t inherit the coding gene, so I was sure that this was going to go poorly. However, after watching a few YouTube tutorials about getting the program to work for you rather than trying to painstakingly work through lines and line of code, I came out with a pretty cool product.


polygon( points=[[0,0],[2,1],[2,4],[0,4.5]] );
translate ([0,0,1])cylinder (h=5,r=.4);

My first print was going to be a top, but I realized that using the $fn command I could make far fewer faces, narrowing it down to 4 to create a dreidel. I used the rotate extrude command to turn a two dimensional polygon into a 3 dimensional dreidel body, using a standard cylinder as the handle.


intersection () {
translate ([0,0,16])
sphere (r=16);
translate ([-11,-11,0])
cube ([22,22,25]);}
translate ([-11,-11,17])
cube ([22,22,12]);
translate ([0,0,25])
cylinder (h=17,r=2);

This design is still a dreidel, but made in a completely different way. I liked my first design, but traditional dreidels have a rounded bottom. This version was created by layering a cube into a sphere and using the intersection command to only show the intersection of the two. This cut off a bit of the top of the dreidel, so I created another cube using the same x and y dimensions as the original cube, layering it on top of the new hybrid design. I proceeded to but another cylinder in as the handle.

I had the worst time trying to render the new design, as it kept on saying that there was an error.

The problem ended up being as simple as needing to insert a closed bracket.

The final print turned out very nicely.