From 45a99ccc56dfd321c7904ab7c96227d10906a677 Mon Sep 17 00:00:00 2001 From: Bob Date: Sat, 5 Sep 2020 22:52:33 -0400 Subject: [PATCH] offset stems example --- keys.scad | 31 ++++++++++++++++++++++++++----- src/key.scad | 4 ++-- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/keys.scad b/keys.scad index 768110e..7bea6b2 100644 --- a/keys.scad +++ b/keys.scad @@ -1,3 +1,4 @@ + // the point of this file is to be a sort of DSL for constructing keycaps. // when you create a method chain you are just changing the parameters // key.scad uses, it doesn't generate anything itself until the end. This @@ -6,15 +7,35 @@ // special variables, but that's a limitation of SCAD we have to work around include <./includes.scad> +include // example key -dcs_row(5) legend("⇪", size=9) key(); +/* $stem_throw = 1; */ +/* $stem_type = "custom"; */ +$outset_legends = true; +/* $hull_shape_type = "linear extrude"; */ +/* dcs_row(5) iso_enter() front_legend("j") key(); */ +$stabilizer_type = "cherry_stabilizer"; +$stem_support_type = "disabled"; + /* $stem_rotation=90; */ + +/* $skin_extrude_shape = true; */ + + +dcs_row(1) spacebar() uh(1.5){ + /* $top_tilt = -6; */ + key(); +} + +/* $rounded_key = true; */ + +/* sa_row(1) key(); */ // example row -/* for (x = [0:1:4]) { - translate_u(0,-x) dcs_row(x) key(); -} */ // example layout -/* preonic_default("dcs"); */ \ No newline at end of file + + +/* %side_rounded_square([10,10], 0.5); */ +/* translate([00,0,0]) polygon(new_side_rounded_square([10,10], 0.5)); */ diff --git a/src/key.scad b/src/key.scad index 65b76a7..b7347cb 100644 --- a/src/key.scad +++ b/src/key.scad @@ -402,7 +402,7 @@ module key(inset = false) { // both stem and support are optional if ($stem_type != "disable" || ($stabilizers != [] && $stabilizer_type != "disable")) { dished($keytop_thickness, $inverted_dish) { - translate([0, 0, $stem_inset]) { + translate([0, (unit_length($key_height) - unit_length(1))/2, $stem_inset]) { if ($stabilizer_type != "disable") stems_for($stabilizers, $stabilizer_type); if ($stem_type != "disable") stems_for($stem_positions, $stem_type); @@ -412,7 +412,7 @@ module key(inset = false) { if ($support_type != "disable"){ inside() { - translate([0, 0, $stem_inset]) { + translate([0, (unit_length($key_height) - unit_length(1))/2, $stem_inset]) { if ($stabilizer_type != "disable") support_for($stabilizers, $stabilizer_type); // always render stem support even if there isn't a stem.