simplify to one frame and cover

This commit is contained in:
2023-08-10 11:48:27 +02:00
parent 85894347e0
commit fcdd1b5b66
5 changed files with 236 additions and 208 deletions

View File

64
cad/display-cover.scad Normal file
View File

@@ -0,0 +1,64 @@
module rpi4_cover(){
pi_height=28;
pi_width=104;
difference(){
translate([31+thickness+10, 0, height])
chamferCube(pi_width, depth+(thickness*2), pi_height+thickness, 8, [0, 0, 1, 1], [0, 0, 0, 0], [0, 0, 0, 0]);
translate([31+thickness+10, thickness, height])
chamferCube(pi_width, depth, pi_height, 8, [0, 0, 1, 1], [0, 0, 0, 0], [0, 0, 0, 0]);
translate([31+thickness+62, (depth+(thickness*2))/2, height+pi_height])
cylinder(h=thickness, d=41.5);
// hdmi gap
translate([thickness+95, depth+thickness, height])
cube([25, 0.8, 17]);
// keyboard cabel hole
translate([width/2+thickness-6, thickness+1, 20])
rotate([90, 0, 0])
#cylinder(h=thickness+1, d=3);
translate([width/2+thickness+6, thickness+1, 20])
rotate([90, 0, 0])
#cylinder(h=thickness+1, d=3);
}
// logo
translate([31+thickness+62, (depth+(thickness*2))/2, height+pi_height])
linear_extrude(height=1.6)
resize([42, 42, 0])
import(file="mk-logo.svg", center=true);
}
module chamferCube(sizeX, sizeY, sizeZ, chamferHeight, chamferX, chamferY, chamferZ) {
chamferX = (chamferX == undef) ? [1, 1, 1, 1] : chamferX;
chamferY = (chamferY == undef) ? [1, 1, 1, 1] : chamferY;
chamferZ = (chamferZ == undef) ? [1, 1, 1, 1] : chamferZ;
chamferCLength = sqrt(chamferHeight * chamferHeight * 2);
difference() {
cube([sizeX, sizeY, sizeZ]);
for(x = [0 : 3]) {
chamferSide1 = min(x, 1) - floor(x / 3); // 0 1 1 0
chamferSide2 = floor(x / 2); // 0 0 1 1
if(chamferX[x]) {
translate([-0.1, chamferSide1 * sizeY, -chamferHeight + chamferSide2 * sizeZ])
rotate([45, 0, 0])
cube([sizeX + 0.2, chamferCLength, chamferCLength]);
}
if(chamferY[x]) {
translate([-chamferHeight + chamferSide2 * sizeX, -0.1, chamferSide1 * sizeZ])
rotate([0, 45, 0])
cube([chamferCLength, sizeY + 0.2, chamferCLength]);
}
if(chamferZ[x]) {
translate([chamferSide1 * sizeX, -chamferHeight + chamferSide2 * sizeY, -0.1])
rotate([0, 0, 45])
cube([chamferCLength, chamferCLength, sizeZ + 0.2]);
}
}
}
}

172
cad/display-frame.scad Normal file
View File

