Tidying Up R2S4 CadQuery Code

Once I was satisfied my spent spool storage system design covered the basics and offered some neat features, it was time to tidy up my CadQuery code. I had been experimenting in a free-wheeling fashion and now I need to apply the Python code organization best practices I’ve learned to date. This is also the point where I graduated this project from my “CadQuery Tests” repository into its own project repository.

I’m not great with names so I struggled with what to name the repository. I had been calling it the spent spool storage system but its acronym SSSS is unwieldy. I thought about calling it S4 but that’s far too close to Amazon S3 for my taste. I decided to pre-pend my GitHub handle “Roger Random” in front, so now it is “Roger Random’s Spent Spool Storage System” or R2S4.

R2S4 sounds like a Star Wars astromech droid, and I’m perfectly OK with that. A quick search online found no canonical R2-S4 sibling for the famous R2-D2, so I could be the first. I can stack several of these spent spools together, add a domed head and two stubby legs, and call the result R2-S4. That might be a fun future project.

In the meantime, I ran into a few snags trying to organize my CadQuery code. Syntactically it is Python but conceptually it’s very different from any previous Python project I’ve undertaken. At least it felt that way to my head, so I had a hard time organizing the code in a way that makes me happy. I suspect I’ll have more of an opinion on how to organize CadQuery code as I gain experience with writing more.

The final problem I struggled with was the fact I’m asking any prospective users to install CadQuery on their computer so they could configure their own storage system and generate STL files for printing. That seems like a big ask, especially given the Python library situation that now requires virtual environments to keep our different Python projects from stepping on each other’s toes. Not ideal!

Sometime after I moved on from this project (but before I got around to writing it down here) I learned of a pretty good answer: we can run small CadQuery projects inside web-hosted Jupyter notebooks available online. Specifically, I was able to run my storage system code inside Google Colab. I thought this was good enough for me to recommend to others, and just one of many lessons I learned while designing a follow-up project: my storage grid.


Source code for this project is publicly available at https://github.com/Roger-random/r2s4

Build-As-You-Go Storage System with Tray Labels

I’ve designed a 3D-printable storage system using spent 3D printing filament spools as its central structure. I’ve made the design configurable to fit different size spools and generate different size trays. The parameters to fit a specific spool size are fairly straightforward if we already have one such empty spool in hand: get out some measuring tools and maybe do some math. But the parameters for the storage tray size will depend on what it is storing, and that might not be known yet. So I’ve added a provision to build-as-you-go.

The problem I encounter with many configurable systems is that it assumes I have the full picture when I start. But sometimes I don’t! And I either make some educated guesses that later turn out to be wrong, or I fall into analysis paralysis and don’t do anything at all. This is why I avoid making such an assumption here, and added the provision of printing placeholder segments.

A placeholder segment is a tray base with only the inner locking tab-and-slot ring so it prints with very little filament. So a particular storage bin can start with a single tray to hold what we want to store. The remaining spaces remain empty, with only placeholder segments to keep the whole thing together. It is valid to start with a single 15-degree tray and fill the rest with placeholders until we know what we want to keep there, as shown here:

The tray base visibly extends beyond the rim of the spool because I needed some room to allow the retention loop to flex. Being able to push the lip of the ring downwards makes tray removal easier. While designing the tray to match, I added a 45-degree sloped area at the tray’s top lip which will serve nicely as an area to put a label explaining what’s in that tray. This label area is most visible in a side view like this picture:

Also visible in this picture is that my tray does not occupy the full available vertical volume, there’s a few millimeters left above the tray. Top gap visible in this picture is the same height as the retention ring, so we could lift the tray up and over the ring to remove the tray without bending the ring. If the gap is any smaller, we’d have to push the retention ring down further to create the clearance, or we have to deform the tray to pull it out. (Easier with flexible single-wall vase mode printed trays than thicker stronger trays.)

I debated how big this gap should be. Leaving it large makes the tray easy to remove but risk the tray falling out if the whole spool is jostled. Decreasing the size of the gap reduces the risk of spills, but makes tray removal more of a hassle. I ultimately decided there is no right answer. An user has to make the tradeoff that is right for their scenario, and they can get their ideal tray fit by adjusting the height parameter.


Source code for this project is publicly available at https://github.com/Roger-random/r2s4

Storage Trays Configurable To Fit Different Object And Spool Sizes

