10 Commits

Author SHA1 Message Date
Bob
0fc43fa0d7 use inside() to avoid stems protruding out the sides 2022-02-21 12:38:53 -05:00
Bob
fbcf9b2c63 Merge pull request #47 from asdacap/master
Ensure stem does not come out of the key
2022-02-21 12:36:55 -05:00
Bob
edfc02e27b Merge pull request #132 from rsheldiii/v1/g20-spacebar-fix
V1: Fix g20 spacebar having closed bottom
2022-02-19 20:31:43 -05:00
Bob
65bb577473 fix g20 spacebar having closed bottom 2022-02-19 20:30:15 -05:00
Bob
bf4ee0426a Merge pull request #131 from rsheldiii/v1/side-sculpting-scope-fix
V1: Fix lexical scope bug in sculpted_square
2022-02-19 20:14:40 -05:00
Bob
42361f5c25 fix lexical scope bug in sculpted_square 2022-02-19 20:13:13 -05:00
Bob
7edecd7d67 Merge pull request #130 from rsheldiii/v1/stem-slop-fix
V1 stem slop fix
2022-02-19 20:05:04 -05:00
Bob
160c47150d backport stem slop fix 2022-02-19 20:03:54 -05:00
Bob
a1ec4c3cac Merge pull request #129 from rsheldiii/v1/tines-support-fix
V1/tines support fix
2022-02-19 19:49:56 -05:00
Muhammad Amirul Ashraf
d62afcd878 Ensure stem does not come out of the key 2020-05-31 09:48:38 +08:00
5 changed files with 52 additions and 62 deletions

View File

