2017-08-12 05:10:48 +00:00
|
|
|
|
2018-02-18 01:34:56 +00:00
|
|
|
include <keys.scad>
|
|
|
|
|
2017-08-12 05:10:48 +00:00
|
|
|
//key unit size
|
2018-02-18 01:34:56 +00:00
|
|
|
unit = 19.05 * 1.5;
|
2017-08-12 05:10:48 +00:00
|
|
|
|
|
|
|
//height of keycap
|
|
|
|
height = 13;
|
|
|
|
|
|
|
|
//minimum mold thickness
|
2018-02-18 01:34:56 +00:00
|
|
|
extra = 12.5;
|
2017-08-12 05:10:48 +00:00
|
|
|
|
|
|
|
//thicknesses of the mold
|
|
|
|
side_thickness = 2;
|
|
|
|
bottom_thickness = 2;
|
|
|
|
|
|
|
|
total_side = unit + extra*2 + side_thickness * 2;
|
|
|
|
|
2018-02-18 01:34:56 +00:00
|
|
|
bottom_box_height = 5;
|
|
|
|
|
2017-08-12 05:10:48 +00:00
|
|
|
function hypo(num) = sqrt(pow(num,2) / 2);
|
|
|
|
|
2018-02-18 01:34:56 +00:00
|
|
|
|
|
|
|
module bottom_box() {
|
2017-08-12 05:10:48 +00:00
|
|
|
difference(){
|
|
|
|
//outer box
|
2018-02-18 01:34:56 +00:00
|
|
|
cube([total_side, total_side, bottom_box_height + bottom_thickness]);
|
2017-08-12 05:10:48 +00:00
|
|
|
|
|
|
|
//inner box
|
2018-02-18 01:34:56 +00:00
|
|
|
translate([ side_thickness, side_thickness, bottom_thickness]) {
|
|
|
|
cube([unit + extra*2, unit + extra*2, bottom_box_height + .02]);
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
}
|
2018-02-18 01:34:56 +00:00
|
|
|
}
|
2017-08-12 05:10:48 +00:00
|
|
|
|
2018-02-18 01:34:56 +00:00
|
|
|
module slanted_box() {
|
|
|
|
translate([total_side / 2, total_side / 2, bottom_box_height + bottom_thickness]) rotate([0,0,45]) difference(){
|
2017-08-12 05:10:48 +00:00
|
|
|
//outer box
|
2018-02-18 01:34:56 +00:00
|
|
|
cylinder(
|
|
|
|
height + extra - bottom_box_height + bottom_thickness * 4,
|
2017-08-12 05:10:48 +00:00
|
|
|
hypo(total_side),
|
|
|
|
hypo(total_side + 3),
|
|
|
|
$fn=4
|
|
|
|
);
|
|
|
|
|
|
|
|
//inner box
|
2018-02-18 01:34:56 +00:00
|
|
|
translate([0,0,-0.01]) cylinder(
|
|
|
|
height + extra - bottom_box_height + .02 + bottom_thickness * 4,
|
2017-08-12 05:10:48 +00:00
|
|
|
hypo(unit + extra*2),
|
|
|
|
hypo(unit + extra*2 + 3),
|
|
|
|
$fn=4
|
|
|
|
);
|
|
|
|
}
|
2018-02-18 01:34:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module platform() {
|
2017-08-12 05:10:48 +00:00
|
|
|
//platform
|
|
|
|
translate([
|
|
|
|
side_thickness + extra,
|
|
|
|
side_thickness + extra,
|
|
|
|
bottom_thickness
|
2018-02-18 01:34:56 +00:00
|
|
|
]) cube([unit, unit, bottom_thickness* 4]);
|
|
|
|
}
|
2017-08-12 05:10:48 +00:00
|
|
|
|
2018-02-18 01:34:56 +00:00
|
|
|
module registration() {
|
|
|
|
positions = [
|
|
|
|
[// bottom left
|
|
|
|
side_thickness + extra / 2,
|
|
|
|
side_thickness + extra / 2,
|
|
|
|
bottom_thickness
|
|
|
|
],
|
|
|
|
[// top left
|
|
|
|
side_thickness + extra / 2,
|
|
|
|
side_thickness + unit + extra * 1.5,
|
|
|
|
bottom_thickness
|
|
|
|
],
|
|
|
|
[// bottom right
|
|
|
|
side_thickness + unit + extra * 1.5,
|
|
|
|
side_thickness + extra / 2,
|
|
|
|
bottom_thickness
|
|
|
|
],
|
|
|
|
[// top right
|
|
|
|
side_thickness + unit + extra * 1.5,
|
|
|
|
side_thickness + unit + extra * 1.5,
|
|
|
|
bottom_thickness
|
|
|
|
]
|
|
|
|
];
|
2017-08-12 05:10:48 +00:00
|
|
|
|
2018-02-18 01:34:56 +00:00
|
|
|
for (position = positions) {
|
|
|
|
translate(position) cylinder(3,extra/3, extra/4, $fn=4);
|
|
|
|
}
|
|
|
|
}
|
2017-08-12 05:10:48 +00:00
|
|
|
|
2018-02-18 01:34:56 +00:00
|
|
|
module key_for_mold(wall_thickness = 20) {
|
2017-08-12 05:10:48 +00:00
|
|
|
translate([
|
2018-02-18 01:34:56 +00:00
|
|
|
29,
|
|
|
|
29,
|
|
|
|
bottom_thickness * 5
|
|
|
|
]) {
|
|
|
|
$wall_thickness = wall_thickness;
|
|
|
|
$support_type = false;
|
|
|
|
key();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module bottom_mold(){
|
|
|
|
bottom_box();
|
|
|
|
slanted_box();
|
|
|
|
platform();
|
|
|
|
registration();
|
|
|
|
/* key_for_mold(); */
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module top_mold(){
|
|
|
|
difference(){
|
|
|
|
//outer box
|
|
|
|
cube([
|
|
|
|
total_side,
|
|
|
|
total_side,
|
|
|
|
height + extra + bottom_thickness,
|
|
|
|
]);
|
|
|
|
|
|
|
|
//inner box
|
|
|
|
translate([
|
|
|
|
side_thickness,
|
|
|
|
side_thickness,
|
|
|
|
0
|
|
|
|
]) {
|
|
|
|
cube([
|
|
|
|
unit + extra*2,
|
|
|
|
unit + extra*2,
|
|
|
|
height + extra + bottom_thickness,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-18 01:34:56 +00:00
|
|
|
module skinner_box() {
|
|
|
|
scale(.99) union() {
|
|
|
|
cube([total_side, total_side, bottom_box_height + bottom_thickness]);
|
|
|
|
translate([total_side / 2, total_side / 2, bottom_box_height + bottom_thickness]) rotate([0,0,45]){
|
|
|
|
//outer box
|
|
|
|
cylinder(
|
|
|
|
height + extra - bottom_box_height,
|
|
|
|
hypo(total_side),
|
|
|
|
hypo(total_side + 3),
|
|
|
|
$fn=4
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
difference() {
|
|
|
|
/* skinner_box(); */
|
|
|
|
|
|
|
|
bottom_mold();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* key_for_mold(0); */
|
2017-08-12 05:10:48 +00:00
|
|
|
|
2018-02-18 01:34:56 +00:00
|
|
|
/* translate([100,0,0]) top_mold(); */
|