I thought it would be fun to turn spent 3D printing filament spools into the core of a storage system, and my CadQuery script for generating individual elements can generat a base module matching a removable storage tray using the same parameters. There are two categories of dynamic configuration involved: that to match the spent spool, and that to match user need.

To match a particular spool, the variables I expect to see are the inner radius of the spent spool, the outer radius, and the thickness of a spool. (Which dictates the height of a storage tray.) These are the variables I saw when trying it on two different types of one kilogram spools. (MatterHackers Build, and Filament PM.) I suspect there are additional variables that I have not yet encountered, and they will require future revision. I’m also curious to see if this design will scale well both above and below the popular single kilogram size. Some of the more expensive materials are sold in spools less than one kilogram, and filament can be bought in bulk on large spools 2kg, 3kg, and maybe more. I await a chance to try those in the future, or get feedback from someone else who has tried.

To match a user need, the size of the tray can be varied in terms of angles of degrees of the pie wedge. The low end is constrained by the size of the handle, which is fixed size regardless of the size of the tray because it is meant to fit human fingers and finger size doesn’t change as the tray size changes. For one kilogram spools of 20cm outside diameter, the practical lower limit is a 15 degree wedge. On the high end, I suppose the geometric limitation is 180 degrees because anything larger would start to wrap around the center of the spool making the tray difficult to remove. As a practical matter, though, 120 degrees appear to be the limit and even then we’d probably want a tray with thicker sizes instead of single-wall vase mode. My test prints of 120 degree wedges in vase mode were unacceptably flimsy, though this may be a matter of filament selection.

While testing various sized wedges, I was amused by a happy coincidence. For testing purposes I printed trays of various angles in degrees: 15, 30, 45, 60, 90, and 120. When I put them all together, I discovered that list add up to a full circle 360 degrees filling up a spool. Convenient! Another happy coincidence with my design is the need for a little bit of clearance below the retention ring also gave me a nice label area for my tray.


Source code for this project is publicly available at https://github.com/Roger-random/r2s4

Tray Mounting Base To Fit Within Spent Spools

I thought it would be cool to reuse spent 3D printing filament spools as the core of a storage system. The storage trays can be configured to be within a range of sizes. Each could be printed either with filament-efficient single-wall vase mode for light duty use, or with thicker walls for heavier duty use. I explored a few ideas on how I might design a self-contained system using interlocking trays, but I quickly gave up on that idea. Fundamentally, these trays form a circle around a spool. And when one tray is removed in use, something has to keep the rest of the trays in place. In my design, that something is the tray base which will stay behind when the tray is removed.

To keep the storage system modular, every tray will have its own corresponding base. All the bases will clip together into a complete ring that encloses the inner diameter of the spool.

How will that base keep the tray in place? My first attempt used small clips that reach from the inner ring out to the outer radius to keep its tray in place. This worked for a small tray, but it failed for larger trays. Each little clips has a fixed amount of holding power and it wasn’t enough for the larger trays. And even when it worked, it was not very satisfactory. Ideal CAD doesn’t translate to real world 3D print all the time, and such small errors meant the clips were unreliable and difficult to use.

Those clips then evolved into a small loop to keep the tray in place. The loop helps keep the base in the intended shape, and the loop also has holding power directly proportional to the size of a tray because a loop gets bigger as its corresponding tray does. I’m still trying to be frugal with filament, so I started with thin loops (pictured) that didn’t work before increasing their thickness until I had a reliable and satisfying tray retention mechanism.

The inner ring also underwent several revisions. It may look like a simple tab and slot mechanism, but it took more fine-tuning than I had expected before I had a satisfactory system. The main theme was the fact I wanted to minimize filament usage, so the inner ring was as small as I could make it. Which meant it didn’t leave much room for the tab and the slot. Tabs that are too small tend to break off rather than hold as intended. This design is the smallest tab size that worked reliably, and the smallest ring that I can fit around the tab and slot of that size. Since these factors are a function of strength of 3D-printed plastic, I think it’s better to keep them the same size instead of dynamically changing in response to configuration parameters.


Source code for this project is publicly available at https://github.com/Roger-random/r2s4

Storage Trays To Fit Within Spent Spools

Prompted by a fellow 3D printing user’s comment “I wish there’s something we could do with these spent spools” I decided to investigate a project idea that’s been sitting in the back of my head: a dynamically reconfigurable storage system which uses a spent 3D printer filament spool as its structural core. After setting a few goals to give me a direction, I designed the trays that I wanted to fit within these spent spools.

