First checkin
This commit is contained in:
@@ -1,3 +1,28 @@
|
||||
# batteries
|
||||
|
||||
Customizable battery storage
|
||||
Customizable battery holders for different sizes connectable to each other.
|
||||
|
||||
Instead of holes or cubes for each battery, there is a width of the
|
||||
battery holder and a long cutout centered on the width. The cutout size
|
||||
is choosen by the maximum number of batteries of the selected type which
|
||||
fit into the cutout (battery diameter + a small offset)
|
||||
Each holder holds one type of battery in at least one line.
|
||||
The battery holders may have two holes on one side and two connectors
|
||||
on the other side to connect the different holders. The position of the
|
||||
box is important for the connectors to be appied.
|
||||
|
||||
standalone
|
||||
: no connectors are applied
|
||||
|
||||
top
|
||||
: only the connectors are appied at the bottom of the box
|
||||
|
||||
center
|
||||
: holes are appied at the top and connectors are applied at the bottom of the box
|
||||
|
||||
bottom
|
||||
: wholes are applied at the top of the box
|
||||
|
||||
A single row looks like this:
|
||||
|
||||

|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
// ------------------------------------------------------------------------
|
||||
// Customizable battery holder.
|
||||
// Instead of holes or cubes for each battery, there is a width of the
|
||||
// battery holder and a long cutout centered on the width. The cutout size
|
||||
// is choosen by the maximum number of batteries of the selected type which
|
||||
// fit into the cutout (battery diameter + a small offset)
|
||||
// Each holder holds one type of battery in at least one line.
|
||||
// The battery holders may have two holes on one side and two connectors
|
||||
// on the other side to connect the different holders. The position of the
|
||||
// box is important for the connectors to be appied.
|
||||
// standalone : no connectors are applied
|
||||
// top : only the connectors are appied at the bottom of the box
|
||||
// center : holes are appied at the top and connectors are applied
|
||||
// at the bottom of the box
|
||||
// bottom : wholes are applied at the top of the box
|
||||
// ______________________________
|
||||
// | 0 0 |
|
||||
// | -------------------------- |
|
||||
// | | | |
|
||||
// | -------------------------- |
|
||||
// |______________________________|
|
||||
// 0 0
|
||||
//
|
||||
// If all the boxes have the same width, they can be connected, no matter
|
||||
// how big the batteries are.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- configurator --------------------------------
|
||||
/* [Battery type] */
|
||||
// The type of the batteries
|
||||
Battery_type = "None"; // [None, Mono, Block, CR123A, AA, AAA]
|
||||
/* [Box options] */
|
||||
// The width of the box
|
||||
Width = 110;
|
||||
// The number of rows of the box
|
||||
Rows = 2; // [1:10]
|
||||
// The height of the box
|
||||
Height = 30;
|
||||
// Position of the box
|
||||
Position = "standalone"; // [standalone, top, center, bottom]
|
||||
|
||||
/* [Hidden] */
|
||||
$fn=52;
|
||||
|
||||
// **********************
|
||||
// ** Static Settings: **
|
||||
// **********************
|
||||
|
||||
// You may redefine the local settings depending on your 3D printer
|
||||
|
||||
// Attributes of the batteries:
|
||||
// A description, the width or diameter, the length or diameter and the height
|
||||
// The atttributes are selected by the Battery_type of the configurator.
|
||||
// Remark: The battery height is currently not used.
|
||||
battery = object([
|
||||
["None", ["no output", 0.0, 0.0, 0.0]],
|
||||
["Mono", ["Mono cell", 25.3, 25.3, 49.6]],
|
||||
["Block", ["9V Block", 16.7, 25.7, 47.2]],
|
||||
["CR123A", ["CR123A cell", 16.6, 16.6, 34.2]],
|
||||
["AA", ["AA cell", 14.5, 14.5, 50.7]],
|
||||
["AAA", ["AAA cell", 10.4, 10.4, 44.5]]
|
||||
]);
|
||||
|
||||
// Some other often used settings
|
||||
BASE_THICKNESS = 2.0;
|
||||
WALL_THICKNESS = 3;
|
||||
INNER_WALL = 1;
|
||||
PIN_SIZE = 1.5;
|
||||
HOLE_SIZE = PIN_SIZE + 0.3;
|
||||
PIN_HEIGHT = Height * 0.9;
|
||||
|
||||
// *********************
|
||||
// ** Helper Modules: **
|
||||
// *********************
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Connector to connect the battery holders wit each other.
|
||||
// ------------------------------------------------------------------------
|
||||
module connector (height, pinwidth, center = false, rotate = true) {
|
||||
d = pinwidth * 1.5;
|
||||
len = pinwidth + d / 2;
|
||||
offset = (d - len) / 2;
|
||||
|
||||
target = center ?
|
||||
[-offset, 0, 0] : // centered around the cylinder with pin!
|
||||
[d / 2, -d / 2, height / 2]; // cylinder tangents on the x and y axis
|
||||
|
||||
translate(target) {
|
||||
rotate([0, 0, rotate ? 90 : 0]) {
|
||||
translate ([pinwidth / 2, 0, 0])
|
||||
cube ([pinwidth, pinwidth, height], center=true);
|
||||
cylinder(h = height, d = d, center=true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// calculate the length of the box for the number of rows
|
||||
// ------------------------------------------------------------------------
|
||||
function boxlen(battery_len, rows) = battery_len * rows + INNER_WALL * (rows - 1) + 2 * WALL_THICKNESS;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// draw a battery box without the pins
|
||||
// ------------------------------------------------------------------------
|
||||
module batterybox(width, rows, height, type) {
|
||||
len = boxlen(type[2], rows);
|
||||
inner_cnt = floor(width / (type[1] + 0.2));
|
||||
inner_width = inner_cnt * (type[1] + 0.2);
|
||||
inner_x = (width - inner_width) / 2;
|
||||
|
||||
difference() {
|
||||
cube([width, len, height]);
|
||||
translate([inner_x, WALL_THICKNESS, BASE_THICKNESS])
|
||||
cube([inner_width, type[2] * rows + INNER_WALL * (rows - 1), height]);
|
||||
}
|
||||
for (y = [WALL_THICKNESS + type[2] : INNER_WALL + type[2] : len - 2 * WALL_THICKNESS]) {
|
||||
translate([0, y, 0])
|
||||
cube([width, INNER_WALL, height]);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// position the pins at the bottom or top of the box
|
||||
// ------------------------------------------------------------------------
|
||||
module locate_pins(type, rows, height, width, size, pos, pin_dist = 5) {
|
||||
translate ([0, (pos == "bottom" ? boxlen(type[2], rows) : 0), 0]) {
|
||||
translate ([pin_dist, 0, 0])
|
||||
connector(height = height, pinwidth = size);
|
||||
translate ([width - pin_dist * 1.5 , 0, 0])
|
||||
connector(height = height, pinwidth = size);
|
||||
}
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
// bring the modules together and set the configurator values ...
|
||||
// ------------------------------------------------------------------------
|
||||
module main() {
|
||||
if (Battery_type != "None") {
|
||||
battery_type = battery[Battery_type];
|
||||
difference() {
|
||||
batterybox(width = Width,
|
||||
rows = Rows,
|
||||
height = Height,
|
||||
type = battery_type);
|
||||
if (Position == "bottom" || Position == "center")
|
||||
locate_pins(type = battery_type,
|
||||
rows = Rows,
|
||||
width = Width,
|
||||
height = PIN_HEIGHT,
|
||||
size = HOLE_SIZE,
|
||||
pos = "bottom");
|
||||
}
|
||||
if (Position == "top" || Position == "center")
|
||||
locate_pins(type = battery_type,
|
||||
rows = Rows,
|
||||
width = Width,
|
||||
height = PIN_HEIGHT,
|
||||
size = PIN_SIZE,
|
||||
pos = "top");
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Do it!
|
||||
// ------------------------------------------------------------------------
|
||||
main();
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
Reference in New Issue
Block a user