Update 5/21/2024:
Print-in-place model to hold button-style or cylindrical batteries. Some example models are included, and the OpenSCAD source code is provided, for full customization.
Instructions below are for button-style batteries. The version for cylindrical batteries works the same but doesn't have many of the customization options. (Caveat: For cylindrical batteries, I've only tested the CR123A batteries myself)
Uh… wait… OpenSCAD? What's that?! Do I need to learn how to write code?
No, you don't! It's actually very simple, and you don't need to “speak SCAD” to create your very own battery cases.
Just check out the PDF file with a step-by-step guide I uploaded here (Files page>Other files), to see how easy it is to design a customized box per your specs.
The key parameters to change are:
IMPORTANT: While the naming conventions of CR batteries usually represent their actual dimensions (see above), there are — of course ☹ — exceptions. For example, while CR2412 batteries have the expected diameter of 24mm, CR2450 and CR2477 have a diameter of 24.5mm. Go figure… Do a Google search or go to a site such as https://www.cheap-batteries.com/coin_batttery_chart.html to double-check the dimensions of your batteries!
0.2 or less layer height. No supports needed (unless you're printing the key tab version).
For a two color version, insert a manual filament swap at 1.2 mm (for the accent color) and a second one at 1.6 mm (back to the original color). Or use the 3mf file, right click on model and choose Replace with STL, then load your custom design.
The hinge for this box is print-in-place. I used a 0.2mm clearance which should be fine for most well-calibrated printers. The first time you move the hinge may require a bit of pressure. Repeatedly opening and closing the box will make the hinge movement smoother.
Same goes for the clasp, which may be a bit hard to open the first couple of times. Open and close it a few times, and it should be fine.
Like all print-in-place models, you may find that for your particular printer the clearance may be too high or too low (part of the hinge fused together). Alas, different printers have different tolerances, so there's no surefire way to ensure a model is working everywhere. If you have issues, you may want to try and scale the model slightly, say to 103% or so, to create more clearance. Or use sandpaper/dremel.
Magnet lock: The slots for magnets are sized for press fit. However, different brands of magnets may vary slightly in size. If needed, use superglue to hold them in place. Make sure the two magnets are inserted such that they attract each other!!! It's very easy to mix it up.
Update 10/11/2023: Added a version for cylindrical batteries such as AA, CR123, etc.
Update 1/19/2023:
Update 1/17/2023: @petrus2999 suggested adding an option to have dividers on top, in addition to the bottom. Here it is. Caveat: I have not test printed it myself.
Update 9/7/2022: I loved @PixxelSnake's idea of a “peep hole” in the bottom to see how many batteries are left. I added this to the script and made it the default. Will even work with multiple rows of batteries. However, it you'd like to disable it, look under Other Options in the Customizer panel. Also, I removed the version with the old clasp design.
Update 9/2/2022: Added 3mf file with manual filament swaps for two color version.
Update 1/2/2022: Several comments indicated that the clasp didn't work well for some. The new version has a different clasp design.
Update 4/12/2021: Thanks to @wolph for his suggestion to use a cube_fillet function, which I added to the OpenSCAD code, to generate rounded edges. Images are still from my original version.
…consider buying me a coffee.
The author marked this model as their own original creation.