Case with the channels for cables and to slide on a lid

This commit is contained in:
2025-08-31 23:50:37 -04:00
committed by savanni
parent 187ac65a32
commit 72702f2710

View File

@@ -1,12 +1,12 @@
$fn = 50;
threshold = 0.1;
half_threshold = threshold / 2;
clearance = 0.1;
bevel = 0.5;
/*
half_clearance = clearance / 2;
wire_radius = 1;
wall_thickness = 2;
cutout_threshold = 1;
cutout_clearance = 1;
cell_interior_length = 74;
cell_interior_width = 20;
@@ -21,103 +21,104 @@ battery_contact_length = 12.8;
battery_contact_spring_height = 10.5;
battery_contact_flange_height = 1.9;
converter_width = 11.25;
converter_length = 22.25;
converter_height = 6;
*/
cell_diameter = 18.5;
cell_length = 68.5;
converter_height = 6;
converter_length = 22.25;
converter_width = 11.25;
spring_height = 7;
wire_radius = 1;
wall_thickness = 4;
interior_wall_thickness = 2;
include <../common/lib.scad>;
// A container for the voltage converter. This should be added to the end of the case boxes.
// It is a little weird that I have to set the outside dimensions based on the rest of the case instead of on just the converter.
module converter_box(dimensions) {
module cell_holder(dimensions, thickness) {
length = dimensions[0];
width = dimensions[1];
height = dimensions[2];
difference() {
union() {
channel([converter_height, length, width], wall_thickness, bevel = bevel);
// Now we need an end cap for the converter box.
translate([(converter_height / 2) - threshold, 0, 0])
rounded_cube([wall_thickness, length, width], wall_thickness, bevel = bevel);
}
// Drive a cylinder through the sides to allow wires to enter and exit.
translate([0, 0, 6]) rotate([0, 0, 90]) rounded_cube([length + threshold, wire_radius * 2, wire_radius * 4]);
rounded_cube([length, width, height], bevel=bevel);
translate([0, 0, wall_thickness])
rounded_cube([length - thickness * 2, width - thickness * 2, height], bevel=bevel);
}
}
module cell_cradle(width, height) {
difference() {
translate([0, 0, -height / 2]) cube([width,
wall_thickness,
height],
center = true);
color("red", 1) translate([0, 0, 0])
rotate([90, 0, 0])
cylinder(h = wall_thickness + cutout_threshold,
r = width / 2,
center = true);
}
}
module converter_holder(dimensions, thickness) {
length = dimensions[0];
width = dimensions[1];
height = dimensions[2];
module base_slot() {
difference() {
rounded_cube([wall_thickness * 2, cell_holder_width, cell_holder_height], bevel = 0.5);
translate([-1, 0, wall_thickness]) cube([2.1, 12, cell_holder_height], center = true);
}
}
module spring_slot() {
difference() {
rounded_cube([wall_thickness * 2, cell_holder_width, cell_holder_height], bevel = 0.5);
translate([1.5, 0, wall_thickness]) cube([1.1, 12, cell_holder_height], center = true);
}
}
module cell() {
difference() {
union() {
channel([cell_holder_length, cell_holder_width, cell_holder_height], wall_thickness, bevel = bevel);
rotate([0, 0, 90]) translate([0, -cell_interior_length / 6, wall_thickness])
cell_cradle(cell_holder_width, cell_holder_height / 2);
rotate([0, 0, 90]) translate([0, cell_interior_length / 6, wall_thickness])
cell_cradle(cell_holder_width, cell_holder_height / 2);
translate([-(cell_holder_length - wall_thickness) / 2, 0, 0]) spring_slot();
translate([(cell_holder_length + wall_thickness) / 2, 0, 0]) base_slot();
}
// These two cubes cut out wire channels on either side of the cell holder next to each of the contact slots.
translate([cell_holder_length / 2, 0, cell_holder_height / 2 - 3 + threshold]) cube([2 + threshold, cell_holder_width + threshold, 6], center = true);
translate([-cell_holder_length / 2 + wall_thickness, 0, cell_holder_height / 2 - 3 + threshold]) cube([2 + threshold, cell_holder_width + threshold, 8], center = true);
}
}
// The cells_box consists of each cell holder with some extra space cut out between them for running connector wires.
module cells_box() {
union() {
translate([0, (cell_holder_width / 2) - wall_thickness, 0]) cell();
translate([0, -cell_holder_width / 2, 0]) cell();
channel([length, width, height], wall_thickness, bevel = bevel);
translate([length / 2, 0, 0])
rounded_cube([thickness, width, height], bevel = bevel);
}
}
// The entire case
module battery_case() {
module outer_enclosure(dimensions) {
length = dimensions[0];
width = dimensions[1];
height = dimensions[2];
union() {
channel([length, width, height], wall_thickness, bevel = bevel);
translate([-length / 2, 0, 0])
rounded_cube([wall_thickness, width, height], bevel = bevel);
translate([length / 2, 0, 0])
rounded_cube([wall_thickness, width, height], bevel = bevel);
/*
translate([length / 2, 0, 0])
rounded_cube([wall_thickness, width, height], bevel = bevel);
*/
}
}
module sled_slot(length) {
difference() {
rounded_cube([length, 2, 4], bevel = bevel);
translate([length / 2 - 8, 0, 2]) rotate([90, 0, 0]) cylinder(h = 4, r = 1, center = true);
}
}
module enclosure() {
length = cell_length + spring_height + converter_height + interior_wall_thickness * 3;
width = cell_diameter * 2 + wall_thickness * 3;
height = cell_diameter + wall_thickness;
holder_length = cell_length + spring_height;
holder_width = cell_diameter + interior_wall_thickness * 2;
difference() {
union() {
cells_box();
translate([cell_holder_length / 2 + 6 - 1, -1, 0])
converter_box([cell_holder_width * 2 - wall_thickness, cell_holder_height]);
outer_enclosure([length, width - interior_wall_thickness, height]);
translate([length / 2 - wall_thickness, 0, 0])
converter_holder([converter_height, width - interior_wall_thickness, height], interior_wall_thickness);
translate([-(length - holder_length) / 2, holder_width / 2 - interior_wall_thickness / 2, 0])
cell_holder([holder_length, holder_width, cell_diameter], interior_wall_thickness);
translate([-(length - holder_length) / 2, -holder_width / 2 + interior_wall_thickness / 2, 0])
cell_holder([holder_length, holder_width, cell_diameter], interior_wall_thickness);
}
// This provides a wire channel on either side of the case
translate([converter_height - 1, cell_holder_width - wall_thickness, cell_holder_height / 2 - 5])
rounded_cube([cell_holder_length + wall_thickness * 2, wire_radius * 2, wire_radius * 4]);
translate([converter_height - 1, - cell_holder_width, cell_holder_height / 2 - 5])
rounded_cube([cell_holder_length + wall_thickness * 2, wire_radius * 2, wire_radius * 4]);
// Drill a couple of wire holes into the converter box
// This first one extends out the top of the container and is the power line for the rest of the system.
translate([length / 2, -converter_length / 2, 0])
rounded_cube([wall_thickness * 2, wire_radius * 2, wire_radius * 8], bevel = bevel);
// This one extends back into the battery container
translate([0, width / 2 - wall_thickness, -height / 2 + wire_radius * 8])
rounded_cube([length, wire_radius * 2 + clearance, wire_radius * 8], bevel = bevel);
// Now let's cut out some sleds for the lid
translate([-4, width / 2 - wire_radius, height / 4])
sled_slot(length);
color("red") translate([-4, -width / 2 + wire_radius, height / 4])
sled_slot(length);
}
}
battery_case();
// cell();
enclosure();