Work out a lid that contains integrated lights and buttons

This commit is contained in:
Savanni D'Gerinel 2024-11-07 17:32:52 -05:00 committed by savanni
parent dd861fbbd4
commit 8235ef0646
5 changed files with 98 additions and 14 deletions

View File

@ -1,6 +1,6 @@
module hexagon(r, h) { module hexagon(r, h) {
cylinder(r = r, h = h, $fn = 6); cylinder(r = r, h = h, center = 2, $fn = 6);
} }
module pill(length, bevel) { module pill(length, bevel) {
@ -10,6 +10,27 @@ module pill(length, bevel) {
} }
} }
module rounded_cube(dimensions, bevel = 0) {
x = dimensions[0];
y = dimensions[1];
z = dimensions[2];
if (bevel > 0) {
hull() {
translate([-x / 2 + bevel, -y / 2 + bevel, -z / 2 + bevel]) sphere(r = bevel);
translate([ x / 2 - bevel, -y / 2 + bevel, -z / 2 + bevel]) sphere(r = bevel);
translate([ x / 2 - bevel, y / 2 - bevel, -z / 2 + bevel]) sphere(r = bevel);
translate([-x / 2 + bevel, y / 2 - bevel, -z / 2 + bevel]) sphere(r = bevel);
translate([-x / 2 + bevel, -y / 2 + bevel, z / 2 - bevel]) sphere(r = bevel);
translate([ x / 2 - bevel, -y / 2 + bevel, z / 2 - bevel]) sphere(r = bevel);
translate([ x / 2 - bevel, y / 2 - bevel, z / 2 - bevel]) sphere(r = bevel);
translate([-x / 2 + bevel, y / 2 - bevel, z / 2 - bevel]) sphere(r = bevel);
}
} else {
cube(dimensions, center = true);
}
}
module box_face(dimensions, bevel = 0) { module box_face(dimensions, bevel = 0) {
x = dimensions[0]; x = dimensions[0];
y = dimensions[1]; y = dimensions[1];

View File

@ -38,11 +38,10 @@ module top_clasp() {
module hinge(length) { module hinge(length) {
difference() { difference() {
union() { union() {
cylinder(h = length, r = hinge_radius); cube([hinge_radius * 2, length, hinge_radius], center = true);
translate([0, -hinge_radius, 0]) translate([0, 0, -1.5]) rotate([90, 0, 0]) cylinder(h = length, r = hinge_radius, center = true);
cube([hinge_radius, hinge_radius * 2, length]);
} }
translate([0, 0, -threshold / 2]) cylinder(h = length + threshold, r = 1); translate([0, threshold / 2, -1.5]) rotate([90, 0, 0]) cylinder(h = length + threshold * 2, r = 1, center = true);
} }
} }
@ -123,29 +122,85 @@ module main_case() {
translate([case_length / 2, case_width / 2, -threshold]) hexagon(4.5, 6); translate([case_length / 2, case_width / 2, -threshold]) hexagon(4.5, 6);
color("green", 1) translate([8.5 + wall_thickness, case_width - wall_thickness - threshold, wall_thickness]) # translate([8.5 + wall_thickness, case_width - wall_thickness - threshold, wall_thickness])
cube([60, wall_thickness * 2, 7]); # cube([60, wall_thickness * 2, 7]);
}
}
module lamp() {
union() {
translate([0, 0, -0.5]) cube([12.9 + threshold, 8, 4], center = true);
translate([0, 0, .88]) cube([5 + threshold, 5 + threshold, 1.56], center = true);
/*
translate([0, 0, -1.56]) cube([12.9, 7.6, wall_thickness], center = true);
*/
}
}
module button() {
union() {
cube([3.5 + threshold, 6.1 + threshold, 4 + threshold], center = true);
translate([0, 0, -0.5]) cube([1.2, 7, 3 + threshold], center = true);
} }
} }
module lid() { module lid() {
lid_width = case_width + hinge_radius * 2 + wall_thickness; lid_width = case_width + hinge_radius * 2 + wall_thickness;
hinge_length = case_length / 4;
union() { union() {
difference() { difference() {
box_face([case_length, rounded_cube([case_length,
lid_width, lid_width,
wall_thickness], wall_thickness],
bevel); bevel);
translate([(case_length - 60) / 2, 14 + hinge_radius * 2, -threshold / 2]) translate([0, lid_width / 5, 0.4]) lamp();
cube([60, 16, wall_thickness + threshold]); translate([-15, lid_width / 5, 0.4]) lamp();
translate([15, lid_width / 5, 0.4]) lamp();
translate([-30, lid_width / 5, 0]) button();
translate([30, lid_width / 5, 0]) button();
translate([0, lid_width / 5, -2]) cube([20, 7, 3], center = true);
color("black") translate([-2, lid_width / 5 - 5, -2]) rotate([0, 0, 90]) rotate([0, 90, 0]) cylinder(h=5, r = 1, center = true, $fn = circular_face_count);
color("black") translate([-17, lid_width / 5 - 5, -2]) rotate([0, 0, 90]) rotate([0, 90, 0]) cylinder(h=5, r = 1, center = true, $fn = circular_face_count);
color("black") translate([13, lid_width / 5 - 5, -2]) rotate([0, 0, 90]) rotate([0, 90, 0]) cylinder(h=5, r = 1, center = true, $fn = circular_face_count);
color("black") translate([-30, lid_width / 5 - 5, -2]) rotate([0, 0, 90]) rotate([0, 90, 0]) cylinder(h=5, r = 1, center = true, $fn = circular_face_count);
color("black") translate([30, lid_width / 5 - 5, -2]) rotate([0, 0, 90]) rotate([0, 90, 0]) cylinder(h=5, r = 1, center = true, $fn = circular_face_count);
color("black") translate([0, 10, -2]) rotate([0, 90, 0]) cylinder(h = 62, r = 1, center = true, $fn = circular_face_count);
color("red") translate([-33, 21, -2]) rotate([0, 90, 0]) cylinder(h = 5, r = 1, center = true, $fn = circular_face_count);
color("red") translate([-35, 13, -2]) rotate([0, 0, 90]) rotate([0, 90, 0]) cylinder(h = 18, r = 1, center = true, $fn = circular_face_count);
color("red") translate([33, 21, -2]) rotate([0, 90, 0]) cylinder(h = 5, r = 1, center = true, $fn = circular_face_count);
color("red") translate([35, 13, -2]) rotate([0, 0, 90]) rotate([0, 90, 0]) cylinder(h = 18, r = 1, center = true, $fn = circular_face_count);
color("red") translate([0, 5, -2]) rotate([0, 90, 0]) cylinder(h = 70, r = 1, center = true, $fn = circular_face_count);
} }
translate([case_length / 4 + 1, hinge_radius - 0.4, -hinge_radius]) translate([case_length / 2 - hinge_length / 2, lid_width / 2 - wall_thickness / 2 - 0.5, -wall_thickness / 2]) rotate([0, 0, 90]) hinge(hinge_length);
rotate([180, 0, 0]) translate([-case_length / 2 + hinge_length / 2, lid_width / 2 - wall_thickness / 2 - 0.5, -wall_thickness / 2]) rotate([0, 0, 90]) hinge(hinge_length);
rotate([0, 90, 0]) hinge(case_length / 2 - 2);
} }
} }
module box_side() { module box_side() {
box_side_slider(case_length, case_width, case_height); box_side_slider(case_length, case_width, case_height);
} }
module case_base() {
difference() {
rounded_cube([case_length, case_width, wall_thickness + 2], bevel = 0.5);
translate([wall_thickness, 0, 2]) rounded_cube([case_length + threshold, board_width + threshold, 2 + threshold]);
// These give a screw-hole in the center which will allow the clamp to be attached
translate([0, 0, -1]) hexagon(4.5, 2);
translate([0, 0, -wall_thickness / 2]) cylinder(r = 2, h = wall_thickness + threshold, center = true);
// and now a bit of an indentation to help the clip remain in place
translate([0, 0, -4.5]) cube([clasp_width + threshold, clasp_width + threshold, wall_thickness], center = true);
// here are some grooves along the edges that can be used to piece parts together
translate([wall_thickness / 2, case_width / 2 - wall_thickness / 2, wall_thickness / 2])
cube([board_length + wall_thickness, wall_thickness / 2, wall_thickness / 2 + threshold], center = true);
translate([wall_thickness / 2, -case_width / 2 + wall_thickness / 2, wall_thickness / 2])
cube([board_length + wall_thickness, wall_thickness / 2, wall_thickness / 2 + threshold], center = true);
}
}

View File

@ -1,4 +1,11 @@
include <./control_panel.scad> include <./control_panel.scad>
main_case(); /*
difference() {
color("blue") rounded_cube([5, 5, 5], bevel = 0.5);
translate([0, 0, 1]) rounded_cube([4, 4, 4]);
};
*/
case_base();

View File

@ -2,4 +2,5 @@
include <./control_panel.scad> include <./control_panel.scad>
lid(); lid();
// lamp();

Binary file not shown.