From dfbd88e0654a2db648ae48ac8a2f168927e71008 Mon Sep 17 00:00:00 2001 From: Bob Date: Wed, 30 Sep 2020 01:35:09 -0400 Subject: [PATCH] Update choc for prime time mostly just tweaks --- customizer.scad | 65 ++++++++++++++++++++++++------------ src/key_transformations.scad | 34 +++++++++++++------ src/stems/choc.scad | 17 ++++++++-- src/supports/flared.scad | 20 ----------- 4 files changed, 82 insertions(+), 54 deletions(-) diff --git a/customizer.scad b/customizer.scad index 682c6c4..468de64 100644 --- a/customizer.scad +++ b/customizer.scad @@ -861,12 +861,34 @@ module box_cherry(slop) { children(); } -module choc(slop) { - $stem_slop = slop ? slop : $stem_slop; +module choc(slop = 0.05) { + echo("WARN:\n\n * choc support is experimental.\n * $stem_slop is overridden.\n * it is also recommended to print them upside down if you can\n\n"); + $stem_throw = 3; + $stem_slop = slop; + + $bottom_key_width = 18; + $bottom_key_height = 17; + $stem_type = "choc"; children(); } +// a hacky way to make "low profile" keycaps +module low_profile() { + $width_difference = $width_difference / 1.5; + $height_difference = $height_difference / 1.5; + // helps tilted keycaps not have holes if worst comes to worst + $inner_shape_type = "dished"; + + $top_tilt = $top_tilt / 1.25; + + $total_depth = ($total_depth / 2) < 7 ? 7 : $total_depth / 2; + + // just to make sure + $stem_throw = 3; + children(); +} + module flared_support() { $support_type = "flared"; children(); @@ -934,14 +956,6 @@ module debug() { %children(); } - -module low_profile() { - /* $total_depth = 5.35; */ - /* extra ugly hack right now to make sure we don't generate keycaps with insufficient throw */ - /* $total_depth = ($total_depth / 2) < 6 ? 6 : $total_depth / 2; */ - $stem_throw = 3; - children(); -} module arrows(profile, rows = [4,4,4,3]) { positions = [[0, 0], [1, 0], [2, 0], [1, 1]]; legends = ["←", "↓", "→", "↑"]; @@ -2095,11 +2109,21 @@ module cherry_stabilizer_stem(depth, slop) { inside_cherry_stabilizer_cross(slop); } } +separation = 5.7; + +positions = [ + [separation/2, 0], + [-separation/2, 0], +]; + module choc_stem(depth, slop){ - echo("slop"); - echo(slop); - translate([-5.7/2, 0, depth/2]) cube([1.2 - slop/2, 3 - slop/2, depth], center=true); - translate([5.7/2, 0, depth/2]) cube([1.2 - slop/2, 3 - slop/2, depth], center=true); + for (position=positions) { + translate([position.x,position.y, depth/2]) single_choc_stem(depth, slop); + } +} + +module single_choc_stem(depth, slop) { + cube([$choc_stem.x - slop, $choc_stem.y - slop, depth], center=true); } @@ -2617,7 +2641,7 @@ module tines_support(stem_type, stem_support_height, slop) { } else if (stem_type == "alps"){ centered_tines(stem_support_height); } else if (stem_type == "choc"){ - if ($key_length < 2) translate([0,0,$stem_support_height / 2]) cube([total_key_width($wall_thickness)+$wall_thickness/4, 0.5, $stem_support_height], center = true); + if ($key_length < 2) translate([0,0,$stem_support_height / 2]) cube([total_key_width($wall_thickness)+$wall_thickness/4, 0.42, $stem_support_height], center = true); /* translate([-5.7/2,0,$stem_support_height / 2]) cube([0.5, total_key_height($wall_thickness), $stem_support_height], center = true); */ /* translate([5.7/2,0,$stem_support_height / 2]) cube([0.5, total_key_height($wall_thickness), $stem_support_height], center = true); */ } @@ -2974,14 +2998,13 @@ module flared(stem_type, loft, height) { } } } else if (stem_type == "choc") { - alps_scale = [scale_for_45(height, $choc_stem[0]), scale_for_45(height, $choc_stem[1])]; - translate([-5.7/2,0,0]) linear_extrude(height=height, scale = alps_scale){ - square($choc_stem - [$stem_slop/2, $stem_slop/2], center=true); + // single support, just the stem + new_choc_scale = [scale_for_45(height, $choc_stem[0] + 5.7 - $stem_slop), scale_for_45(height, $choc_stem[1])]; + translate([0,0,0]) linear_extrude(height=height, scale = new_choc_scale){ + // TODO make a choc_stem() function so it can build in the slop + square([$choc_stem[0] + 5.7 - $stem_slop, $choc_stem[1] - $stem_slop], center=true); } - translate([5.7/2,0,0]) linear_extrude(height=height, scale = alps_scale){ - square($choc_stem - [$stem_slop/2, $stem_slop/2], center=true); - } } else { // always render cherry if no stem type. this includes stem_type = false! // this avoids a bug where the keycap is rendered filled when not desired diff --git a/src/key_transformations.scad b/src/key_transformations.scad index f008e21..34c2eeb 100644 --- a/src/key_transformations.scad +++ b/src/key_transformations.scad @@ -109,12 +109,34 @@ module box_cherry(slop) { children(); } -module choc(slop) { - $stem_slop = slop ? slop : $stem_slop; +module choc(slop = 0.05) { + echo("WARN:\n\n * choc support is experimental.\n * $stem_slop is overridden.\n * it is also recommended to print them upside down if you can\n\n"); + $stem_throw = 3; + $stem_slop = slop; + + $bottom_key_width = 18; + $bottom_key_height = 17; + $stem_type = "choc"; children(); } +// a hacky way to make "low profile" keycaps +module low_profile() { + $width_difference = $width_difference / 1.5; + $height_difference = $height_difference / 1.5; + // helps tilted keycaps not have holes if worst comes to worst + $inner_shape_type = "dished"; + + $top_tilt = $top_tilt / 1.25; + + $total_depth = ($total_depth / 2) < 7 ? 7 : $total_depth / 2; + + // just to make sure + $stem_throw = 3; + children(); +} + module flared_support() { $support_type = "flared"; children(); @@ -182,11 +204,3 @@ module debug() { %children(); } - -module low_profile() { - /* $total_depth = 5.35; */ - /* extra ugly hack right now to make sure we don't generate keycaps with insufficient throw */ - /* $total_depth = ($total_depth / 2) < 6 ? 6 : $total_depth / 2; */ - $stem_throw = 3; - children(); -} diff --git a/src/stems/choc.scad b/src/stems/choc.scad index 84bf2c4..1cd5316 100644 --- a/src/stems/choc.scad +++ b/src/stems/choc.scad @@ -1,5 +1,16 @@ -module choc_stem(depth, slop){ +separation = 5.7; - translate([-5.7/2, 0, depth/2]) cube([1.2 - slop, 3 - slop / 2, depth], center=true); - translate([5.7/2, 0, depth/2]) cube([1.2 - slop, 3 - slop / 2, depth], center=true); +positions = [ + [separation/2, 0], + [-separation/2, 0], +]; + +module choc_stem(depth, slop){ + for (position=positions) { + translate([position.x,position.y, depth/2]) single_choc_stem(depth, slop); + } +} + +module single_choc_stem(depth, slop) { + cube([$choc_stem.x - slop, $choc_stem.y - slop, depth], center=true); } diff --git a/src/supports/flared.scad b/src/supports/flared.scad index 05695fe..85b8283 100644 --- a/src/supports/flared.scad +++ b/src/supports/flared.scad @@ -41,26 +41,6 @@ module flared(stem_type, loft, height) { } } } else if (stem_type == "choc") { - choc_scale = [scale_for_45(height, $choc_stem[0]), scale_for_45(height, $choc_stem[1])]; - // double support - /* - translate([-5.7/2,0,0]) linear_extrude(height=height, scale = choc_scale){ - // TODO make a choc_stem() function so it can build in the slop - square($choc_stem - [$stem_slop, $stem_slop], center=true); - } - - translate([5.7/2,0,0]) linear_extrude(height=height, scale = choc_scale){ - square($choc_stem - [$stem_slop, $stem_slop], center=true); - } */ - - // single support, full width - - /* translate([0,0,0]) linear_extrude(height=height, scale = choc_scale){ - // TODO make a choc_stem() function so it can build in the slop - square([total_key_width($wall_thickness), $choc_stem[1] - $stem_slop], center=true); - } */ - - // single support, just the stem new_choc_scale = [scale_for_45(height, $choc_stem[0] + 5.7 - $stem_slop), scale_for_45(height, $choc_stem[1])]; translate([0,0,0]) linear_extrude(height=height, scale = new_choc_scale){