small changes to mold

This commit is contained in:
Bob - Home - Windows 2018-06-03 13:29:51 -04:00
parent 32b6451a7f
commit 4f56815cc6
1 changed files with 60 additions and 41 deletions

View File

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