@@ -0,0 +1,172 @@
$fn=32*2;
thickness=1.6;
width=208.2;
depth=70.2;
height=8;
display();
module display(){
// outer display frame
difference(){
translate([0, 0, 0])
cube([width+(thickness*2), depth+(thickness*2), height]);
translate([thickness, thickness, 0])
cube([width, depth, height]);
}
// inner display catch
translate([thickness, thickness, 1.5]){
padding=5;
ledge=0.8;
difference(){
translate([padding, 0, 0])
cube([width-(padding*2), depth, thickness]);
translate([0, ledge, 0])
cube([width, depth-(ledge*2), thickness]);
}
}
// usb compartment
translate([0, 0, 0])
usb_compartment();
// battery compartment
translate([146.6, 0, 0])
battery_compartment();
// raspberry pi 4 cover
rpi4_cover();
// display hinge
translate([(width+thickness*2)/2, -9, 6.57])
rotate([90, 270, 0])
male_hinge();
}
module rpi4_cover(){
pi_height=22;
difference(){
translate([0, 0, height])
cube([width+(thickness*2), depth+(thickness*2), pi_height]);
translate([thickness, thickness, height])
cube([width, depth, pi_height]);
// hdmi gap
translate([thickness+95, depth+thickness, height])
cube([25, 0.8, 17]);
}
}
module usb_compartment(){
usb_width=41;
usb_height=4;
hole=6.5;
hole_x=36+thickness;
hole_y=5.6+thickness;
difference(){
translate([0, 0, height])
cube([usb_width+thickness, depth+(thickness*2), usb_height+thickness]);
translate([thickness, thickness, height+thickness])
cube([30-thickness, depth, usb_height]);
translate([30+thickness, thickness, height])
cube([11, depth, usb_height]);
translate([hole_x, hole_y-0.5, height+usb_height])
cylinder(h=thickness, d=hole);
translate([hole_x, depth+(thickness*2)-hole_y, height+usb_height])
cylinder(h=thickness, d=hole);
}
// screw mount
translate([hole_x, hole_y-0.5, height+4+thickness]){
difference(){
cylinder(h=1.6, d=10);
cylinder(h=1.6, d=2.5);
}
}
translate([hole_x, depth+(thickness*2)-hole_y, height+4+thickness]){
difference(){
cylinder(h=1.6, d=10);
cylinder(h=1.6, d=2.5);
}
}
}
module battery_compartment(){
battery_width=63.2;
battery_height=4;
hole=6.5;
hole_x=5;
hole_y=5.6+thickness;
difference(){
translate([0, 0, height])
cube([battery_width+thickness, depth+(thickness*2), battery_height+thickness]);
translate([0, thickness, height])
cube([battery_width, depth, battery_height]);
translate([hole_x, hole_y-0.5, height+4])
cylinder(h=thickness, d=hole);
translate([hole_x, depth+(thickness*2)-hole_y, height+battery_height])
cylinder(h=thickness, d=hole);
}
// screw mount
translate([hole_x, hole_y-0.5, height+4+thickness]){
difference(){
cylinder(h=1.6, d=10);
cylinder(h=1.6, d=2.5);
}
}
translate([hole_x, depth+(thickness*2)-hole_y, height+4+thickness]){
difference(){
cylinder(h=1.6, d=10);
cylinder(h=1.6, d=2.5);
}
}
}
module tab(length, thickness){
difference(){
union(){
translate([0,0,-5])
cube([length, thickness, 10], center=true);
rotate([90,0,0])
cylinder(h=thickness, d=length, center=true);
}
rotate([90,0,0])
cylinder(h=20, d=5, center=true);
}
}
module male_hinge(){
th=2.90; //Thickness of solid tabs
sp=3.10; //Width of seperation gap
w=15.14; //Width of base
l=13.14; //length of base
translate([0, 0, -10+th/2])
hull(){
cube([l, w, th], center=true);
translate([-l/2, -w/2-4, -2])
cube([l+4, w+8, 0.1]);
}
//generating 2 tabs with sp spacing
translate([0, -sp, 0])
tab(l, th);
translate([0, sp, 0])
tab(l, th);
}

View File