As a starting point I quickly whipped up a pie-shaped wedge solid shape in CadQuery, then I fed it into my 3D printing slicer to be printed in vase mode. Also called spiral mode, or sometimes single-wall mode. Whatever the name given by a particular slicer program, the result is a shape with a single-width wall the thickness of our nozzle diameter. It is very frugal with filament use (one of my goals of this project) but the thin wall raise other challenges. The first is structural. It may be hard to see in the above picture, but the flat sides of the first test tray is bowed instead of flat. The inner and outer curved sides fared better because the tiny bit of curvature gave them enough strength to maintain shape better than the flat sides. To solve this problem, I needed to add small ribs along the flat sides to give it a similar level of structure, and beveled edges top and bottom for additional strength.

Once I had flat sides that could stand on their own, I investigated the second vase mode challenge: strength. There just isn’t very much plastic to hold together, and it is possible to rip a vase mode print apart with our hands. I estimate the strength to be roughly the amount of force we’d need to rip a hole in a sturdy plastic bag. So they’re not tremendously strong, but I think they’re strong enough for light duty use.

But I didn’t want to restrict my system to light duty use. We all have our mental organization models, and it would be inconvenient to have a system that breaks down when something is a little to heavy to be stored alongside similar items. To address this possibility, I modified my CadQuery script so it could generate trays with thicker walls for more strength. The exterior dimensions remain the same. The idea is that we try the frugal vase mode tray first (lower tray in picture) and, if that should fail, we can print a replacement tray with thicker walls (upper tray in picture) which can sit in the same slot.

Another subject of evolution is the front handle. The test tray has no front handle, which obviously won’t work. (Side note: in above picture, the supposed-to-be-flat sides are more visibly bowed.) I tried a few handle design ideas, keeping in mind the shape had to be amenable to vase mode printing. After a few iterations I settled on a small handle in the middle of a spherical depression, almost like a small stack of coins, that my fingers could easily pinch to hold and manipulate the tray.

While I evolved the tray design, I was also evolving the mechanism to hold these trays in place.


Source code for this project is publicly available at https://github.com/Roger-random/r2s4

New Project: Spent Spool Storage System

While I was spending much of my free time playing MechWarrior 5: Mercenaries, I still worked on my usual project ideas. I just wasn’t writing them down on this blog! I am already starting to forget important details so I’ll try to catch up the best I can. First up for documentation: the spent spool storage system project.

Everyone using 3D printing to turn ideas into reality will quickly collect a number of spent filament spools. They are intended to be thrown away into landfill, and many do, but every time I hold an empty spool in my hand I wish I had some way to repurpose it. I’ve seen published projects turning a spent spool into a storage tray. (Here is one of many examples.) This is a neat idea, but I feel there’s room for me to offer some meaningful improvements.

The biggest problem with existing solutions is that they are fixed in size. Spool dimensions are not all identical. From my experience spools for one kilogram of filament have some typical dimensions. They usually have an outside diameter of 20cm and a center hole of 5.5cm, with small variations on each value. However, the actual inner diameter of the filament spool area varies a lot more. For the sake of reducing curvature of filament (to make it easier to feed into a printer) the inner spool is usually several centimeters larger than center hole diameter. To accommodate the same amount of filament wound around a larger inner diameter, the thickness of the spool may increase. Different manufacturers make different diameter/thickness tradeoffs.

As a result, STL files published online would fit one specific size of filament spool but would not fit one with different inner diameter or thickness. What we need is a design that can be configured to fit different spool dimensions. There are several configurable OpenSCAD scripts out there, but I’m going to take this as an opportunity to practice CadQuery which will also allow such configurability.

Another disadvantage of published STL is that the storage bin size is fixed. Some of the published designs include small partitions to subdivide a bin, but I’ve used small partitions in commercial storage bins and they tend to slide out of place making a mess. What I really want is to have custom configurable storage bin sizes, and again CadQuery can make the idea practical.

Unrelated to fixed nature of STL, I wanted to reduce filament usage. The storage systems I’ve seen online are built to be sturdy, but I felt they tend to go overboard and use wasteful amounts of filament to accomplish their goal. I’m not trying to store gold bars here! I’m willing to go with lighter construction in order to reduce filament usage.

With these goals in mind, I started by experimenting with storage tray designs.


Source code for this project is publicly available at https://github.com/Roger-random/r2s4