3d-stuff/openscad/own/volumio/case.scad

147 lines
6.3 KiB
OpenSCAD

// volumio hifi-pi-case
// by zeus - zeus@ctdo.de - CC-BY-NC-4.0
// -> https://www.thingiverse.com/zeus
// -> https://github.com/zeus86
// 2015-03-09
//======================================================================
//DEFINITIONS
$fn=150;
case_w=155;
case_h=100;
case_d_top=15;
case_d_bottom=30;
case_d=case_d_top+case_d_bottom;
mt=2.5;
hole_dia_o=4.5;
hole_dia_i=3;
standoff_h=6;
standoff_space_w=55;
standoff_space_h=25;
io_cut_w=40;
io_cut_h=15;
io_tray_l=25;
io_vert_offset=2.5;
dac_jack_dia=6.2;
dac_jack_t=1.5;
dac_jack_offset=11.5;
usb_plug_w=11.5;
usb_plug_h=10;
usb_offset=usb_plug_w*0.75;
disp_cut_w=100;
disp_cut_h=41;
disp_hole_dist_x=94;
disp_hole_dist_y=56;
clip_w=10;
clip_d=mt*2;
clip_h=15;
clip_dia=mt;
//======================================================================
//DRAWING
case_b();
rotate([0,180,0])translate([0,0,-case_d_top*3])case_t();
translate([0,-case_h/2-dac_jack_t/2,case_d_bottom/2+io_cut_h/2]) io_tray();
//======================================================================
//MODULES
module standoff(){
translate([0,0,standoff_h/2+mt]){
difference(){
cylinder(r1=hole_dia_o/1.33,r2=hole_dia_o/2,h=standoff_h,center=true);
cylinder(r=hole_dia_i/2,h=standoff_h+0.1,center=true);
}
}
}
module io_tray(){
difference(){
cube([io_cut_w+hole_dia_i*6,dac_jack_t,io_cut_h+hole_dia_i*2],center=true); //frontplate
for (x=[-dac_jack_offset/2+dac_jack_dia/2,-2*dac_jack_offset/2-dac_jack_dia/2])translate([x,0,io_vert_offset])rotate([90,0,0])cylinder(r=dac_jack_dia/2+0.1,h=mt+0.1,center=true); //DAC-Holes
translate([usb_plug_w/2+usb_offset,0,io_vert_offset])cube([usb_plug_w,dac_jack_t+0.1,usb_plug_h],center=true); // usb-plug
for (x=[-io_cut_w/2-hole_dia_i*2,io_cut_w/2+hole_dia_i*2])translate([x,0,0])rotate([90,0,0])cylinder(r=hole_dia_i/2+0.1,h=dac_jack_t+0.1,center=true); //mount holes
}
difference(){
translate([-io_cut_w/6,io_tray_l/2+dac_jack_t/2,-io_cut_h/2+mt])cube([io_cut_w*0.66-1,io_tray_l,mt],center=true); //tray-baseplate
//ziptie-holes
hull()for (x=[io_tray_l*0.25,io_tray_l*0.75])translate([-io_cut_w/3,x,-io_cut_h/2+mt])cylinder(r=hole_dia_i/2,h=mt+0.1,center=true);
hull()for (x=[io_tray_l*0.25,io_tray_l*0.75])translate([0,x,-io_cut_h/2+mt])cylinder(r=hole_dia_i/2,h=mt+0.1,center=true);
hull()for (x=[io_tray_l*0.25,io_tray_l*0.75])translate([io_cut_w/3,x,-io_cut_h/2+mt])cylinder(r=hole_dia_i/2,h=mt+0.1,center=true);
}
}
module clip(){
translate([0,0,-mt])cube([clip_w,clip_d,clip_h+case_d_top-mt*2],center=true);
rotate([0,90,0])translate([-clip_h+mt*2,0,0])scale([1,2,1])cylinder(r=clip_dia,h=clip_w,center=true);
}
module hanger(){
hull(){
translate([hole_dia_o,0,0])cylinder(r=hole_dia_o/2,h=mt+0.1,center=true);
translate([-hole_dia_o,0,0])cylinder(r=hole_dia_o/2,h=mt+0.1,center=true);
}
hull(){
translate([0,-hole_dia_o,0])cylinder(r=hole_dia_o/2,h=mt+0.1,center=true);
translate([0,hole_dia_o,0])cylinder(r=hole_dia_o/2,h=mt+0.1,center=true);
}
}
module case_b(){
difference(){
translate([0,0,case_d_bottom/2])cylinder(r=case_w/2,h=case_d_bottom, center=true); //outer ring
translate([0,0,case_d_bottom/2+mt/2])cylinder(r=case_w/2-mt,h=case_d_bottom-mt+0.1, center=true); //inner ring
translate([0,-case_h,case_d_bottom/2])cube([case_w,case_h,case_d_bottom+0.1],center=true); //bottom cut
translate([0,case_h,case_d_bottom/2])cube([case_w,case_h,case_d_bottom+0.1],center=true); //top cut
for (x=[-case_w/3,case_w/3]){
translate([x,case_h/10,mt/2])hanger(); //wall hangers
}
}
difference(){
translate([0,0,case_d_bottom/2])cube([case_w*(case_w/case_h)/2-mt,case_h,case_d_bottom],center=true); //inner cube cut
translate([0,0,case_d_bottom/2])cube([case_w+0.1,case_h-mt*2,case_d_bottom+0.1],center=true); //inner cube cut
translate([0,-case_h/2+mt/2,case_d_bottom/2+io_cut_h/2+0.1]){
cube([io_cut_w,mt+0.1,io_cut_h],center=true); //I/O cutout
for (x=[-io_cut_w/2-hole_dia_i*2,io_cut_w/2+hole_dia_i*2]){
translate([x,0,0]){
rotate([90,0,0])cylinder(r=hole_dia_i/2+0.1,h=mt+0.1,center=true);
}
}
}
for (x=[-disp_hole_dist_x/2,disp_hole_dist_x/2],y=[-case_h/2+mt/2,case_h/2-mt/2]){
translate([x,y,clip_h/2+case_d_top/2+mt]) cube([clip_w+0.1,mt+0.1,clip_d*1.25],center=true); //clip holes
}
}
for (x=[-standoff_space_w/2,standoff_space_w/2],y=[-standoff_space_h/2,standoff_space_h/2]){
translate([x,y,0])standoff(); //pi standoffs
}
}
module case_t(){
difference(){
translate([0,0,case_d_top/2])cylinder(r=case_w/2,h=case_d_top, center=true); //outer ring
translate([0,0,case_d_top/2+mt/2])cylinder(r=case_w/2-mt,h=case_d_top-mt+0.1, center=true); //inner ring
translate([0,-case_h,case_d_top/2])cube([case_w,case_h,case_d_top+0.1],center=true); //bottom cut
translate([0,case_h,case_d_top/2])cube([case_w,case_h,case_d_top+0.1],center=true); //top cut
translate([0,0,mt/2])cube([disp_cut_w,disp_cut_h,mt+0.1],center=true); //display-hole
}
difference(){
translate([0,0,case_d_top/2])cube([case_w*(case_w/case_h)/2-mt,case_h,case_d_top],center=true); //inner cube cut
translate([0,0,case_d_top/2])cube([case_w+0.1,case_h-mt*2,case_d_top+0.1],center=true); //inner cube cut
}
for (x=[-disp_hole_dist_x/2,disp_hole_dist_x/2],y=[-disp_hole_dist_y/2,disp_hole_dist_y/2]){
translate([x,y,0])standoff(); //standoffs for display (hd44780, 20x04)
}
for (x=[-disp_hole_dist_x/2,disp_hole_dist_x/2],y=[-case_h/2+mt+clip_d/2,case_h/2-mt-clip_d/2]){
translate([x,y,clip_h/2+case_d_top/2+mt]) clip(); //clips
}
}