GeigerCounterEnclosure/BatteryBank.scad

83 lines
2.0 KiB
OpenSCAD
Raw Normal View History

2021-08-28 16:03:33 +00:00
include <BOSL/constants.scad>
use <BOSL/transforms.scad>
use <BOSL/shapes.scad>
model = 0;
bank_wall = 2;
bank_inside_size = [94, 19, 19];
bank_socket_size = [bank_inside_size.x + 2, bank_inside_size.y + 2, 4];
pcb_size = [20, 19, 1];
separator_size = [2.5, pcb_size.y - 3, 12.5];
separator_pos = [bank_inside_size.x/2 - pcb_size.x - 0.2 - separator_size.x/2, -3, -bank_inside_size.z/2 + separator_size.z/2];
joiner_size = [5, 5, bank_inside_size.z];
joiner_pos = [0, bank_inside_size.y/2 + bank_wall + joiner_size.y/2, 0];
joiner_spread = 60;
bank_joiner_screw_diam = 2.2;
window_pos = [bank_inside_size.x/2, 0, 0];
window_size = [10, bank_inside_size.y - 1.8*2, 12];
module bank_inside() {
cube(bank_inside_size, center=true);
}
module bank_joiner() {
difference() {
cuboid(joiner_size, chamfer=1, edges=EDGES_Z_BK);
down(joiner_size.z/2) cylinder(d=bank_joiner_screw_diam, h=joiner_size.z, $fn=12);
}
}
module bank() {
difference() {
minkowski() {
cube(bank_inside_size, center=true);
sphere(r=bank_wall, $fn=18);
}
bank_inside();
translate(window_pos) cube(window_size, center=true);
}
translate(separator_pos) cube(separator_size, center=true);
translate(joiner_pos) {
left(joiner_spread/2) bank_joiner();
right(joiner_spread/2) bank_joiner();
}
}
module bank_divider(socket) {
up(5.5) {
difference() {
down(50) cube([500, 100, 100], center=true);
scale(socket ? 1 : [0.995, 0.97, 0.96]) cube(bank_socket_size, center=true);
}
}
}
module model_bank_bottom() {
up(bank_wall + bank_inside_size.z/2)
intersection() {
bank();
bank_divider(socket=true);
}
}
module model_bank_top() {
up(bank_wall + bank_inside_size.z/2)
difference() {
bank();
bank_divider(socket=false);
}
}
if (model == 0) {
model_bank_bottom();
model_bank_top();
}
if (model == 1) {
model_bank_bottom();
}
if (model == 2) {
model_bank_top();
}