From 495c60be9b17bd8cd66765d8cb18c638acb19920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Haoran=20S=2E=20Diao=20=28=E5=88=81=E6=B5=A9=E7=84=B6=29?= <0@hairydiode.xyz> Date: Tue, 12 Apr 2022 23:12:19 -0700 Subject: Initial Commit --- board-2d.scad | 11 ++++ board-2d.svg | 76 ++++++++++++++++++++++ board.scad | 136 ++++++++++++++++++++++++++++++++++++++ bottom-2d.scad | 7 ++ bottom-2d.svg | 86 ++++++++++++++++++++++++ bottom.stl | Bin 0 -> 404084 bytes case.scad | 202 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ left.stl | Bin 0 -> 28084 bytes right.stl | Bin 0 -> 27684 bytes 9 files changed, 518 insertions(+) create mode 100644 board-2d.scad create mode 100644 board-2d.svg create mode 100644 board.scad create mode 100644 bottom-2d.scad create mode 100644 bottom-2d.svg create mode 100644 bottom.stl create mode 100644 case.scad create mode 100644 left.stl create mode 100644 right.stl diff --git a/board-2d.scad b/board-2d.scad new file mode 100644 index 0000000..684cd5c --- /dev/null +++ b/board-2d.scad @@ -0,0 +1,11 @@ +include +module keyplan() { +difference() { + projection() plate(); + union() { + projection() keys(); + projection() switches(); + projection() leds(); + } +} +} diff --git a/board-2d.svg b/board-2d.svg new file mode 100644 index 0000000..c18ef33 --- /dev/null +++ b/board-2d.svg @@ -0,0 +1,76 @@ + + + +OpenSCAD Model + + diff --git a/board.scad b/board.scad new file mode 100644 index 0000000..f1b2ce8 --- /dev/null +++ b/board.scad @@ -0,0 +1,136 @@ +//uncentered hole +module u_hole() { + translate([2.7/2,2.7/2, -5]) cylinder(10, d=2.7,false, $fn=20); +} +//divot +module divot() { + u_hole(); + translate([12.9-2.7 ,0, 0]) u_hole(); + translate([0,-1,-5]) cube([12.9,1+2.7/2,10]); +} +/* + * PCB Board itself + */ +p_w = 327; +p_h = 113; +module pcb() { +difference (){ + //PCB Board + union() { + cube([p_w,p_h,1.8],false); + //represents solder on bottom + translate([7.3,7.3,-1]) cube([p_w-2*7.3,p_h-2*7.3,1]); + }; + //holes + translate([4.85,16.6,0]) u_hole(); + translate([4.85,54.8,0]) u_hole(); + translate([p_w-4.85-2.7,54.8,0]) u_hole(); + translate([p_w-4.85-2.7,93.8,0]) u_hole(); + + //divots + translate([p_w/2 - 12.9/2,0,0])divot(); + translate([p_w/2 - 12.9/2,p_h,0]) rotate([180,0,0]) divot(); + +} +} +/* + * Plate above PCB and KEy switches + */ +pl_d = 13.08-3.92-1.8; //plate depth +pl_w = p_w - 2.6*2; +pl_h = p_h - 6.5 - 6.5; +module plate() { +//move above pcb +translate([0,0,3.92+1.8]) { +difference() { + union () { + //account for size shrink + translate([2.6,6.5,0]) + cube([pl_w, pl_h ,pl_d]); + } + translate([2.6-1,42.81+6.5,-5]) cube([1+3.27,10+57.2,pl_d+10]); + translate([2.6+pl_w-3.27,42.81+6.5,-5]) cube([1+3.27,10+57.2,pl_d+10]); + translate([2.6+pl_w-3.27-11.12,81.3+6.5,-5]) cube([1+3.27+11.12,10+18.51,pl_d+10]); +} } +} +/* + * Keys + */ +module key(x,y, w=1) { + translate([x*(18+0.9), y* (18+0.9),0]) + cube([w*(18+0.9)-0.9,18,12.5]); +} +//Keys +module keys() { +translate([15.55, 9.98,18.5+1.8]) { +//translate([15,10,18.5+1.8]) { + union() { + translate ([4.08,0,0]) { + for(i=[0:1:14]) key(i,4); + } + + translate([-4.86,0,0]) { + for(i=[0:1:15]) key(i,3); + } + + for(i=[0:1:13]) key(i,2); + key(14,2,1.5); + + key(0,1,1.5); + for(i=[1.5:1:11.5]) key(i,1); + key(12.5,1,1.5); + key(14,1); + + key(0,0,1.5); + key(2.5,0,8); + } +} +} +module switches() { +translate([p_w - 12.23 - 82.8 ,12.5, 13.08]) +union() { + translate([0,0,0]) cube([17.4,9.33,13]); + translate([32.78,0,0]) cube([17.4,9.33,13]); + translate([65.6,0,0]) cube([17.4,9.33,13]); +} +} +/* + * Leds + */ +module led() { + translate([6.04/2, 2.93/2,0]) + cylinder(7.47, d=2.93, false, $fn=25); + cube([6.04,2.93,2.4]); +} +module leds() { +translate([11.11+2.71, 52.23+(6.04-2.93)/2, 13.08]) rotate([0,0,90])led(); +translate([p_w-16.85-6.08,6.5,13.8]) led(); +} +/* + * Connectors + */ +module f_header(x, y) { + translate([x*2.56, y*4, 0]) { + difference() { + cube([2.56,4,4.5]); + translate([2.54/2-1/2, 4/2-0.4/2, 4.5-4]) + cube([1,0.4,4+1]); + } + } +} + translate([p_w - 121.5, p_h - 5.6, 1.8]) { + for(i=[0:1:11]) f_header(i,0); + for(i=[13:1:24]) f_header(i,0); + + } +/* + * Fin. + */ +module keyboard() { + pcb(); + plate(); + keys(); + switches(); + leds(); +} +//keyboard(); diff --git a/bottom-2d.scad b/bottom-2d.scad new file mode 100644 index 0000000..c3045ed --- /dev/null +++ b/bottom-2d.scad @@ -0,0 +1,7 @@ +include +difference() { +projection(cut=true) translate([0,0,1.8]) bottom(); +projection(cut=true) translate([0,0,-1]) bottom(); +projection(cut=true) translate([0,0,-0.2]) bottom(); +} +//bottom(); diff --git a/bottom-2d.svg b/bottom-2d.svg new file mode 100644 index 0000000..b28fc80 --- /dev/null +++ b/bottom-2d.svg @@ -0,0 +1,86 @@ + + + +OpenSCAD Model + + diff --git a/bottom.stl b/bottom.stl new file mode 100644 index 0000000..71d5b8d Binary files /dev/null and b/bottom.stl differ 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 +//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(); + diff --git a/left.stl b/left.stl new file mode 100644 index 0000000..916c37f Binary files /dev/null and b/left.stl differ diff --git a/right.stl b/right.stl new file mode 100644 index 0000000..0a27b4b Binary files /dev/null and b/right.stl differ -- cgit v1.1