← Back to overview
Loading 3D model…
Drag to rotate · Scroll to zoom · Right-click to pan
1 / 3
aaContain…
aaaContai…
batterybox

Description

# Battery Box > Two 3D-printable storage boxes for AA and AAA batteries, with an easily adjustable grid size. ## Description The Battery Box is a set of two compact storage boxes — one for AA batteries and one for AAA batteries. Each box consists of a grid of individual cylindrical slots, arranged in rows and columns. Every slot has a small central drain hole at the bottom. The number of rows and columns per box can be changed by editing a single number in the source file, after which the box automatically resizes to fit. The default layout holds **40 AA batteries** (5 × 8) and **32 AAA batteries** (4 × 8). ## Files | File | Description | |------|-------------| | `batterybox.py` | PythonSCAD source file | | `aaContainerBox.3mf` | Ready-to-print 3MF — AA battery box | | `aaaContainerBox.3mf` | Ready-to-print 3MF — AAA battery box | | `batterybox.3mf` | Ready-to-print 3MF — both boxes on one build plate | | `README.md` | This file | ## Requirements ### Runtime - [PythonSCAD](https://pythonscad.org/) (OpenSCAD with Python scripting support) - Python 3.x ### Python Dependencies None — only standard library modules are used (via `mhlib`). ### Custom Libraries (by author) | Library | Purpose | |---------|---------| | `mhlib` | Core PythonSCAD helper library — provides geometry primitives (`cylinder`, `union`, `difference`), transformation helpers (`mv`, `mvx`, `mvy`, `mvz`), plate spreading (`spread_on_plate`), dynamic parameter loading (`loadParams`, `getParam`), and file export (`export`, `show`). Published separately by the author. | ## Configuration The following constants at the top of `batterybox.py` can be adjusted before rendering: | Parameter | Default | Description | |-----------|---------|-------------| | `aaD` | `14.5` | AA battery diameter (mm) | | `aaH` | `25` | AA slot depth (mm) — set to roughly half the battery length | | `aaaD` | `11` | AAA battery diameter (mm) | | `aaaH` | `20` | AAA slot depth (mm) | | `wall` | `2.2` | Wall thickness between slots (mm) | | `plateSpacing` | `100` | Spacing between the two boxes on the build plate (mm) | | `run` | `"all"` | Which part to preview: `"all"`, `"aaContainerBox"`, or `"aaaContainerBox"` | **To change the number of batteries**, edit the loop ranges directly in `print_aaContainerBox()` and `print_aaaContainerBox()`: ```python # AA box: currently 5 columns × 8 rows = 40 batteries for i in range(5): # ← columns (X direction) for j in range(8): # ← rows (Y direction) # AAA box: currently 4 columns × 8 rows = 32 batteries for i in range(4): for j in range(8): ``` ## Functions ### `print_aaContainerBox()` Generates the AA battery storage box as a 5 × 8 grid of `bin` slots, each spaced `aaD + wall/2` mm apart. **Returns:** Union of 40 cylindrical battery slots. --- ### `print_aaaContainerBox()` Generates the AAA battery storage box as a 4 × 8 grid of `bin` slots, offset −80 mm on X so it sits beside the AA box on the build plate. **Returns:** Union of 32 cylindrical battery slots. --- ### `bin(h=aaH, d=aaD)` Creates a single battery slot: a hollow cylinder open at the top, with a small 4 mm central hole at the bottom (for drainage or a finger-push assist). **Parameters** | Name | Type | Default | Description | |------|------|---------|-------------| | `h` | float | `aaH` | Slot depth (mm) | | `d` | float | `aaD` | Inner battery diameter (mm) — outer wall adds `wall` mm | **Returns:** Hollow cylinder with a 4 mm bottom hole. --- ### `aaContainer()` Single AA bin offset −40 mm in Y. Helper for standalone preview/testing. **Returns:** One AA slot geometry. --- ### `aaaContainer()` Single AAA bin offset −20 mm in Y. Helper for standalone preview/testing. **Returns:** One AAA slot geometry. --- ## Usage 1. Open `batterybox.py` in PythonSCAD. 2. Adjust the loop ranges in `print_aaContainerBox()` and `print_aaaContainerBox()` to set the desired number of slots (see [Configuration](#configuration)). 3. Optionally tune `aaD`, `aaaD`, `aaH`, `aaaH`, or `wall` for a tighter or looser fit. 4. Preview the model (F5) or render it (F6). 5. Export as `.3mf` — individual files per box are created automatically when not in preview mode. > **Print tip:** Print without supports, flat side down. A 0.2 mm layer height and 2–3 perimeters give sturdy slot walls. ## Battery dimensions used | Type | Inner slot diameter | Slot depth | |------|--------------------:|----------:| | AA | 14.5 mm | 25 mm | | AAA | 11.0 mm | 20 mm | ## License License: t.b.d. *(To be determined by the author — Matthieu Hendriks)*

💬 Discussion 0 comments

Log in to join the discussion
No comments yet. Be the first to ask a question!
AA and AAA simple batterybox
Matthieu
⬇ 1 downloads 📅 2026-06-24
🔒 Log in to download
5 source files included

🔔 Stay informed

Unsubscribe anytime via the link in each email.

Loading…