forked from kekstee/3dprint
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkey_vim.scad
193 lines (173 loc) · 11.4 KB
/
key_vim.scad
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
fudge = 0.1;
module letter_im(h)
{
scale([25.4/90, -25.4/90, 1]) union()
{
linear_extrude(height=h)
polygon([[-84.180606,-83.616245],[-92.321417,-77.256270],[-100.462229,-56.521010],[-94.236902,-50.858018],[-69.096162,-50.858018],[-62.535626,-56.869502],[-55.544105,-78.693799],[-60.955350,-83.616245],[-84.180606,-83.616245]]);
linear_extrude(height=h)
polygon([[-130.248020,-25.156750],[-133.360683,-13.917890],[-115.929770,-13.917890],[-153.473276,83.616245],[-100.079132,83.616245],[-96.583371,73.379299],[-111.284719,73.379299],[-74.124310,-25.156750],[-130.248020,-25.156750]]);
linear_extrude(height=h)
polygon([[39.655499,-24.808258],[28.018928,-12.828853],[8.672529,-12.828853],[-3.682349,-24.459766],[-45.870906,-24.459766],[-49.749763,-13.917890],[-35.814610,-13.917890],[-71.825728,82.570770],[-26.907605,82.570770],[-23.459732,73.379299],[-33.899125,73.379299],[-10.290772,5.815456],[34.244254,5.815456],[7.906335,82.570770],[51.244183,82.570770],[55.123041,74.119844],[44.683647,74.119844],[68.675097,5.466965],[111.246751,5.466965],[84.525735,82.570770],[132.125538,82.570770],[136.004395,73.379299],[123.984726,73.379299],[153.435308,-13.569398],[144.528303,-24.459766],[110.480557,-24.459766],[99.227083,-13.220907],[78.731393,-13.220907],[67.094822,-24.808258],[39.655499,-24.808258]]);
}
scale([25.4/90, -25.4/90, 1]) union()
{
linear_extrude(height=h)
polygon([[-84.563703,-85.315143],[-85.425671,-84.923089],[-93.566483,-78.563115],[-94.093241,-77.822570],[-102.234052,-57.087309],[-102.301316,-56.137837],[-101.803068,-55.301289],[-95.577742,-49.638297],[-94.236902,-49.159121],[-69.096162,-49.159121],[-67.755322,-49.638297],[-61.194786,-55.649780],[-60.715915,-56.390325],[-53.724395,-78.214623],[-53.707693,-79.123815],[-54.203266,-79.913520],[-59.614511,-84.835966],[-60.955350,-85.315143],[-84.180606,-85.315143],[-84.563703,-85.315143]]);
linear_extrude(height=h)
polygon([[-130.631117,-26.855647],[-131.548013,-26.410886],[-132.067731,-25.592365],[-135.180394,-14.353505],[-135.195922,-13.583380],[-134.840142,-12.884418],[-134.184505,-12.396992],[-133.360683,-12.218993],[-118.563562,-12.218993],[-155.245100,83.049946],[-155.322664,83.848928],[-154.993215,84.592928],[-154.328499,85.119922],[-153.473276,85.315143],[-100.079132,85.315143],[-98.957924,84.997652],[-98.259421,84.138983],[-94.763661,73.902037],[-94.708760,73.105454],[-95.055306,72.372201],[-95.728571,71.860395],[-96.583371,71.680402],[-108.650927,71.680402],[-72.352486,-24.590451],[-72.274922,-25.389433],[-72.604371,-26.133433],[-73.269086,-26.660426],[-74.124310,-26.855647],[-130.248020,-26.855647],[-130.631117,-26.855647]]);
linear_extrude(height=h)
polygon([[39.272402,-26.507156],[38.218885,-25.940857],[27.109072,-14.527751],[9.438723,-14.527751],[-2.341509,-25.635926],[-3.682349,-26.158664],[-45.870906,-26.158664],[-46.952886,-25.846181],[-47.642730,-25.026066],[-51.521587,-14.484189],[-51.599151,-13.685208],[-51.269702,-12.941208],[-50.604987,-12.414214],[-49.749763,-12.218993],[-38.448402,-12.218993],[-73.597551,82.004471],[-73.675115,82.803452],[-73.345667,83.547453],[-72.680951,84.074446],[-71.825728,84.269667],[-26.907605,84.269667],[-25.825625,83.957184],[-25.135781,83.137069],[-21.687908,73.945599],[-21.610344,73.146617],[-21.939793,72.402617],[-22.604508,71.875623],[-23.459732,71.680402],[-31.313220,71.680402],[-8.902046,7.514354],[31.658349,7.514354],[6.086625,82.048032],[6.031724,82.844615],[6.378270,83.577868],[7.051534,84.089674],[7.906335,84.269667],[51.244183,84.269667],[52.277731,83.981050],[52.968120,83.224192],[56.846977,74.773266],[56.969688,73.959040],[56.662796,73.186065],[55.996464,72.631071],[55.123041,72.420947],[47.269552,72.420947],[70.063824,7.165862],[108.660846,7.165862],[82.706025,82.048032],[82.651124,82.844615],[82.997670,83.577868],[83.670934,84.089674],[84.525735,84.269667],[132.125538,84.269667],[133.197102,83.975096],[133.897361,83.180631],[137.776218,73.989160],[137.875189,73.177152],[137.550839,72.415308],[136.876451,71.875756],[136.004395,71.680402],[126.570631,71.680402],[155.255019,-13.046661],[155.322664,-13.862804],[154.967696,-14.614874],[146.060691,-25.505242],[145.379417,-25.996751],[144.528303,-26.158664],[110.480557,-26.158664],[109.091830,-25.635926],[98.365114,-14.919804],[79.593361,-14.919804],[68.483548,-25.984418],[67.094822,-26.507156],[39.655499,-26.507156],[39.272402,-26.507156],[39.272402,-26.507156]]);
}
}
module letter_V(h)
{
scale([25.4/90, -25.4/90, 1]) union()
{
linear_extrude(height=h)
polygon([[69.017637,-209.009190],[62.457101,-203.041268],[62.457101,-181.129848],[68.203556,-175.902471],[98.563993,-175.902471],[98.563993,-154.731596],[-102.274609,30.448221],[-102.274609,-175.641102],[-68.897283,-175.641102],[-62.049424,-181.870393],[-62.049424,-204.043182],[-68.370525,-208.486452],[-244.020499,-208.486452],[-249.766954,-203.259075],[-249.766954,-180.607110],[-243.924725,-175.292610],[-213.372739,-175.292610],[-213.372739,204.214933],[-207.626284,209.442309],[-172.908119,209.442309],[247.971823,-185.616679],[247.971823,-203.041268],[241.411287,-209.009190],[69.017637,-209.009190]]);
}
scale([25.4/90, -25.4/90, 1]) union()
{
linear_extrude(height=h)
polygon([[-62.343597,-201.534487],[-51.945256,-206.512943],[-62.617235,-216.220934],[-248.419280,-216.220934],[-257.859894,-207.633093],[-257.859894,-175.148683],[-247.393132,-165.627400],[-242.399187,-175.148683],[-248.966557,-181.122836],[-248.966557,-204.023722],[-244.041033,-208.006481],[-66.721844,-208.006481],[-62.343597,-201.534487]]);
}
scale([25.4/90, -25.4/90, 1]) union()
{
linear_extrude(height=h)
polygon([[248.512266,-202.530170],[257.859894,-207.439541],[257.859894,-176.642221],[-166.113786,217.459209],[-211.126412,217.459209],[-206.825887,209.685807],[-172.347157,209.685807],[247.964989,-185.105581]]);
}
scale([25.4/90, -25.4/90, 1]) union()
{
linear_extrude(height=h)
polygon([[69.017637,-209.009190],[62.457101,-203.041268],[62.457101,-181.129848],[68.203556,-175.902471],[98.563993,-175.902471],[98.563993,-154.731596],[-102.274609,30.448221],[-102.274609,-175.641102],[-68.897283,-175.641102],[-62.049424,-181.870393],[-62.049424,-204.043182],[-68.370525,-208.486452],[-244.020499,-208.486452],[-249.766954,-203.259075],[-249.766954,-180.607110],[-243.924725,-175.292610],[-213.372739,-175.292610],[-213.372739,204.214933],[-207.626284,209.442309],[-172.908119,209.442309],[247.971823,-185.616679],[247.971823,-203.041268],[241.411287,-209.009190],[69.017637,-209.009190]]);
}
scale([25.4/90, -25.4/90, 1]) union()
{
linear_extrude(height=h)
polygon([[98.813328,-175.391652],[89.332167,-166.414894],[64.565038,-166.414894],[70.369831,-175.391652],[98.813328,-175.391652]]);
}
scale([25.4/90, -25.4/90, 1]) union()
{
linear_extrude(height=h)
polygon([[-213.678190,-175.919687],[-213.678190,204.272545],[-208.260386,209.905023],[-212.509055,217.270870],[-224.513813,206.384726],[-224.513813,-166.062862]]);
}
scale([25.4/90, -25.4/90, 1]) union()
{
linear_extrude(height=h)
polygon([[-243.695832,-175.919687],[-246.791731,-166.766912],[-224.346507,-166.766912],[-211.962942,-175.919687],[-243.695832,-175.919687]]);
}
scale([25.4/90, -25.4/90, 1]) union()
{
linear_extrude(height=h)
polygon([[64.625706,-165.639834],[69.551230,-174.849970],[62.436567,-180.824123],[62.436567,-201.235774],[70.645799,-208.703465],[241.944880,-208.703465],[248.512266,-200.737933],[257.816052,-206.712085],[248.238627,-215.424380],[64.078413,-215.424380],[54.911454,-207.085459],[54.911454,-174.352129],[64.420473,-166.199902]]);
linear_extrude(height=h)
polygon([[-84.405862,-9.023895],[-102.295128,30.461464],[99.651713,-153.741321],[99.651713,-175.646525],[-84.405862,-9.023895]]);
}
scale([25.4/90, -25.4/90, 1]) union()
{
linear_extrude(height=h)
polygon([[-62.753511,-202.673958],[-53.852819,-207.954403],[-53.852819,-175.919687],[-64.107958,-166.590896],[-84.037752,-166.590896],[-84.037752,-8.705513],[-102.226124,30.369811],[-102.226124,-175.919687],[-68.945293,-175.919687],[-62.753511,-180.496081],[-62.753511,-202.673958]]);
}
scale([25.4/90, -25.4/90, 1]) union()
{
linear_extrude(height=h)
polygon([[-248.506979,-217.459209],[-64.301437,-217.459209],[-53.078840,-207.250352],[-53.078840,-175.919687],[-61.979517,-166.062862],[-82.102821,-166.062862],[-82.102821,-10.465661],[91.267098,-166.062862],[62.630107,-166.062862],[52.568448,-175.919687],[52.568448,-209.010500],[61.856129,-216.755158],[248.383576,-216.755158],[257.671257,-208.306435],[257.671257,-177.327816],[-164.143932,216.241565],[-212.130248,216.241565],[-226.020089,208.946656],[-226.020089,-167.470977],[-249.280942,-167.470977],[-257.794645,-175.215636],[-257.794645,-208.306435],[-248.506979,-217.459209]]);
}
}
module vim_logo(hV,him)
{
letter_V(hV);
translate([25,-35,0],center=true) letter_im(him);
}
// Row 4 decorated Cherry MX key
// dimensions Cherry MX connector
c_corr = .1; // tolerance
c_horiz = 1.1; // horizontal bar width
c_vert = 1.0; // vertical bar width
c_dia = 4; // cross width
c_depth = 4.5; // connector depth
c_space = 4; // height of hollow inside
c_inset = .75; // distance connector start to keycap base
//cut out size
cut_h=9;
cut_x=1.4;
cut_y=1;
// keycap shape
head_tilt = 3; // rotation of top around x-axis
head_pos = 2.25; // keycap top y-offset
head_height = 11; // z-offset of keycap top from the bottom of the keycap
cutoff = 6.5; // cut keycap here to make room for decoration
// must be bigger than c_space + c_corr
key_scale = [1.0,1.00,1.00]; // overall scale
// stuff
$fn = 64;
// create basic key shape from dxf frames for base and top
module shape()
{
hull()
{
translate([0,0,-c_inset]) linear_extrude(height=.01) import("base.dxf");
rotate([head_tilt,0,0]) translate([0,6.75+head_pos,head_height-c_inset]) linear_extrude(height=.01) import("top.dxf");
}
}
// construct the connector pin
module connector()
{
translate([0,0,c_depth/2-.1]) union()
{
cube([c_vert+c_corr,c_dia+c_corr,c_depth+.1], center=true );
cube([c_dia+c_corr,c_horiz+c_corr,c_depth+.1], center=true );
}
}
// create the hollow key with decoration
module key()
{
difference()
{
// combine basic key shape with decoration
union()
{
difference()
{
shape();
rotate([head_tilt,0,0]) translate([0,0,5+cutoff-c_inset]) cube([100,100,10], center=true);
}
}
// subtract scaled basic shape, cut at minimum required height
difference()
{
scale([.9,.9,.9]) translate([0,0,-1]) shape();
translate([0,0,5+c_space+c_corr]) cube([100,100,10], center=true);
}
}
}
// combine key, pin and connector. cleanup below the key
scale(key_scale) difference()
{
union()
{
difference()
{
union()
{
key();
cylinder( h=c_space+c_corr, r=(c_dia+c_corr+1.5)/2 );
}
translate([0.3,0.5,6.5])
scale([0.09,0.09,1])
translate([-10,0,0],center=true)
{
rotate([0.3,0,0])
rotate(45)
cube(size = [100,100,2], center = true);
}
}
translate([0.3,0.5,5.5])
scale([0.09,0.09,1])
rotate([0.3,0,0])
vim_logo(0.8,1);
}
connector();
translate([0,0,-50-c_inset]) cube([100,100,100], center=true);
}