$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]); } }