"""3.7 V lithium battery pack with protection circuit, as Adafruit sells them: a lithium polymer pouch pack or a pack of one, two or three 18650 lithium ion cells side by side, at the outside size Adafruit publishes for it. The pack lies flat: its underside on the XY plane, its length along Y, its width along X, centred on the origin in X and Y. One solid; the wires and plug are not modelled. Dimensions and their sources in the README.""" from steve import Model pack = "lipo-500mah" # Pack: chemistry and capacity # pack: shape (pouch: a flat block; round: 18650 cells side by side in one sleeve), width, length and thickness in mm, from # the "Technical Details" of Adafruit's product page for that product number (pages read 2026-11-14). PACKS = { "lipo-100mah": {"shape": "pouch", "w": 11.5, "l": 31, "t": 3.8}, # product 1570: "Size: 11.5mm x 31 x 3.8mm" "lipo-150mah": {"shape": "pouch", "w": 19.75, "l": 26.02, "t": 3.8}, # product 1317: "Size: 19.75mm x 26.02mm x 3.8mm" "lipo-400mah": {"shape": "pouch", "w": 17, "l": 36, "t": 7.8}, # product 3898: "Size: ~36mm x 17mm x 7.8mm" "lipo-500mah": {"shape": "pouch", "w": 29, "l": 36, "t": 4.75}, # product 1578: "Size: 29mm x 36mm x 4.75mm" "lipo-2000mah": {"shape": "pouch", "w": 36, "l": 60, "t": 7}, # product 2011: "Dimensions: 60mm x 36mm x 7mm" "lipo-2500mah": {"shape": "pouch", "w": 50, "l": 60, "t": 7.3}, # product 328: "Size: ... (50mm x 60mm x 7.3mm)" "18650-2200mah": {"shape": "round", "w": 18, "l": 69, "t": 18}, # product 1781: "Dimensions: 69mm x Diameter18mm" "18650-4400mah": {"shape": "round", "w": 37, "l": 69, "t": 18}, # product 354: "Dimensions: 69mm x 37mm x 18mm" "18650-6600mah": {"shape": "round", "w": 54, "l": 69, "t": 18}, # product 353: "Dimensions: 69mm x 54mm x 18mm" } if pack not in PACKS: raise ValueError(f"no pack {pack!r}: {', '.join(PACKS)}") P = PACKS[pack] w, l, t = P["w"], P["l"], P["t"] model = Model() if P["shape"] == "pouch": model.box("pack", w, l, t, at=(0, 0, t / 2), name="Pack") else: # The sleeve around the cells: round sides of the pack's thickness, flat across the cells in between. half = (w - t) / 2 model.cylinder("side_1", t / 2, l, direction=(0, 1, 0), at=(-half, -l / 2, t / 2), name="Pack") if half > 0: model.cylinder("side_2", t / 2, l, direction=(0, 1, 0), at=(half, -l / 2, t / 2), name="Pack side") model.box("middle", w - t, l, t, at=(0, 0, t / 2), name="Pack middle") result = model.result()