got SA sculpting into variable, futzing with keysets sort of

This commit is contained in:
Bob - Home - Windows 2017-08-16 01:59:19 -04:00
parent 5edb404697
commit b879c854ed
3 changed files with 81 additions and 22 deletions

View File

@ -16,14 +16,12 @@ brim_radius = 8;
brim_depth = .3;
//whether stabilizer connectors are enabled
stabilizers = false;
// stem offset in units NOT MM. for stepped caps lock basically
stem_offset = 0;
// font used for text
font="Arial";
// font size used for text
font_size = 8;
// whether or not to render fake keyswitches to check clearances
clearance_check = true;
clearance_check = false;
/* [Key profile] */
@ -78,9 +76,18 @@ text = "";
inset_text = false;
// radius of corners of keycap
corner_radius = 1;
/* [Fancy Bowed Sides] */
// 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;
enable_side_sculpting = false;
/* [Hidden] */
@ -170,16 +177,19 @@ module shape_hull(thickness_difference, depth_difference, modifier){
module shape_slice(index, total, thickness_difference, depth_difference, modifier) {
progress = index / (total);
extra_side_size = $enable_side_sculpting ? abs(index - total)/4 : 0;
extra_corner_size = $enable_side_sculpting ? pow(progress, 2) : 0;
translate([
0,
$top_skew * progress,
($total_depth * modifier - depth_difference) * progress
]) rotate([-$top_tilt / $key_height * progress,0,0]){
roundedRect([
total_key_width() - thickness_difference - (($width_difference - abs(index - total)/4) * modifier * progress),
total_key_height() - thickness_difference - (($height_difference - abs(index - total)/4) * modifier * progress),
total_key_width() - thickness_difference - (($width_difference - extra_side_size) * progress * modifier),
total_key_height() - thickness_difference - (($height_difference - extra_side_size) * progress * modifier),
.001
],$corner_radius + (pow(progress, 2)));
],$corner_radius + extra_corner_size);
}
}
@ -322,6 +332,7 @@ module example_key(){
$inset_text = inset_text;
$corner_radius = corner_radius;
$height_slices = height_slices;
$enable_side_sculpting = enable_side_sculpting;
key();
}
@ -364,7 +375,8 @@ module fakeISOEnter(thickness_difference = 0){
[unit(1.25) - t, unit(1) - t],
[unit(1.25) - t, unit(2) - t],
[ 0 + t, unit(2) - t]
]
];
offset(r=$corner_radius) {
polygon(points=pointArray);
}
@ -382,6 +394,6 @@ module ISOEnterShapeHull(thickness_difference, depth_difference, modifier){
linear_extrude(height = height, scale = [width_scale, height_scale]) {
// TODO completely making up these numbers here
translate([unit(-.5), unit(-.9)]) fakeISOEnter();
translate([unit(-.5), unit(-.95)]) fakeISOEnter(thickness_difference);
}
}

View File

@ -6,17 +6,13 @@
// special variables, but that's a limitation of SCAD we'll have to work around
/* TODO:
* 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
* 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
* 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 for DCS (rounded tops too intense) [ ] 60% [ ] TKL [ ] full
* Full experimental ISO enter
* can now measure keycaps very accurately. need to redo measurements: [x] SA [ ] DCS [ ] DSA [ ] OEM?
* Pregenerated keysets for DCS (rounded tops too intense) [ ] 60% [ ] TKL [ ] full
* Add inset stem to all profiles that need it (DCS?)
* generate dishes via math? kind of hard
* sideways cylindrical dish needs to be used for some spacebars but not others. currently none of them use it
* customizer version where everything is copy/pasted in
* I probably need to switch to surfaces for dishes don't I
*/
use <key.scad>
@ -114,6 +110,10 @@ module sa_row(n=1) {
$dish_skew_y = 0;
$top_skew = 0;
$height_slices = 10;
$enable_side_sculpting = true;
// might wanna change this if you don't minkowski
// do you even minkowski bro
$corner_radius = 0.01;
if (n == 1){
$total_depth = 14.89;
@ -166,7 +166,9 @@ module fake_iso_enter() {
$dish_skew_y = 0;
$ISOEnter = true;
stabilized(vertical=true) children();
stabilized(vertical=true) {
children();
}
}
module brimmed() {
@ -184,6 +186,11 @@ module inverted() {
children();
}
module rotated() {
$stem_rotation = 90;
children();
}
module stabilized(mm=12, vertical = false) {
if (vertical) {
$connectors = [
@ -361,4 +368,4 @@ module legend(text, inset=false) {
/*
sa_row(1) blank() key();*/
blank() dishless() fake_iso_enter() cherry() key();
/*blank() dishless() rounded() sa_row(1) blank() key();*/

40
keysets.scad Normal file
View File

@ -0,0 +1,40 @@
/*use <key.scad>*/
include <keys.scad>
//TODO duplicate def to not make this a special var. maybe not worth it
unit = 19.05;
// defaults
$bottom_key_width = 18.16;
$bottom_key_height = 18.16;
$width_difference = 6;
$height_difference = 4;
$total_depth = 11.5;
$top_tilt = -6;
$top_skew = 1.7;
$dish_type = 0;
$dish_depth = 1;
$dish_skew_x = 0;
$dish_skew_y = 0;
$key_length = 1;
$key_height = 1;
$has_brim = false;
$inverted_dish = false;
$connectors = [[0,0]];
$ISOEnter = false;
$rounded_key = false;
$stem_profile = 0;
$stem_inset = 0;
$stem_rotation = 0;
$text = "";
$inset_text = false;
$corner_radius = 1;
$height_slices = 1;
for (column = [1:15]){
for(row = [1:4]) {
echo(row);
translate_u(column, row) dishless() dcs_row(5-row) blank() key();
}
}