Created
October 16, 2015 15:13
-
-
Save ryaninvents/bc7d2e3dccce7003cd85 to your computer and use it in GitHub Desktop.
Keyboard switch plate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mounting plate thickness | |
THICKNESS = 1.4*2; | |
// measured from Gateron switch and DSA keycap | |
SWITCH_WIDTH = 14; | |
SWITCH_LIP_WIDTH = 15.65; | |
SWITCH_LIP_THICKNESS = 0.95; | |
SWITCH_CLIP_WIDTH = 3.8; | |
SWITCH_CLIP_GAP = 1.4; | |
SWITCH_CLIP_DEPTH = 0.7; | |
SWITCH_CLIP_LENGTH = 4; | |
KEYCAP_WIDTH = 18.5; | |
KEYCAP_HEIGHT = 8; | |
KEYCAP_ANGLE = 30; | |
KEY_GAP = 2; | |
// keyboard width and height, in 1-key "units" | |
KBD_WIDTH_UNITS = 13; | |
KBD_HEIGHT_UNITS = 4; | |
// number of keys in bottom row, and number of keys skipped | |
// on the left-hand side | |
KBD_BOTROW_WIDTH = 6; | |
KBD_BOTROW_START = 2; | |
// size of 1 key "unit" | |
KEY_UNIT = KEYCAP_WIDTH + KEY_GAP; | |
// various calculated values | |
KBD_WIDTH = KBD_WIDTH_UNITS * KEY_UNIT + KEY_GAP; | |
KBD_HEIGHT = KBD_HEIGHT_UNITS * KEY_UNIT + KEY_GAP; | |
module switch() { | |
union() { | |
translate([0,0,-SWITCH_WIDTH/4 + SWITCH_LIP_THICKNESS]) | |
cube([SWITCH_WIDTH,SWITCH_WIDTH,SWITCH_WIDTH/2], center=true); | |
translate([0,0,SWITCH_LIP_THICKNESS/2]) cube([SWITCH_LIP_WIDTH,SWITCH_LIP_WIDTH,SWITCH_LIP_THICKNESS],center=true); | |
translate([0, -(SWITCH_WIDTH + SWITCH_CLIP_DEPTH) / 2, -SWITCH_CLIP_GAP - SWITCH_CLIP_LENGTH / 2]) | |
cube([SWITCH_CLIP_WIDTH, SWITCH_CLIP_DEPTH, SWITCH_CLIP_LENGTH], center=true); | |
} | |
} | |
module keyPlate() { | |
color([135/255,206/255,235/255,1.0]) | |
translate([-KBD_WIDTH/2, -KBD_HEIGHT/2, 0]) difference() { | |
translate([0,0,-THICKNESS]) cube([KBD_WIDTH, KBD_HEIGHT, THICKNESS]); | |
translate([(KEY_UNIT+KEY_GAP)/2,3.5*KEY_UNIT + .5*KEY_GAP,0]) | |
for (x = [0:KBD_WIDTH_UNITS - 1]) | |
for (y = [0:KBD_HEIGHT_UNITS - 2]) | |
translate([x*KEY_UNIT,-y*KEY_UNIT,0]) switch(); | |
for (x = [0:KBD_BOTROW_WIDTH - 1]) | |
translate([(x + KBD_BOTROW_START + .5)*KEY_UNIT + KEY_GAP/2, (KEY_UNIT + KEY_GAP)/2, 0]) switch(); | |
translate([(KBD_BOTROW_START * KEY_UNIT),KEY_UNIT,0]) | |
scale([-1,-1, 1]) | |
translate([0,0,-THICKNESS*1.5]) | |
cube([KBD_WIDTH, KBD_HEIGHT, THICKNESS * 4]); | |
translate([(KBD_BOTROW_START + KBD_BOTROW_WIDTH)*KEY_UNIT + KEY_GAP/2,KEY_UNIT, 0]) | |
scale([1,-1,1]) | |
translate([0,0,-THICKNESS*1.5]) | |
cube([KBD_WIDTH, KBD_HEIGHT, THICKNESS * 4]); | |
} | |
} | |
module keyCap() { | |
color([228/255,222/255,221/255,1.0]) intersection() { | |
translate([0,0,KEYCAP_HEIGHT / 2]) | |
cube([KEYCAP_WIDTH,KEYCAP_WIDTH,KEYCAP_HEIGHT],center=true); | |
intersection_for(a=[0:90:359]) { | |
rotate([0,0,a]) | |
translate([-KEYCAP_WIDTH/2,0,-4]) | |
rotate([0,-KEYCAP_ANGLE,0]) | |
translate([KEYCAP_WIDTH/2,0,0]) | |
cube([KEYCAP_WIDTH,KEYCAP_WIDTH,KEYCAP_HEIGHT * 20], center=true); | |
} | |
} | |
} | |
/* | |
switch(); | |
translate([0,0,1]) keyCap(); | |
/*/ | |
keyPlate(); | |
//*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment