looks great, but now other profiles rounding is off. need to add option for progressive side rounding

This commit is contained in:
Bob - Home - Windows 2017-08-15 01:59:12 -04:00
parent 0333f1718d
commit f0d1220c63
4 changed files with 126199 additions and 11 deletions

126184
SAtest2.stl Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@
include <util.scad> include <util.scad>
include <stems.scad> include <stems.scad>
include <dishes.scad> include <dishes.scad>
include <libraries/geodesic_sphere.scad>
/* [Settings] */ /* [Settings] */
// keytop thickness, aka how many millimeters between the inside and outside of the top surface of the key // keytop thickness, aka how many millimeters between the inside and outside of the top surface of the key
@ -77,6 +78,9 @@ text = "";
inset_text = false; inset_text = false;
// radius of corners of keycap // radius of corners of keycap
corner_radius = 1; corner_radius = 1;
// if you're doing fancy bowed keycap sides, this controls how many slices you take
// default of 1 for no sampling, just top/bottom
height_slices = 1;
/* [Hidden] */ /* [Hidden] */
@ -155,10 +159,10 @@ module shape_hull(thickness_difference, depth_difference, modifier){
ISOEnterShapeHull(thickness_difference, depth_difference, modifier); ISOEnterShapeHull(thickness_difference, depth_difference, modifier);
} else { } else {
slices = 10; slices = 10;
for (index = [0:slices-1]) { for (index = [0:$height_slices-1]) {
color("red") hull() { color("red") hull() {
shape_slice(index, slices, thickness_difference, depth_difference, modifier); shape_slice(index, $height_slices, thickness_difference, depth_difference, modifier);
shape_slice(index + 1, slices, thickness_difference, depth_difference, modifier); shape_slice(index + 1, $height_slices, thickness_difference, depth_difference, modifier);
} }
} }
} }
@ -173,9 +177,9 @@ module shape_slice(index, total, thickness_difference, depth_difference, modifie
]) rotate([-$top_tilt / $key_height * progress,0,0]){ ]) rotate([-$top_tilt / $key_height * progress,0,0]){
roundedRect([ roundedRect([
total_key_width() - thickness_difference - (($width_difference - abs(index - total)/4) * modifier * progress), total_key_width() - thickness_difference - (($width_difference - abs(index - total)/4) * modifier * progress),
total_key_height() - thickness_difference - ($height_difference * modifier * progress), total_key_height() - thickness_difference - (($height_difference - abs(index - total)/4) * modifier * progress),
.001 .001
],$corner_radius); ],$corner_radius + (pow(progress, 2)));
} }
} }
@ -317,6 +321,7 @@ module example_key(){
$text = text; $text = text;
$inset_text = inset_text; $inset_text = inset_text;
$corner_radius = corner_radius; $corner_radius = corner_radius;
$height_slices = height_slices;
key(); key();
} }

View File

@ -9,6 +9,7 @@
* make SA keycaps get more rounded the further up they are (like in real life) * make SA keycaps get more rounded the further up they are (like in real life)
* make that rounding thing ^ only happen on certain keycaps via limiting the amount of slives we take to 2 * make that rounding thing ^ only happen on certain keycaps via limiting the amount of slives we take to 2
* can now measure keycaps very accurately. need to redo measurements: [x] SA [ ] DCS [ ] DSA [ ] OEM? * can now measure keycaps very accurately. need to redo measurements: [x] SA [ ] DCS [ ] DSA [ ] OEM?
* functions to control bowed edges? and bowed corners
* bowed sides for SA? jebus * bowed sides for SA? jebus
* sideways cylindrical dish needs to be used for some spacebars but not others. currently none of them use it * 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 * Add inset stem to all profiles that need it
@ -47,6 +48,7 @@ $stem_rotation = 0;
$text = ""; $text = "";
$inset_text = false; $inset_text = false;
$corner_radius = 1; $corner_radius = 1;
$height_slices = 1;
// key profile definitions // key profile definitions
@ -111,6 +113,7 @@ module sa_row(n=1) {
$dish_skew_x = 0; $dish_skew_x = 0;
$dish_skew_y = 0; $dish_skew_y = 0;
$top_skew = 0; $top_skew = 0;
$height_slices = 10;
if (n == 1){ if (n == 1){
$total_depth = 14.89; $total_depth = 14.89;

View File

@ -1,14 +1,10 @@
// from https://www.thingiverse.com/thing:1484333 // from https://www.thingiverse.com/thing:1484333
// public domain license // public domain license
$fs = .01;
geodesic_sphere(2);
translate([4, 0, 0])
sphere(2);
// same syntax and semantics as built-in sphere, so should be a drop-in replacement // same syntax and semantics as built-in sphere, so should be a drop-in replacement
// it's a bit slow for large numbers of facets // it's a bit slow for large numbers of facets
module geodesic_sphere(r=-1, d=-1) { module geodesic_sphere(r=-1, d=-1) {
echo(r);
// if neither parameter specified, radius is taken to be 1 // if neither parameter specified, radius is taken to be 1
rad = r > 0 ? r : d > 0 ? d/2 : 1; rad = r > 0 ? r : d > 0 ? d/2 : 1;