rounded cherry keystem and tweaked numbers. also nice color scheme

This commit is contained in:
Bob - Home - Windows 2017-10-24 22:56:35 -04:00
parent 16f97911ae
commit 771e4f8c0e
4 changed files with 47 additions and 43 deletions

View File

@ -109,11 +109,11 @@ function top_total_key_height() = $bottom_key_height + (unit * ($key_height - 1)
module shape(thickness_difference, depth_difference){
intersection(){
dished(depth_difference, $inverted_dish) {
shape_hull(thickness_difference, depth_difference, 1);
color([.2667,.5882,1]) shape_hull(thickness_difference, depth_difference, 1);
}
if ($inverted_dish) {
// larger shape_hull to clip off bits of the inverted dish
shape_hull(thickness_difference, 0, 1, 2);
color([.5412, .4784, 1]) shape_hull(thickness_difference, 0, 1, 2);
}
}
}
@ -141,7 +141,7 @@ module shape_hull(thickness_difference, depth_difference, modifier, extra_slices
} else {
slices = 10;
for (index = [0:$height_slices - 1 + extra_slices]) {
color("red") hull() {
hull() {
shape_slice(index, $height_slices, thickness_difference, depth_difference, modifier);
shape_slice(index + 1, $height_slices, thickness_difference, depth_difference, modifier);
}
@ -173,14 +173,14 @@ module dished(depth_difference, inverted = false) {
union() {
children();
translate([$dish_skew_x, $top_skew + $dish_skew_y, $total_depth - depth_difference]){
dish(top_total_key_width(), top_total_key_height(), $dish_depth, $inverted_dish, $top_tilt / $key_height);
color([.4078, .3569, .749]) dish(top_total_key_width(), top_total_key_height(), $dish_depth, $inverted_dish, $top_tilt / $key_height);
}
}
} else {
difference() {
children();
translate([$dish_skew_x, $top_skew + $dish_skew_y, $total_depth - depth_difference]){
dish(top_total_key_width(), top_total_key_height(), $dish_depth, $inverted_dish, $top_tilt / $key_height);
color([.4078, .3569, .749]) dish(top_total_key_width(), top_total_key_height(), $dish_depth, $inverted_dish, $top_tilt / $key_height);
}
}
}
@ -213,11 +213,11 @@ module connectors($stem_profile) {
for (connector_pos = $connectors) {
translate([connector_pos[0], connector_pos[1], $stem_inset]) {
rotate([0, 0, $stem_rotation]){
connector($stem_profile, $has_brim);
color([1, .6941, .2]) connector($stem_profile, $has_brim);
}
}
}
// used to be difference of the inside() but really I want intersection
// cut off anything that isn't underneath the keytop
shape(wall_thickness, keytop_thickness);
}
}

View File

@ -412,9 +412,8 @@ module legend(text, inset=false) {
children();
}
/*rows = [4,3,2,1,5];
rows = [4,3,2,1,5];
translate_u(0, 0) oem_row(1) cherry() key() {
cube(2, center=true);
};*/
translate_u(0, 0) dcs_row(1) cherry() key() {
};

View File

@ -1,4 +1,5 @@
// TODO uh what
include <util.scad>
stem_depth = 24;
module brim(has_brim) {
@ -10,39 +11,39 @@ module brim(has_brim) {
if (has_brim) color([0,1,0]) cube([brim_radius, brim_radius, brim_depth]);
}
module cherry_stem(has_brim) {
// the cross is actually a cube with a side length of 4.4
cross_length = 4.4;
// horizontal cross bar width
horizontal_cross_width = 1.4;
// vertical cross bar width
vertical_cross_width = 1.3;
// cross depth, stem height is 3.4mm
module cherry_stem(has_brim, slop = 0.3) {
stem_width = 7.2 - slop * 2;
stem_height = 5.5 - slop * 2;
vertical_cross_width = 1.25;
vertical_cross_length = 3.93;
horizontal_cross_width = 1.15;
horizontal_cross_length = 4.03;
cross_depth = 4;
total_stem_width = cross_length + 2.10;
total_stem_height = cross_length + 0.5;
total_cross_height = cross_length + 0;
stem = [stem_width, stem_height];
vertical_cross = [vertical_cross_width, vertical_cross_length + slop + 12];
horizontal_cross = [horizontal_cross_length + slop, horizontal_cross_width];
difference(){
translate([0,0,stem_inset]) {
brim(has_brim);
translate([0, 0, cross_depth/2]){
cube([total_stem_width, total_stem_height, cross_depth], center=true);
linear_extrude(height = cross_depth) {
difference(){
roundedSquare(stem, 1, center=true);
off = 0;
offset(r = off){
square(vertical_cross + [-off * 2,-off * 2], center=true);
square(horizontal_cross + [-off * 2,-off * 2], center=true);
}
}
}
// flared support
// 6 and 8 are magic numbers I got from trying to make the sides of the flared part of the stem 45 degree overhangs
translate([0,0,cross_depth/2]) linear_extrude(height=(stem_depth - cross_depth), scale = [6,8]){
square([total_stem_width, total_stem_height], center=true);
}
}
}
//the cross part of the steam
translate([0,0,(cross_depth)/2 + stem_inset]){
cube([vertical_cross_width, total_cross_height, cross_depth], center=true );
cube([cross_length, horizontal_cross_width, cross_depth], center=true );
translate([0,0,cross_depth]) linear_extrude(height=(stem_depth - cross_depth), scale = [6,8]){
roundedSquare([stem_width, stem_height], 1, center=true);
}
}
}

View File

@ -2,12 +2,16 @@ $fs=.1;
//centered
// offset, who knew?
module roundedRect(size, radius) {
module roundedRect(size, radius, center=true) {
linear_extrude(height = size[2]){
offset(r=radius){
square([size[0] - radius * 2, size[1] - radius * 2], center=true);
roundedSquare([size[0], size[1]], radius, center=center);
}
}
module roundedSquare(size, radius, center = true) {
offset(r=radius){
square([size[0] - radius * 2, size[1] - radius * 2], center=center);
}
}
module oldroundedRect(size, radius) {