From 70df63e145b2180b9ffc1f3bd3ec65ba9163f2dc Mon Sep 17 00:00:00 2001 From: Bob Date: Fri, 10 Jan 2020 03:07:35 -0500 Subject: [PATCH] upside_down() also g20 fixes --- src/key.scad | 6 ++++-- src/key_profiles/g20.scad | 6 ++++-- src/key_transformations.scad | 9 +++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/key.scad b/src/key.scad index bdb31cf..ed2eaf2 100644 --- a/src/key.scad +++ b/src/key.scad @@ -179,11 +179,13 @@ module inside() { } // put something at the top of the key, with no adjustments for dishing -module top_placement(depth_difference) { +module top_placement(depth_difference=0) { top_tilt_by_height = -$top_tilt / $key_height; top_tilt_y_by_length = $double_sculpted ? (-$top_tilt_y / $key_length) : 0; - translate([$top_skew_x + $dish_skew_x, $top_skew + $dish_skew_y, $total_depth - depth_difference]){ + minkowski_height = $rounded_key ? $minkowski_radius : 0; + + translate([$top_skew_x + $dish_skew_x, $top_skew + $dish_skew_y, $total_depth - depth_difference + minkowski_height/2]){ rotate([top_tilt_by_height, top_tilt_y_by_length,0]){ children(); } diff --git a/src/key_profiles/g20.scad b/src/key_profiles/g20.scad index 66c5ed3..27e7d69 100644 --- a/src/key_profiles/g20.scad +++ b/src/key_profiles/g20.scad @@ -16,8 +16,10 @@ module g20_row(row=3, column = 0) { //also, $rounded_key = true; - $top_tilt_y = column * 3 * $double_sculpt_modifier; - $total_depth = 6 + abs((row-3) * 0.5); + $top_tilt_y = side_tilt(column); + extra_height = extra_side_tilt_height(column); + + $total_depth = 6 + abs((row-3) * 0.5) + extra_height; if (row == 5 || row == 0) { diff --git a/src/key_transformations.scad b/src/key_transformations.scad index fb8b126..10ab530 100644 --- a/src/key_transformations.scad +++ b/src/key_transformations.scad @@ -131,3 +131,12 @@ module bump(depth=undef) { $key_bump_depth = depth == undef ? $key_bump_depth : depth; children(); } + +// kinda dirty, but it works +// might not work great with fully sculpted profiles yet +module upside_down() { + // $top_tilt*2 because top_placement rotates by top_tilt for us + top_placement() rotate([180+$top_tilt*2,0,0]) { + children(); + } +}