From e404a8f7c691de48d294fb2396e4c977d106f1b9 Mon Sep 17 00:00:00 2001 From: Bob - Home - Windows Date: Sat, 17 Feb 2018 20:34:56 -0500 Subject: [PATCH] update key_mold to make it better! --- key_mold.scad | 139 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 90 insertions(+), 49 deletions(-) diff --git a/key_mold.scad b/key_mold.scad index 0b300c4..67e9bac 100644 --- a/key_mold.scad +++ b/key_mold.scad @@ -1,12 +1,14 @@ +include + //key unit size -unit = 19.05; +unit = 19.05 * 1.5; //height of keycap height = 13; //minimum mold thickness -extra = 15; +extra = 12.5; //thicknesses of the mold side_thickness = 2; @@ -14,81 +16,99 @@ bottom_thickness = 2; total_side = unit + extra*2 + side_thickness * 2; +bottom_box_height = 5; + function hypo(num) = sqrt(pow(num,2) / 2); -module bottom_mold(){ + +module bottom_box() { difference(){ //outer box - cube([ - total_side, - total_side, - 5 + bottom_thickness, - ]); + cube([total_side, total_side, bottom_box_height + bottom_thickness]); //inner box - translate([ - side_thickness, - side_thickness, - bottom_thickness - ]) { - cube([ - unit + extra*2, - unit + extra*2, - 5, - ]); + translate([ side_thickness, side_thickness, bottom_thickness]) { + cube([unit + extra*2, unit + extra*2, bottom_box_height + .02]); } } +} - translate([total_side / 2, total_side / 2, 5 + bottom_thickness]) rotate([0,0,45]) difference(){ +module slanted_box() { + translate([total_side / 2, total_side / 2, bottom_box_height + bottom_thickness]) rotate([0,0,45]) difference(){ //outer box - cylinder( - height + extra - 5, + cylinder( + height + extra - bottom_box_height + bottom_thickness * 4, hypo(total_side), hypo(total_side + 3), $fn=4 ); //inner box - cylinder( - height + extra - 5, + translate([0,0,-0.01]) cylinder( + height + extra - bottom_box_height + .02 + bottom_thickness * 4, hypo(unit + extra*2), hypo(unit + extra*2 + 3), $fn=4 ); } +} + +module platform() { //platform translate([ side_thickness + extra, side_thickness + extra, bottom_thickness - ]) cube([unit, unit, bottom_thickness]); -/* - translate([ - side_thickness + extra + unit / 2, - side_thickness + extra + unit / 2, - bottom_thickness*2 - ]) rotate([0,0,45]) cylinder(bottom_thickness, unit/2 + 1, unit / 2, $fn=4);*/ + ]) cube([unit, unit, bottom_thickness* 4]); +} - //registration - translate([ - side_thickness + extra / 2, - side_thickness + extra / 2, - bottom_thickness - ]) cylinder(3,extra/3, extra/4, $fn=4); +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 + ] + ]; - //registration - translate([ - side_thickness + extra / 2, - side_thickness + unit + extra * 1.5, - bottom_thickness - ]) cylinder(3,extra/3, extra/4, $fn=4); + for (position = positions) { + translate(position) cylinder(3,extra/3, extra/4, $fn=4); + } +} - //registration +module key_for_mold(wall_thickness = 20) { translate([ - side_thickness + unit + extra * 1.5, - side_thickness + unit + extra * 1.5, - bottom_thickness - ]) cylinder(3,extra/3, extra/4, $fn=4); + 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(); */ } module top_mold(){ @@ -115,6 +135,27 @@ module top_mold(){ } } -/*bottom_mold();*/ +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 + ); + } + } +} -translate([50,0,0]) top_mold(); +difference() { + /* skinner_box(); */ + + bottom_mold(); +} + +/* key_for_mold(0); */ + +/* translate([100,0,0]) top_mold(); */