From 771e4f8c0ef6788da009b191d25ecf890003d3c7 Mon Sep 17 00:00:00 2001 From: Bob - Home - Windows Date: Tue, 24 Oct 2017 22:56:35 -0400 Subject: [PATCH] rounded cherry keystem and tweaked numbers. also nice color scheme --- key.scad | 14 +++++++------- keys.scad | 7 +++---- stems.scad | 57 +++++++++++++++++++++++++++--------------------------- util.scad | 12 ++++++++---- 4 files changed, 47 insertions(+), 43 deletions(-) diff --git a/key.scad b/key.scad index f9bf66a..ef78973 100644 --- a/key.scad +++ b/key.scad @@ -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); } } diff --git a/keys.scad b/keys.scad index cd9f897..18cc1a5 100644 --- a/keys.scad +++ b/keys.scad @@ -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() { +}; diff --git a/stems.scad b/stems.scad index 567bb2f..9d87a08 100644 --- a/stems.scad +++ b/stems.scad @@ -1,4 +1,5 @@ -// TODO uh what +include + 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 - cross_depth = 4; +module cherry_stem(has_brim, slop = 0.3) { - total_stem_width = cross_length + 2.10; - total_stem_height = cross_length + 0.5; - total_cross_height = cross_length + 0; + stem_width = 7.2 - slop * 2; + stem_height = 5.5 - slop * 2; - 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); + vertical_cross_width = 1.25; + vertical_cross_length = 3.93; - // 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); + horizontal_cross_width = 1.15; + horizontal_cross_length = 4.03; + + cross_depth = 4; + + stem = [stem_width, stem_height]; + vertical_cross = [vertical_cross_width, vertical_cross_length + slop + 12]; + horizontal_cross = [horizontal_cross_length + slop, horizontal_cross_width]; + + translate([0,0,stem_inset]) { + brim(has_brim); + 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); } } - - } - - //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 ); + // 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]) linear_extrude(height=(stem_depth - cross_depth), scale = [6,8]){ + roundedSquare([stem_width, stem_height], 1, center=true); } } } diff --git a/util.scad b/util.scad index 130140f..7dc2a0e 100644 --- a/util.scad +++ b/util.scad @@ -2,14 +2,18 @@ $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) { x = size[0]; y = size[1];