Apply bevels to everything

This commit is contained in:
Savanni D'Gerinel 2024-09-13 23:20:43 -04:00 committed by savanni
parent 11abde345e
commit 8f71760604
1 changed files with 73 additions and 143 deletions

View File

@ -1,6 +1,7 @@
$fn = 50;
threshold = 0.1;
half_threshold = threshold / 2;
bevel = 0.5;
wire_radius = 1;
@ -25,107 +26,63 @@ converter_width = 11.25;
converter_length = 22.25;
converter_height = 4.25;
module box(length, width, height, wall_thickness) {
center_width = width - wall_thickness;
center_height = height - wall_thickness;
center_length = length - wall_thickness;
union() {
hull() {
translate([-center_width / 2, -center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([-center_width / 2, -center_length / 2, center_height / 2]) sphere(r = wall_thickness);
translate([center_width / 2, -center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([center_width / 2, -center_length / 2, center_height / 2]) sphere(r = wall_thickness);
}
hull() {
translate([-center_width / 2, center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([-center_width / 2, center_length / 2, center_height / 2]) sphere(r = wall_thickness);
translate([center_width / 2, center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([center_width / 2, center_length / 2, center_height / 2]) sphere(r = wall_thickness);
}
hull() {
translate([-center_width / 2, -center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([-center_width / 2, -center_length / 2, center_height / 2]) sphere(r = wall_thickness);
translate([-center_width / 2, center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([-center_width / 2, center_length / 2, center_height / 2]) sphere(r = wall_thickness);
}
hull() {
translate([center_width / 2, -center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([center_width / 2, -center_length / 2, center_height / 2]) sphere(r = wall_thickness);
translate([center_width / 2, center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([center_width / 2, center_length / 2, center_height / 2]) sphere(r = wall_thickness);
}
hull() {
translate([-center_width / 2, -center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([-center_width / 2, center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([center_width / 2, -center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([center_width / 2, center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
}
module pill(length, bevel) {
hull() {
translate([0, 0, (-length / 2) + bevel]) sphere(r = bevel);
translate([0, 0, (length / 2) - bevel]) sphere(r = bevel);
}
/*
difference() {
cube([width,
length,
height],
center = true);
translate([0, 0, wall_thickness])
cube([width - wall_thickness * 2,
length - wall_thickness * 2,
height + threshold],
center = true);
}
*/
}
module channel(length, width, height, wall_thickness) {
center_width = width - wall_thickness;
center_height = height - wall_thickness;
center_length = length - wall_thickness;
module box_face(length, width, wall_thickness, bevel) {
center_width = width - bevel * 2;
center_length = length - bevel * 2;
union() {
hull() {
translate([-center_width / 2, -center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([-center_width / 2, -center_length / 2, center_height / 2]) sphere(r = wall_thickness);
translate([-center_width / 2, center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([-center_width / 2, center_length / 2, center_height / 2]) sphere(r = wall_thickness);
}
hull() {
translate([center_width / 2, -center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([center_width / 2, -center_length / 2, center_height / 2]) sphere(r = wall_thickness);
translate([center_width / 2, center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([center_width / 2, center_length / 2, center_height / 2]) sphere(r = wall_thickness);
}
hull() {
translate([-center_width / 2, -center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([-center_width / 2, center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([center_width / 2, -center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
translate([center_width / 2, center_length / 2, -center_height / 2]) sphere(r = wall_thickness);
}
hull() {
translate([-center_width / 2, -center_length / 2, 0])
pill(wall_thickness, bevel);
translate([center_width / 2, -center_length / 2, 0])
pill(wall_thickness, bevel);
translate([center_width / 2, center_length / 2, 0])
pill(wall_thickness, bevel);
translate([-center_width / 2, center_length / 2, 0])
pill(wall_thickness, bevel);
}
/*
difference() {
cube([width,
length,
height],
center = true);
translate([0, 0, wall_thickness])
cube([width - wall_thickness * 2,
length + threshold,
height + threshold],
center = true);
}
*/
}
module cell_cradle(length, width) {
translate([0, 0, -width / 4]) difference() {
cube([width + wall_thickness * 2,
module channel(length, width, height) {
union() {
translate([0, 0, -height / 2 + wall_thickness / 2])
box_face(length, width, wall_thickness, bevel);
translate([-width / 2 + wall_thickness / 2, 0, 0]) rotate([0, 90, 0])
box_face(length, height, wall_thickness, bevel);
translate([width / 2 - wall_thickness / 2, 0, 0]) rotate([0, 90, 0])
box_face(length, height, wall_thickness, bevel);
}
}
module box(length, width, height) {
union() {
channel(length, width, height);
translate([0, -length / 2 + wall_thickness / 2, 0]) rotate([90, 0, 0])
box_face(height, width, wall_thickness, bevel);
translate([0, length / 2 - wall_thickness / 2, 0]) rotate([90, 0, 0])
box_face(height, width, wall_thickness, bevel);
}
}
// box(20, 10, 10);
// color("blue", 0.5) cube([10, 20, 10], center = true);
module cell_cradle(width, height) {
difference() {
translate([0, 0, -height / 2]) cube([width,
wall_thickness,
width / 2],
height],
center = true);
translate([0, 0, width / 2])
color("red", 1) translate([0, 0, 0])
rotate([90, 0, 0])
cylinder(h = wall_thickness + cutout_threshold,
r = width / 2,
@ -135,35 +92,30 @@ module cell_cradle(length, width) {
module cell_box() {
union() {
channel(cell_holder_length, cell_holder_width, cell_holder_height, wall_thickness);
translate([0, -battery_length / 6, 0]) cell_cradle(cell_holder_length, battery_width);
translate([0, battery_length / 6, 0]) cell_cradle(cell_holder_length, battery_width);
channel(cell_holder_length, cell_holder_width, cell_holder_height);
translate([0, -battery_length / 6, wall_thickness]) cell_cradle(cell_holder_width, cell_holder_height / 2);
translate([0, battery_length / 6, wall_thickness]) cell_cradle(cell_holder_width, cell_holder_height / 2);
}
}
module contact_box() {
contact_thickness = battery_contact_flange_height * .75;
cutout_width = battery_contact_width * .8;
// box_thickness = contact_thickness_ + wall_thickness * 2;
// box_height = width + wall_thickness;
module contact_box(width, contact_width, contact_height, contact_thickness) {
contact_thickness_ = contact_thickness * .75;
cutout_width = contact_width * .8;
box_width = width + wall_thickness * 2;
box_thickness = contact_thickness_ + wall_thickness * 2;
box_height = width + wall_thickness;
union() {
color("red", 1) cube([box_width,
box_thickness,
width + wall_thickness],
center = true);
translate([0,
0,
wall_thickness * 2])
cube([contact_width,
contact_thickness_,
contact_height + cutout_threshold],
difference() {
box(wall_thickness * 2 + contact_thickness, cell_holder_width, cell_holder_height);
translate([0, contact_thickness, wall_thickness * 2])
cube([battery_contact_width,
wall_thickness * 2,
battery_contact_length + threshold],
center = true);
}
/*
/*
union() {
translate([box_width / 2 - (contact_width * .8) / 2,
wall_thickness,
box_height - contact_height])
@ -182,48 +134,26 @@ module contact_box(width, contact_width, contact_height, contact_thickness) {
box_thickness,
width + wire_radius * 2])
cylinder(h = width + wall_thickness * 2 + cutout_threshold, r = 1, center = true);
*/
}
*/
}
module battery_slot(length, width) {
module battery_slot() {
union() {
translate([width + wall_thickness * 2, wall_thickness, 0])
contact_box(battery_width,
battery_contact_width,
battery_contact_length,
battery_contact_flange_height);
translate([0, -cell_holder_length / 2, 0]) contact_box();
translate([0, wall_thickness, 0]) cell_box();
translate([0, wall_thickness + length, 0])
translate([0, cell_holder_length / 2 + wall_thickness * 2, 0])
rotate([0, 0, 180])
contact_box(battery_width,
battery_contact_width,
battery_contact_length,
battery_contact_flange_height);
contact_box();
}
}
module battery_case() {
union() {
battery_slot(battery_length, battery_width);
translate([battery_width + wall_thickness, 0, 0]) battery_slot(battery_length, battery_width);
translate([-cell_holder_width / 2, 0, 0]) battery_slot();
translate([cell_holder_width / 2 - wall_thickness, 0, 0]) battery_slot();
}
}
battery_case();
translate([-50, 0, 0])
contact_box(battery_width,
battery_contact_width,
battery_contact_length,
battery_contact_flange_height);
/*
rotate([0, 90, 0])
translate([0, 5, 0])
cylinder(h=battery_width + wall_thickness * 2 + cutout_threshold, r=1, center = true);
translate([0, -5, 0])
rotate([0, 90, 0])
cylinder(h=battery_width + wall_thickness * 2 + cutout_threshold, r=1, center = true);
*/