@@ -788,8 +788,8 @@ function add_rounding(p, radius)=[for(i=[0:len(p)-1])[p[i].x,p[i].y, radius]];
function unit_length(length) = unit * (length - 1) + 18.16;
module spacebar() {
$inverted_dish = true;
$dish_type = "sideways cylindrical";
$inverted_dish = $dish_type != "disable";
$dish_type = $dish_type != "disable" ? "sideways cylindrical" : "disable";
6_25u() stabilized(mm=50) children();
}
@@ -941,26 +941,26 @@ module blank() {
children();
}
module cherry(slop) {
$stem_slop = slop ? slop : $stem_slop;
module cherry(slop = undef) {
$stem_slop = slop != undef ? slop : $stem_slop;
$stem_type = "cherry";
children();
}
module alps(slop) {
$stem_slop = slop ? slop : $stem_slop;
module alps(slop = undef) {
$stem_slop = slop != undef ? slop : $stem_slop;
$stem_type = "alps";
children();
}
module rounded_cherry(slop) {
$stem_slop = slop ? slop : $stem_slop;
module rounded_cherry(slop = undef) {
$stem_slop = slop != undef ? slop : $stem_slop;
$stem_type = "rounded_cherry";
children();
}
module box_cherry(slop) {
$stem_slop = slop ? slop : $stem_slop;
module box_cherry(slop = undef) {
$stem_slop = slop != undef ? slop : $stem_slop;
$stem_type = "box_cherry";
children();
}
@@ -1960,18 +1960,18 @@ function skin_iso_enter_shape(size, delta, progress, thickness_difference) =
// rounded square shape with additional sculpting functions to better approximate
// When sculpting sides, how much in should the tops come
$side_sculpting_factor = 4.5;
side_sculpting_factor = 4.5;
// When sculpting corners, how much extra radius should be added
$corner_sculpting_factor = 1;
corner_sculpting_factor = 1;
// When doing more side sculpting corners, how much extra radius should be added
$more_side_sculpting_factor = 0.4;
more_side_sculpting_factor = 0.4;
// side sculpting functions
// bows the sides out on stuff like SA and DSA keycaps
function side_sculpting(progress) = (1 - progress) * $side_sculpting_factor;
function side_sculpting(progress) = (1 - progress) * side_sculpting_factor;
// makes the rounded corners of the keycap grow larger as they move upwards
function corner_sculpting(progress) = pow(progress, 2) * $corner_sculpting_factor;
function corner_sculpting(progress) = pow(progress, 2) * corner_sculpting_factor;
module sculpted_square_shape(size, delta, progress) {
width = size[0];
@@ -1996,7 +1996,7 @@ module sculpted_square_shape(size, delta, progress) {
offset(r = extra_corner_radius_this_slice, $fa=360/$shape_facets) {
offset(r = -extra_corner_radius_this_slice) {
side_rounded_square(square_size, r = $more_side_sculpting_factor * progress);
side_rounded_square(square_size, r = more_side_sculpting_factor * progress);
}
}
}
@@ -2051,7 +2051,7 @@ function skin_sculpted_square_shape(size, delta, progress, thickness_difference)
width - extra_width_this_slice - thickness_difference,
height - extra_height_this_slice - thickness_difference
]
) new_side_rounded_square(square_size, $more_side_sculpting_factor * progress, extra_corner_radius_this_slice);
) new_side_rounded_square(square_size, more_side_sculpting_factor * progress, extra_corner_radius_this_slice);
module side_rounded_square(size, r) {
@@ -5991,20 +5991,9 @@ module key(inset = false) {
if ($clearance_check) %clearance_check();
}
// both stem and support are optional
if ($stem_type != "disable" || ($stabilizers != [] && $stabilizer_type != "disable")) {
dished($keytop_thickness, $inverted_dish) {
translate([0, 0, $stem_inset]) {
if ($stabilizer_type != "disable") stems_for($stabilizers, $stabilizer_type);
if ($stem_type != "disable") stems_for($stem_positions, $stem_type);
}
}
}
if ($support_type != "disable"){
inside() {
translate([0, 0, $stem_inset]) {
inside() {
translate([0, 0, $stem_inset]) {
if ($support_type != "disable"){
if ($stabilizer_type != "disable") support_for($stabilizers, $stabilizer_type);
// always render stem support even if there isn't a stem.
@@ -6012,6 +6001,12 @@ module key(inset = false) {
// so if you want a hollow keycap you'll have to turn support off entirely
support_for($stem_positions, $stem_type);
}
if ($stem_type != "disable" || ($stabilizers != [] && $stabilizer_type != "disable")) {
if ($stabilizer_type != "disable") stems_for($stabilizers, $stabilizer_type);
if ($stem_type != "disable") stems_for($stem_positions, $stem_type);
}
}
}
}

View File

@@ -399,20 +399,9 @@ module key(inset = false) {
if ($clearance_check) %clearance_check();
}
// both stem and support are optional
if ($stem_type != "disable" || ($stabilizers != [] && $stabilizer_type != "disable")) {
dished($keytop_thickness, $inverted_dish) {
translate([0, 0, $stem_inset]) {
if ($stabilizer_type != "disable") stems_for($stabilizers, $stabilizer_type);
if ($stem_type != "disable") stems_for($stem_positions, $stem_type);
}
}
}
if ($support_type != "disable"){
inside() {
translate([0, 0, $stem_inset]) {
inside() {
translate([0, 0, $stem_inset]) {
if ($support_type != "disable"){
if ($stabilizer_type != "disable") support_for($stabilizers, $stabilizer_type);
// always render stem support even if there isn't a stem.
@@ -420,6 +409,12 @@ module key(inset = false) {
// so if you want a hollow keycap you'll have to turn support off entirely
support_for($stem_positions, $stem_type);
}
if ($stem_type != "disable" || ($stabilizers != [] && $stabilizer_type != "disable")) {
if ($stabilizer_type != "disable") stems_for($stabilizers, $stabilizer_type);
if ($stem_type != "disable") stems_for($stem_positions, $stem_type);
}
}
}
}

View File

@@ -92,26 +92,26 @@ module blank() {
children();
}
module cherry(slop) {
$stem_slop = slop ? slop : $stem_slop;
module cherry(slop = undef) {
$stem_slop = slop != undef ? slop : $stem_slop;
$stem_type = "cherry";
children();
}
module alps(slop) {
$stem_slop = slop ? slop : $stem_slop;
module alps(slop = undef) {
$stem_slop = slop != undef ? slop : $stem_slop;
$stem_type = "alps";
children();
}
module rounded_cherry(slop) {
$stem_slop = slop ? slop : $stem_slop;
module rounded_cherry(slop = undef) {
$stem_slop = slop != undef ? slop : $stem_slop;
$stem_type = "rounded_cherry";
children();
}
module box_cherry(slop) {
$stem_slop = slop ? slop : $stem_slop;
module box_cherry(slop = undef) {
$stem_slop = slop != undef ? slop : $stem_slop;
$stem_type = "box_cherry";
children();
}

View File

@@ -1,8 +1,8 @@
include <functions.scad>
module spacebar() {
$inverted_dish = true;
$dish_type = "sideways cylindrical";
$inverted_dish = $dish_type != "disable";
$dish_type = $dish_type != "disable" ? "sideways cylindrical" : "disable";
6_25u() stabilized(mm=50) children();
}

View File

@@ -1,18 +1,18 @@
// rounded square shape with additional sculpting functions to better approximate
// When sculpting sides, how much in should the tops come
$side_sculpting_factor = 4.5;
side_sculpting_factor = 4.5;
// When sculpting corners, how much extra radius should be added
$corner_sculpting_factor = 1;
corner_sculpting_factor = 1;
// When doing more side sculpting corners, how much extra radius should be added
$more_side_sculpting_factor = 0.4;
more_side_sculpting_factor = 0.4;
// side sculpting functions
// bows the sides out on stuff like SA and DSA keycaps
function side_sculpting(progress) = (1 - progress) * $side_sculpting_factor;
function side_sculpting(progress) = (1 - progress) * side_sculpting_factor;
// makes the rounded corners of the keycap grow larger as they move upwards
function corner_sculpting(progress) = pow(progress, 2) * $corner_sculpting_factor;
function corner_sculpting(progress) = pow(progress, 2) * corner_sculpting_factor;
module sculpted_square_shape(size, delta, progress) {
width = size[0];
@@ -37,7 +37,7 @@ module sculpted_square_shape(size, delta, progress) {
offset(r = extra_corner_radius_this_slice, $fa=360/$shape_facets) {
offset(r = -extra_corner_radius_this_slice) {
side_rounded_square(square_size, r = $more_side_sculpting_factor * progress);
side_rounded_square(square_size, r = more_side_sculpting_factor * progress);
}
}
}
@@ -92,7 +92,7 @@ function skin_sculpted_square_shape(size, delta, progress, thickness_difference)
width - extra_width_this_slice - thickness_difference,
height - extra_height_this_slice - thickness_difference
]
) new_side_rounded_square(square_size, $more_side_sculpting_factor * progress, extra_corner_radius_this_slice);
) new_side_rounded_square(square_size, more_side_sculpting_factor * progress, extra_corner_radius_this_slice);
module side_rounded_square(size, r) {