From Atoms to Bits to Atoms: A Cat Toy’s Journey

I thought I would fol­low up the pre­vi­ous cat toy post with another one. I’m not obsessed with cat toys! Really! They just make good geo­met­ric mod­els. The main con­tent of this post will soon go into an Instructables page as an entry to win a 3D printer in the Make It Real Challenge, but I wanted to start with a copy here on my own blog.

There are some cat toys at the house that are par­tic­u­larly pop­u­lar with the local res­i­dents. They are sim­ple hol­low spheres with cut-out slots. They are great for kit­ties to kick around — small and light. After star­ing at one for a few min­utes, piec­ing out the geom­e­try, I real­ized that this would make a great instruc­tional design for an intro­duc­tion to 3DCAD mod­el­ing using sim­ple geo­met­ric shapes and boolean trans­forms.

Before we begin, you will need two things:

A copy of OpenSCAD. This is “free” in every sense of the word — it costs noth­ing AND is an Open Source project that peo­ple from around the globe con­tribute to and use. You can get it for Mac, Windows, or Linux.

A web browser tab open to the OpenSCAD User Manual. OpenSCAD works like a pro­gram­ming lan­guage and although I’ll step you through the process, it is always good to have a lan­guage ref­er­ence handy.

If you look at the orig­i­nal cat toy, it is a ball. That is to say, it is a hol­low sphere (or spher­i­cal shell if you want to get fancy). That ball then has slots cut away at reg­u­lar inter­vals. I did a lit­tle bit of mea­sur­ing before­hand.

Let’s start by mak­ing the sphere. This is a sim­ple one line “pro­gram.” There is an extra line up top that you can mod­ify to pro­duce dif­fer­ent detail lev­els. I find that a value of 30 is good to do most work in, though I bump that up to about 100 when I am ready to pro­duce a final ren­der. This sphere has a radius of 20mm. Remember that the radius (20mm) is half of the diam­e­ter (40mm).

DETAIL = 30;
sphere(r = 20, $fn = DETAIL);

Type this code into the text area on the left of the OpenSCAD win­dow. Go to the “Design” pull­down menu and select “Compile.” In a few moments, you should see a sphere in the right half of the OpenSCAD win­dow. You can click and drag with your mouse to rotate the 3D shape and use the mouse wheel to zoom in and out.

If we were to print this sphere on a 3D printer, it would be solid. We don’t want a solid ball, but a hol­low shell. Let’s sub­tract enough away to give us a 2mm shell. We do this with the dif­fer­ence() func­tion. This func­tion takes a list of two or more objects, draws the first one, and then sub­tracts each of the other ones. In this case, we will make a slightly smaller sphere inside and sub­tract it.

This pro­gram starts with the big sphere, sub­tracts out the smaller one, then sub­tracts out a cube. You may have to use your mouse to rotate around, but it should look some­thing like this:

Now remove that cube line. We will do some­thing very much like that to cut out the slots, except instead of cubes, we will use cuboids, which are the rec­tan­gles of cubes. Let’s just start with one to see how to line things up. We’ll do this:

You’ll end up with a sphere with a slit sim­i­lar to a Cylon eye strip. What’s going on here? Shouldn’t that have cut out a rec­tan­gle? It did, but the rec­tan­gle was placed directly on the ori­gin. If you select “View -> Thrown Together” from the pull­down menus, then “Design -> Compile” you’ll see the com­bi­na­tion of shapes. This is an extremely use­ful view of your vir­tual world when you are try­ing to sub­tract shapes and don’t under­stand what is going on.

We want it to com­pletely inter­sect from one edge of the sphere to the other. To do that, we’ll need to slide it over a bit. We can do that with the trans­late() func­tion, which takes the object fol­low­ing it and shifts it around on the x, y, and z axis. Let’s try it.

That’s great! Now we just need to add a few more! I’m going to adjust the height from 5mm to 4.45mm to get them to divide a lit­tle more evenly across the sphere. Let’s add some more trans­lated cubes. It takes a lit­tle bit of math to get the posi­tion­ing right, but you can add one at a time, exper­i­ment with posi­tion­ing, and play with the results as you go.

Finally, you can crank up that DETAIL value when every­thing looks good. This will give you a higher qual­ity 3D model with more sur­faces, but it takes a lit­tle longer to gen­er­ate. Go to “Design -> Compile and Render” on the pull­down menu for your final ren­der. Assuming that looks good, go to “Design -> Export as STL” to save it as a 3D file. Most 3D print­ers and 3D print­ing ser­vices use this file for­mat.

Congratulations! You cre­ated a cat toy using geom­e­try! Time to print!

On a home 3D printer, even if you build using sup­port struc­tures, the upper slats will have grav­ity work­ing against them. They’ll end up sag­ging a bit and kind of stringy on the bot­tom. You will get a ball that is struc­turally sound, but looks a lit­tle warped. If you have a small metal file or X-Acto knife, you can man­u­ally clean it up a lit­tle. Industrial print­ers typ­i­cally do not suf­fer from this sort of prob­lem because they use a dif­fer­ent process for print­ing and sup­port.

I have a zip file (cat_ball.zip) con­tain­ing source for each of these steps. It also con­tains a mondo-mega final OpenSCAD file called a para­met­ric model. This is a model where all of the impor­tant num­bers are dis­tilled and extracted to the top (much like DETAIL is in the above exam­ples). This then lets you eas­ily change the size of the ball, the wall thick­ness, the num­ber of slots, and the width of the sup­port struc­ture (i.e. the depth of the cuts). You can then make all sorts of crazy vari­ants just by chang­ing a few num­bers. You want one that is 50mm in diam­e­ter with a 5mm thick shell and 19 cutouts? There you go! But good luck print­ing this vari­ant on a home 3D printer.

Published by

Brian Enigma

Brian Enigma is a Portlander, manipulator of atoms & bits, minor-league blogger, and all-around great guy. He typically writes about the interesting “maker” projects he's working on, but sometimes veers off into puzzles, software, games, local news, and current events.
View all posts by Brian Enigma