Konubinix' site

Printing a C Battery Holder in Openscad

tag: learning 3D printing

After a previous attempt at using an existing STL to have a c battery dispenser that fit into my labists x1 mini, I discovered a customizable and extendable battery dispenser that might be easier to customize.

Unfortunately, the default file does not fit the size of the printer.

But it was a good occasion to learn OpenSCAD.

The code is quite simple and the parts of interest are:

[...]
// sizes for preset standard batteries. Chose custom if you want to create a new one.
battery = "AAA"; // [AA,AAA,AAAA,C,D,9v,18650]
[...]
// constants
wallThickness=2;
wallHeight=108;
wallWidth=63;
shelfWidth=20;
slotWidth=16;
shelfStopHeight=14;
kickbackWidth = 6;
kickbackHeight = 10;

We can see that I can change the battery to “C” and the wallHeight (default to 108) to a value lower than 100.

I then have a model ready to be printed.