This commit is contained in:
Robert Sheldon 2018-06-24 20:26:19 -04:00
parent e6b8943cfb
commit 3c59a15160
8 changed files with 46 additions and 34 deletions

View File

@ -185,7 +185,7 @@ module keystem_positions() {
module keystems() {
keystem_positions() {
color(color4) stem($stem_type, $total_depth, $has_brim);
color(color4) stem($stem_type, $total_depth, $has_brim, $stem_slop);
}
}

View File

@ -68,20 +68,20 @@ module blank() {
children();
}
module cherry(slop = 0.3) {
$stem_slop = slop;
module cherry(slop) {
$stem_slop = slop ? slop : $stem_slop;
$stem_type = "cherry";
children();
}
module alps(slop = 0.3) {
$stem_slop = slop;
module alps(slop) {
$stem_slop = slop ? slop : $stem_slop;
$stem_type = "alps";
children();
}
module rounded_cherry(slop = 0.3) {
$stem_slop = slop;
module rounded_cherry(slop) {
$stem_slop = slop ? slop : $stem_slop;
$stem_type = "cherry_rounded";
children();
}

View File

@ -91,17 +91,6 @@ $brim_height = 0.4;
// how far the throw distance of the switch is. determines how far the 'cross' in the cherry switch digs into the stem, and how long the keystem needs to be before supports can start. luckily, alps and cherries have a pretty similar throw. can modify to have stouter keycaps for low profile switches, etc
$stem_throw = 4;
// cherry stem dimensions
$cherry_stem = [7.2 - $stem_slop * 2, 5.5 - $stem_slop * 2];
// .005 purely for aesthetics, to get rid of that ugly crosshatch
$cherry_cross = [
// horizontal tine
[4.03 + $stem_slop, 1.15 + $stem_slop / 3],
// vertical tine
[1.25 + $stem_slop / 3, $cherry_stem[1] + .005],
];
// diameter of the outside of the rounded cherry stem
$rounded_cherry_stem_d = 5.5;

View File

@ -5,13 +5,13 @@ include <stems/filled.scad>
//whole stem, alps or cherry, trimmed to fit
module stem(stem_type, depth, has_brim){
module stem(stem_type, depth, has_brim, slop){
if (stem_type == "alps") {
alps_stem(depth, has_brim);
alps_stem(depth, has_brim, slop);
} else if (stem_type == "cherry_rounded") {
rounded_cherry_stem(depth, has_brim);
rounded_cherry_stem(depth, has_brim, slop);
} else if (stem_type == "cherry") {
cherry_stem(depth, has_brim);
cherry_stem(depth, has_brim, slop);
} else if (stem_type == "filled") {
filled_stem();
} else {

View File

@ -1,4 +1,4 @@
module alps_stem(depth, has_brim){
module alps_stem(depth, has_brim, slop){
if(has_brim) {
linear_extrude(height=$brim_height) {
offset(r=1){

View File

@ -1,10 +1,21 @@
module cherry_stem(depth, has_brim) {
// cherry stem dimensions
function outer_cherry_stem(slop) = [7.2 - slop * 2, 5.5 - slop * 2];
// .005 purely for aesthetics, to get rid of that ugly crosshatch
function cherry_cross(slop) = [
// horizontal tine
[4.03 + slop, 1.15 + slop / 3],
// vertical tine
[1.25 + slop / 3, 5.5 - slop * 2 + .005],
];
module cherry_stem(depth, has_brim, slop) {
difference(){
union() {
// outside shape
linear_extrude(height = depth) {
offset(r=1){
square($cherry_stem - [2,2], center=true);
square(outer_cherry_stem(slop) - [2,2], center=true);
}
}
@ -12,7 +23,7 @@ module cherry_stem(depth, has_brim) {
if(has_brim) {
linear_extrude(height = $brim_height){
offset(r=1){
square($cherry_stem + [2,2], center=true);
square(outer_cherry_stem(slop) + [2,2], center=true);
}
}
}
@ -22,11 +33,11 @@ module cherry_stem(depth, has_brim) {
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = $stem_throw) {
square($cherry_cross[0], center=true);
square($cherry_cross[1], center=true);
square(cherry_cross(slop)[0], center=true);
square(cherry_cross(slop)[1], center=true);
}
// Guides to assist insertion and mitigate first layer squishing
for (i = $cherry_cross) hull() {
for (i = cherry_cross(slop)) hull() {
linear_extrude(height = 0.01, center = false) offset(delta = 0.4) square(i, center=true);
translate([0, 0, 0.5]) linear_extrude(height = 0.01, center = false) square(i, center=true);
}

View File

@ -1,4 +1,12 @@
module rounded_cherry_stem(depth, has_brim) {
// .005 purely for aesthetics, to get rid of that ugly crosshatch
function cherry_cross(slop) = [
// horizontal tine
[4.03 + slop, 1.15 + slop / 3],
// vertical tine
[1.25 + slop / 3, 5.5 - slop * 2 + .005],
];
module rounded_cherry_stem(depth, has_brim, slop) {
difference(){
union(){
cylinder(d=$rounded_cherry_stem_d, h=depth);
@ -11,8 +19,8 @@ module rounded_cherry_stem(depth, has_brim) {
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = $stem_throw) {
square($cherry_cross[0], center=true);
square($cherry_cross[1], center=true);
square(cherry_cross(slop)[0], center=true);
square(cherry_cross(slop)[1], center=true);
}
}
}

View File

@ -1,3 +1,7 @@
// cherry stem dimensions
// don't wanna introduce slop here so $stem_slop it is I guess
function outer_cherry_stem() = [7.2 - $stem_slop * 2, 5.5 - $stem_slop * 2];
// figures out the scale factor needed to make a 45 degree wall
function scale_for_45(height, starting_size) = (height * 2 + starting_size) / starting_size;
@ -6,10 +10,10 @@ function scale_for_45(height, starting_size) = (height * 2 + starting_size) / st
module flared_support(stem_type, loft, height) {
translate([0,0,loft]){
if(stem_type == "cherry") {
cherry_scale = [scale_for_45(height, $cherry_stem[0]), scale_for_45(height, $cherry_stem[1])];
cherry_scale = [scale_for_45(height, outer_cherry_stem()[0]), scale_for_45(height, outer_cherry_stem()[1])];
linear_extrude(height=height, scale = cherry_scale){
offset(r=1){
square($cherry_stem - [2,2], center=true);
square(outer_cherry_stem() - [2,2], center=true);
}
}
} else if (stem_type == "cherry_rounded") {