diff options
Diffstat (limited to 'case.scad')
-rw-r--r-- | case.scad | 202 |
1 files changed, 202 insertions, 0 deletions
diff --git a/case.scad b/case.scad new file mode 100644 index 0000000..930dd1a --- /dev/null +++ b/case.scad @@ -0,0 +1,202 @@ +include <board.scad> +//keyboard(); +w_t = 2; // wall thickness +tol = 1.01; +tl = -(tol - 1)/2; +//hole post for supporting PCB +module hole_p() { + translate([0,0,tl * 1.8]) { + cylinder(d=2.7 * .8,h=0.5, $fn=25); + translate([0,0,-8]) cylinder(d=6, h=8); + } +} +/* + * Functional Case bottom + */ +module body() { +//Case body + //carve out hole for general shape of board + difference() { + translate([-w_t, -w_t, -8 -3]) + cube([p_w + w_t*2, p_h + w_t *2, 8+1.8+3]); + //board itself + translate([tl * p_w, tl* p_h, tl * 1.8]) cube([p_w * tol, p_h * tol, 1.8 * tol]); + //solder stuff + s_w = p_w - 7.3*2; + s_h = p_h - 7.3 *2; + translate([tl * s_w +7.3, tl* s_h +7.3, tl * 3 - 2]) + cube([s_w * tol, s_h * tol, 3 * tol]); + //mounting holes + translate([4.85,16.6,0]) scale([1,1,100])u_hole(); + translate([4.85,54.8,0]) scale([1,1,100])u_hole(); + translate([p_w-4.85-2.7,54.8,0]) scale([1,1,100])u_hole(); + translate([p_w-4.85-2.7,93.8,0]) scale([1,1,100])u_hole(); + //mounting hole heads + adj = +2.7/2; + b_h = 13.08 + 8 +3 - (20 - 2) +2; + translate([4.85 +adj,16.6 +adj,-8 -3 -1]) cylinder(d=6, h=b_h+1); + translate([4.85 +adj,54.8 +adj, -8 -3 -1]) cylinder(d=6, h=b_h+1); + translate([p_w-4.85-2.7 +adj,54.8 +adj,-8 -3 -1])cylinder(d=6, h=b_h+1); + translate([p_w-4.85-2.7 +adj,93.8 +adj, -8 -3 -1]) cylinder(d=6, h=b_h+1); + } + //divots and stuff + translate([p_w/2 - 12.9/2,0,]) scale([0.95, .95, 1])divot(); + translate([p_w/2 - 12.9/2,p_h,]) rotate([180,0,0]) scale([0.95, .95, 1]) divot(); + //mounting hole heads + translate([p_w-32.7,18.1,0]) hole_p(); + translate([p_w-108.6,18.1,0]) hole_p(); + translate([26.2,18.1,0]) hole_p(); + translate([83.4,18.1,0]) hole_p(); + translate([31.3,74.9,0]) hole_p(); + translate([117.3,74.9,0]) hole_p(); + translate([p_w-74.7,74.9,0]) hole_p(); + translate([p_w-37.2, p_h-16.7,0]) hole_p(); + translate([p_w-131.5, p_h-16.7,0]) hole_p(); + +} + +/* + * Case Bottom with all the decorative cuts + */ +module bottom() { +difference() { + body(); + + //vevels + translate([0,0,-75])rotate([90,0,0]) + cylinder(r=70, h=p_h*20, center=true, $fn=30); + translate([p_w,0,-75])rotate([90,0,0]) + cylinder(r=70, h=p_h*20, center=true, $fn=30); + + //bottom cut + translate([-w_t,p_h+w_t,-5-8-3]) rotate([-2,0,0]) + translate([0,-600,0]) { + translate([p_w/2,600-p_h/2,0])linear_extrude(1+5+3-1) + rotate([0,180,180]){ + translate([0,20,0]) + text("マイクロスイッチ", halign="center",valign="center", size=10, + font="HanaMinA"); + + translate([0,-10,0]) + text("「微鍵㍿」", halign="center",valign="center", size=30, + font="HanaMinA"); + } + + translate([50,0,5-1])cube([p_w+2*w_t-2*50,600,3]); + cube([p_w+2*w_t,600,5]); + } +} +} +/* + * Case Top + */ +//spacebar width +space_w = (18+0.9)*8-0.9; +module top() { + //spacebar cover and cutout + difference() { + translate([15.55 + 2.5*(18 + 0.9) -3, -w_t, 9]) + cube([space_w +3*2, 8+w_t, 19.32+w_t -9]); + + //spacebar stabilizer cutout + space_w = (18+0.9)*8-0.9; + translate([15.55 + 2.5*(18 + 0.9) + tl * space_w, 0, 0]) + cube([space_w* tol, 13.46, 17.91 * tol]); + } +difference() { + translate([-w_t,-w_t,1.8])cube([p_w+w_t*2, p_h+w_t*2, 13.08+3-1.8]); + + //interior chamfers + translate([0.01 * pl_w,0.01 * (pl_h),13.08-1]) + linear_extrude(100) scale([.98,.98,0]) + projection() plate(); + + translate([p_w*80/243,p_h/2, +1010])rotate([90,0,0]) + cylinder(r=1000, h=0.98*(pl_h), center=true, $fn=100); + + translate([p_w*163/243,p_h/2, +1010])rotate([90,0,0]) + cylinder(r=1000, h=0.98*(pl_h), center=true, $fn=100); + + translate([p_w/2,p_h/4 , +113])rotate([0,90,0]) + cylinder(r=100, h=0.88*(pl_w), center=true, $fn=50); + translate([p_w/2,p_h*3/4 , +113])rotate([0,90,0]) + cylinder(r=100, h=0.88*(pl_w), center=true, $fn=50); + + //plate void + translate([-1,-1,1.8+3.92 -0.5]) + cube([p_w+1*2, p_h+1*2, pl_d +0.5]); + //key void + translate([10,-1,1.8 -1])cube([p_w-10*2, p_h+1*2, 3.92 +1+0.5]); + //front & back bevels + difference() { + f_r = 2; + translate([-w_t -1, -w_t -1, 13.08+3-f_r]) + cube([p_w+w_t*2 +2, f_r +1, f_r + 1]); + translate([p_w/2 + 1,f_r-w_t,13.08+3-f_r])rotate([0,90,0]) + cylinder(r=f_r, h=(p_w + w_t*2 +2), center=true ,$fn=50); + } + difference() { + f_r = 4; + translate([-w_t -1, p_h + w_t -f_r, 13.08+3-f_r]) + cube([p_w+w_t*2 +2, f_r +1, f_r + 1]); + translate([p_w/2 + 1,p_h +w_t - f_r ,13.08+3-f_r])rotate([0,90,0]) + cylinder(r=f_r, h=(p_w + w_t*2 +2), center=true ,$fn=50); + } + //spacebar stabilizer cutout + translate([15.55 + 2.5*(18 + 0.9) + tl * space_w, 0, 0]) + cube([space_w* tol, 13.46, 17.91 * tol]); + //green led cutout + translate([p_w-16.85-6.08 + 6.04 * tl -1,6.5 + 2.93 * tl -1,9]) + cube([6.04 * tol +2*1,2.93 * tol + 2*1,20]); + + //mounting holes + translate([4.85,16.6,-1]) scale([1,1,2])u_hole(); + translate([4.85,54.8,-1]) scale([1,1,2])u_hole(); + translate([p_w-4.85-2.7,54.8,-1]) scale([1,1,3])u_hole(); + translate([p_w-4.85-2.7,93.8,-1]) scale([1,1,2])u_hole(); + //mounting hole heads + adj = +2.7/2; + + translate([4.85 +adj,16.6 +adj,3.92+1.8-2*tol]) + cylinder(d=6, h=2*tol); + + translate([4.85 +adj,54.8 +adj, 3.92+1.8-2*tol]) + cylinder(d=6, h=2*tol); + + translate([p_w-4.85-2.7 +adj,54.8 +adj,3.92+1.8-2*tol]) + cylinder(d=6,h=2*tol); + + translate([p_w-4.85-2.7 +adj,93.8 +adj, 3.92+1.8-2*tol]) + cylinder(d=6, h=2*tol); + +} +} +/* + * Divide Top into Elft and Right sections + */ +module right() { + difference() { + top(); + rotate([0,0,45]) + translate([-1000 + p_w/2, -500, -500]) + cube([1000,1000,1000 ]); + } +} +module left() { + intersection() { + top(); + rotate([0,0,45]) + translate([-1000 + p_w/2, -500, -500]) + cube([1000,1000,1000 ]); + } +} + +/* + * Fin. + */ +//color([1,0,0])left(); +color([0,1,0])right(); +//top(); +color([0,0,1])bottom(); +color([1,1,0])keyboard(); + |