summaryrefslogtreecommitdiff
path: root/case.scad
blob: 930dd1ad469b0bea9fc19aba6634ab2ce6ca7d4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
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();