front placement
now you can put labels on the front of keycaps!
This commit is contained in:
parent
425ae8af34
commit
f6762031db
29
src/key.scad
29
src/key.scad
|
@ -192,6 +192,25 @@ module top_placement(depth_difference=0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module front_placement() {
|
||||||
|
// all this math is to take top skew and tilt into account
|
||||||
|
// we need to find the new effective height and depth of the top, front lip
|
||||||
|
// of the keycap to find the angle so we can rotate things correctly into place
|
||||||
|
total_depth_difference = sin(-$top_tilt) * (top_total_key_height()/2);
|
||||||
|
total_height_difference = $top_skew + (1 - cos(-$top_tilt)) * (top_total_key_height()/2);
|
||||||
|
|
||||||
|
angle = atan2(($total_depth - total_depth_difference), ($height_difference/2 + total_height_difference));
|
||||||
|
hypotenuse = ($total_depth -total_depth_difference) / sin(angle);
|
||||||
|
|
||||||
|
translate([0,-total_key_height()/2,0]) {
|
||||||
|
rotate([-(90-angle), 0, 0]) {
|
||||||
|
translate([0,0,hypotenuse/2]){
|
||||||
|
children();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// just to DRY up the code
|
// just to DRY up the code
|
||||||
module _dish() {
|
module _dish() {
|
||||||
dish(top_total_key_width() + $dish_overdraw_width, top_total_key_height() + $dish_overdraw_height, $dish_depth, $inverted_dish);
|
dish(top_total_key_width() + $dish_overdraw_width, top_total_key_height() + $dish_overdraw_height, $dish_depth, $inverted_dish);
|
||||||
|
@ -309,6 +328,15 @@ module clearance_check() {
|
||||||
}
|
}
|
||||||
|
|
||||||
module legends(depth) {
|
module legends(depth) {
|
||||||
|
if ($front_print_legends) {
|
||||||
|
front_placement() {
|
||||||
|
if (len($legends) > 0) {
|
||||||
|
for (i=[0:len($legends)-1]) {
|
||||||
|
rotate([90,0,0]) keytext($legends[i][0], $legends[i][1], $legends[i][2], depth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
top_of_key() {
|
top_of_key() {
|
||||||
// outset legend
|
// outset legend
|
||||||
if (len($legends) > 0) {
|
if (len($legends) > 0) {
|
||||||
|
@ -318,6 +346,7 @@ module legends(depth) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// legends / artisan support
|
// legends / artisan support
|
||||||
module artisan(depth) {
|
module artisan(depth) {
|
||||||
|
|
|
@ -151,7 +151,7 @@ $legends = [];
|
||||||
$outset_legends = false;
|
$outset_legends = false;
|
||||||
|
|
||||||
// how recessed inset legends / artisans are from the top of the key
|
// how recessed inset legends / artisans are from the top of the key
|
||||||
$inset_legend_depth = 0.3;
|
$inset_legend_depth = 0.2;
|
||||||
|
|
||||||
// Dimensions of alps stem
|
// Dimensions of alps stem
|
||||||
$alps_stem = [4.45, 2.25];
|
$alps_stem = [4.45, 2.25];
|
||||||
|
|
Loading…
Reference in New Issue