@@ -1,208 +0,0 @@
$fn=32*2;
thickness=1.6;
width=208.5;
depth=70.5;
height=8;
// outer display frame
difference(){
cube([width+(thickness*2), depth+(thickness*2), height]);
translate([thickness, thickness, 0])
cube([width, depth, height]);
}
// inner display catch
translate([thickness, thickness, 1.5]){
padding=5;
ledge=0.8;
difference(){
translate([padding, 0, 0])
cube([width-(padding*2), depth, thickness]);
translate([0, ledge, 0])
cube([width, depth-(ledge*2), thickness]);
}
}
// usb compartment
usb_compartment();
// battery compartment
translate([146.6, 0, 0])
battery_compartment();
// raspberry pi 4 cover
rpi4_cover();
// display hinge
translate([(width+thickness*2)/2, -9, 6.57])
rotate([90, 270, 0])
male_hinge();
module usb_compartment(){
usb_tray_width=31;
usb_tray_height=4;
usb_step_width=10;
usb_step_height=2;
hole=6;
hole_x=usb_tray_width+(usb_step_width/2)+thickness;
hole_y=5.6+thickness;
// usb tray
difference(){
translate([0, 0, height])
cube([usb_tray_width+thickness, depth+(thickness*2), usb_tray_height+thickness]);
translate([thickness, thickness, height+thickness])
cube([usb_tray_width, depth, usb_tray_height]);
}
// usb step
difference(){
translate([usb_tray_width, 0, height])
cube([usb_step_width+thickness, depth+(thickness*2), usb_step_height+thickness]);
translate([usb_tray_width+thickness, thickness, height])
cube([usb_step_width, depth, usb_step_height]);
translate([hole_x, hole_y, height+usb_step_height])
cylinder(h=thickness, d=hole);
translate([hole_x, depth+(thickness*2)-hole_y, height+usb_step_height])
cylinder(h=thickness, d=hole);
}
}
module battery_compartment(){
battery_width=63.5;
battery_height=4;
hole=6;
hole_x=5;
hole_y=5.6+thickness;
difference(){
translate([0, 0, height])
cube([battery_width+thickness, depth+(thickness*2), battery_height+thickness]);
translate([0, thickness, height])
cube([battery_width, depth, battery_height]);
translate([hole_x, hole_y, height+4])
cylinder(h=thickness, d=hole);
translate([hole_x, depth+(thickness*2)-hole_y, height+battery_height])
cylinder(h=thickness, d=hole);
}
// rails
translate([19, thickness+0.1, height+battery_height+thickness])
female_rail(battery_width-19);
translate([19, depth+thickness-0.1, height+battery_height+thickness])
mirror([0, 1, 0])
female_rail(battery_width-19);
}
module rpi4_cover(){
difference(){
translate([31+thickness+10, 0, height])
cube([104, depth+(thickness*2), 25+thickness]);
translate([31+thickness+10, thickness, height])
cube([104, depth, 25]);
translate([31+thickness+62, (depth+(thickness*2))/2, height+25])
cylinder(h=thickness, d=41.5);
}
// left slope
translate([19+thickness, 0, height+thickness])
sloped_walls(22, depth+(thickness*2), 23.4, thickness);
// right slope
translate([145+thickness+22, 0, height+thickness])
mirror([1,0,0])
sloped_walls(22, depth+(thickness*2), 23.4, thickness);
// logo
translate([31+thickness+62, (depth+(thickness*2))/2, height+25])
linear_extrude(height=1.6)
resize([42, 42, 0])
import(file="mk-logo.svg", center=true);
}
module prism(width, depth, height){
polyhedron(
points=[[0, depth, 0],
[0, 0, 0],
[width, 0, 0],
[width, depth, 0],
[width, depth, height],
[width, 0, height]],
faces=[[0,1,2,3],[5,4,3,2],[0,4,5,1],[0,3,4],[5,2,1]]);
}
module sloped_walls(width, depth, height, thickness){
difference(){
prism(width, depth, height);
translate([0, thickness, 0])
prism(width, depth-(thickness*2), height);
}
}
module tab(length, thickness){
difference(){
union(){
translate([0,0,-5])
cube([length, thickness, 10], center=true);
rotate([90,0,0])
cylinder(h=thickness, d=length, center=true);
}
rotate([90,0,0])
cylinder(h=20, d=5, center=true);
}
}
module male_hinge(){
th=2.90; //Thickness of solid tabs
sp=3.10; //Width of seperation gap
w=15.14; //Width of base
l=13.14; //length of base
translate([0, 0, -10+th/2])
hull(){
cube([l, w, th], center=true);
translate([-l/2, -w/2-4, -2])
cube([l+4, w+8, 0.1]);
}
//generating 2 tabs with sp spacing
translate([0, -sp, 0])
tab(l, th);
translate([0, sp, 0])
tab(l, th);
}
module female_rail(length){
difference(){
cube([length, 2.4, 3]);
translate([0, -0.12, 0.09])
rotate([45, 0, 0])
cube([length, 2, 2]);
}
}
module male_rail(length){
difference(){
translate([0, -0.12, 0.09])
rotate([45, 0, 0])
cube([length, 2, 2]);
translate([0, -1, 0])
cube([length, 1, 3]);
}
}

View File