small changes to mold

This commit is contained in:
Bob - Home - Windows 2018-06-03 13:29:51 -04:00
parent 32b6451a7f
commit 4f56815cc6

View File

@ -1,22 +1,28 @@
include <keys.scad> include <keys.scad>
//key unit size platform_width = 30;
unit = 19.05 * 1.5; platform_height = 4;
// height difference between bottom and top of platform
platform_slant = 3;
//height of keycap minimum_height = 12;
height = 13;
//minimum mold thickness //minimum mold thickness
extra = 12.5; extra = 9;
//thicknesses of the mold //thicknesses of the mold
side_thickness = 2; side_thickness = 2;
bottom_thickness = 2; bottom_thickness = 2;
total_side = unit + extra*2 + side_thickness * 2;
bottom_box_height = 5; // computed variables
inner_side = platform_width + extra * 2;
total_side = inner_side + side_thickness * 2;
// minimum_height of bottom, non-flared box
bottom_box_height = 5 + bottom_thickness;
function hypo(num) = sqrt(pow(num,2) / 2); function hypo(num) = sqrt(pow(num,2) / 2);
@ -24,30 +30,30 @@ function hypo(num) = sqrt(pow(num,2) / 2);
module bottom_box() { module bottom_box() {
difference(){ difference(){
//outer box //outer box
cube([total_side, total_side, bottom_box_height + bottom_thickness]); cube([total_side, total_side, bottom_box_height]);
//inner box //inner box
translate([ side_thickness, side_thickness, bottom_thickness]) { translate([ side_thickness, side_thickness, bottom_thickness]) {
cube([unit + extra*2, unit + extra*2, bottom_box_height + .02]); cube([inner_side, inner_side, bottom_box_height - bottom_thickness + .02]);
} }
} }
} }
module slanted_box() { module slanted_box() {
translate([total_side / 2, total_side / 2, bottom_box_height + bottom_thickness]) rotate([0,0,45]) difference(){ translate([total_side / 2, total_side / 2, bottom_box_height]) rotate([0,0,45]) difference(){
//outer box //outer box
cylinder( cylinder(
height + extra - bottom_box_height + bottom_thickness * 4, h = minimum_height + extra - bottom_box_height + platform_height,
hypo(total_side), r1 = hypo(total_side),
hypo(total_side + 3), r2 = hypo(total_side + 3),
$fn=4 $fn=4
); );
//inner box //inner box
translate([0,0,-0.01]) cylinder( translate([0,0,-0.01]) cylinder(
height + extra - bottom_box_height + .02 + bottom_thickness * 4, minimum_height + extra - bottom_box_height + .02 + platform_height,
hypo(unit + extra*2), hypo(inner_side),
hypo(unit + extra*2 + 3), hypo(inner_side + 3),
$fn=4 $fn=4
); );
} }
@ -55,51 +61,63 @@ module slanted_box() {
module platform() { module platform() {
//platform //platform
translate([ /* translate([
side_thickness + extra, side_thickness + extra,
side_thickness + extra, side_thickness + extra,
bottom_thickness bottom_thickness
]) cube([unit, unit, bottom_thickness* 4]); ]) cube([platform_width, platform_width, platform_height]); */
translate([
side_thickness + extra + platform_width/2,
side_thickness + extra + platform_width/2,
bottom_thickness
]) rotate([0,0,45]) cylinder(r1=hypo(platform_width), r2=hypo(platform_width) - platform_slant, h=platform_height, $fn=4);
} }
module registration() { module registration() {
positions = [ positions = [
[// bottom left [// bottom left
side_thickness + extra / 2, side_thickness + extra / 2 + 1,
side_thickness + extra / 2, side_thickness + extra / 2 + 1,
bottom_thickness bottom_thickness
], ],
[// top left [// top left
side_thickness + extra / 2, side_thickness + extra / 2 + 1,
side_thickness + unit + extra * 1.5, side_thickness + platform_width + extra * 1.5 - 1,
bottom_thickness bottom_thickness
], ],
[// bottom right [// bottom right
side_thickness + unit + extra * 1.5, side_thickness + platform_width + extra * 1.5 - 1,
side_thickness + extra / 2, side_thickness + extra / 2 + 1,
bottom_thickness bottom_thickness
], ],
[// top right [// top right
side_thickness + unit + extra * 1.5, side_thickness + platform_width + extra * 1.5 - 1,
side_thickness + unit + extra * 1.5, side_thickness + platform_width + extra * 1.5 - 1,
bottom_thickness bottom_thickness
] ]
]; ];
for (position = positions) { for (index = [0:len(positions)-1]) {
translate(position) cylinder(3,extra/3, extra/4, $fn=4); position = positions[index];
translate(position) {
// dont mind the math
rotate([0,0,45 / (index % 2 * 0.5 + 1)]) {
cylinder(platform_height / 2,extra/3, 2, $fn=(index % 2 * 2 + 4));
}
}
} }
} }
module key_for_mold(wall_thickness = 20) { module key_for_mold(wall_thickness = 20) {
translate([ translate([
29, total_side / 2,
29, total_side / 2,
bottom_thickness * 5 platform_height + bottom_thickness
]) { ]) {
$wall_thickness = wall_thickness; $wall_thickness = wall_thickness;
$support_type = false; $support_type = false;
key(); sa_row(1) key();
} }
} }
@ -117,7 +135,7 @@ module top_mold(){
cube([ cube([
total_side, total_side,
total_side, total_side,
height + extra + bottom_thickness, minimum_height + extra + bottom_thickness,
]); ]);
//inner box //inner box
@ -127,21 +145,22 @@ module top_mold(){
0 0
]) { ]) {
cube([ cube([
unit + extra*2, inner_side,
unit + extra*2, inner_side,
height + extra + bottom_thickness, minimum_height + extra + bottom_thickness,
]); ]);
} }
} }
} }
module skinner_box() { // for calculating how much mold material to use!
module difference_box() {
scale(.99) union() { scale(.99) union() {
cube([total_side, total_side, bottom_box_height + bottom_thickness]); 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]){ translate([total_side / 2, total_side / 2, bottom_box_height + bottom_thickness]) rotate([0,0,45]){
//outer box //outer box
cylinder( cylinder(
height + extra - bottom_box_height, minimum_height + extra - bottom_box_height,
hypo(total_side), hypo(total_side),
hypo(total_side + 3), hypo(total_side + 3),
$fn=4 $fn=4
@ -151,11 +170,11 @@ module skinner_box() {
} }
difference() { difference() {
/* skinner_box(); */ /* difference_box(); */
bottom_mold(); /* bottom_mold(); */
} }
/* key_for_mold(0); */ /* key_for_mold(0); */
/* translate([100,0,0]) top_mold(); */ translate([0,0,0]) top_mold();