Skip to content

Commit

Permalink
feat: allow setting text alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
jbcpollak committed May 11, 2019
1 parent daf38c5 commit 1536540
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/key.scad
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ module inside() {

// put something at the top of the key, with no adjustments for dishing
module top_placement(depth_difference) {
echo ($dish_skew_x, $top_skew + $dish_skew_y, $total_depth - depth_difference);
translate([$dish_skew_x, $top_skew + $dish_skew_y, $total_depth - depth_difference]){
rotate([-$top_tilt / $key_height,0,0]){
children();
Expand Down Expand Up @@ -174,12 +175,13 @@ module top_of_key(){
}
}

module keytext(text, position, font_size, depth) {
module keytext(text, position, font_size, depth=0.4, halign="center") {
woffset = (top_total_key_width()/3.5) * position[0];
hoffset = (top_total_key_height()/3.5) * -position[1];
translate([woffset, hoffset, -depth]){
echo (woffset, hoffset, -depth, $dish_depth);
linear_extrude(height=$dish_depth){
text(text=text, font=$font, size=font_size, halign="center", valign="center");
text(text=text, font=$font, size=font_size, halign=halign, valign="center");
}
}
}
Expand Down

0 comments on commit 1536540

Please sign in to comment.