From f9d9197a8456c6e62ad16888483ad6763d8b4837 Mon Sep 17 00:00:00 2001 From: Robert Sheldon Date: Sun, 13 Aug 2017 12:15:42 -0400 Subject: [PATCH] add utility functions for rounded keycaps and flesh out some comments --- keys.scad | 14 +++++++++++--- util.scad | 26 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/keys.scad b/keys.scad index 6439d63..6680441 100644 --- a/keys.scad +++ b/keys.scad @@ -1,10 +1,18 @@ +// 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 +// makes it remain easy to use key.scad like before (except without key profiles) +// without having to rely on this file. Unfortunately that means setting tons of +// special variables, but that's a limitation of SCAD we'll have to work around + /* TODO: - * can now measure keycaps very accurately. need to redo measurements + * can now measure keycaps very accurately. need to redo measurements: [x] SA [ ] DCS [ ] DSA [ ] OEM? + * bowed sides for SA? jebus * sideways cylindrical dish needs to be used for some spacebars but not others. currently none of them use it * Add inset stem to all profiles that need it - * Pregenerated keysets + * Pregenerated keysets for DCS (rounded tops too intense) [ ] 60% [ ] TKL [ ] full * Full experimental ISO enter -* customizer version where everything is copy/pasted in + * customizer version where everything is copy/pasted in */ use diff --git a/util.scad b/util.scad index 36cffa5..5a9c29e 100644 --- a/util.scad +++ b/util.scad @@ -20,3 +20,29 @@ module roundedRect(size, radius) { circle(r=radius); } } + +module functional_scaled_extrude(height = 10, slices=[]) { + nominal_height = height / (len(slices) - 1); + for (index = [0 : len(slices)-2]){ + slice1 = slices[index]; + slice2 = slices[index+1]; + echo(slice2); + hull(){ + translate([0,0,nominal_height * index]) { + scale(slice1) children(); + } + translate([0,0,nominal_height * (index + 1)]) { + scale(slice2) children(); + } + } + } +} + +module progressive_hull() { + for (i = [0 : $children-2]){ + hull(){ + children(i); + children(i+1); + } + } +}