1 Commits

Author SHA1 Message Date
Bob
2429384b51 resin settings, some tines support tweaks 2022-02-21 16:02:37 -05:00
9 changed files with 32 additions and 150 deletions

View File

@@ -162,14 +162,12 @@ $double_sculpted = false;
//valign = "top" or "center" or "bottom"
// Currently does not work with thingiverse customizer, and actually breaks it
$legends = [];
$autolegends = [];
//list of front legends to place on a key format: [text, halign, valign, size]
//halign = "left" or "center" or "right"
//valign = "top" or "center" or "bottom"
// Currently does not work with thingiverse customizer, and actually breaks it
$front_legends = [];
$front_autolegends = [];
// print legends on the front of the key instead of the top
$front_print_legends = false;
@@ -177,9 +175,6 @@ $front_print_legends = false;
// how recessed inset legends / artisans are from the top of the key
$inset_legend_depth = 0.2;
// legends are not allowed to print within this many mm of the edge of the key
$legend_margin = 0.8;
// Dimensions of alps stem
$alps_stem = [4.45, 2.25];
@@ -1110,18 +1105,6 @@ module front_legend(text, position=[0,0], size=undef) {
children();
}
module autolegend(texts) {
// $autolegends = [for(L=[$legends, [[text, position, font_size]]], a=L) a];
$autolegends = texts;
children();
}
module front_autolegend(texts) {
font_size = size == undef ? $font_size : size;
$front_autolegends = [for(L=[$front_legends, [[text, position, font_size]]], a=L) a];
children();
}
module bump(depth=undef) {
$key_bump = true;
$key_bump_depth = depth == undef ? $key_bump_depth : depth;
@@ -1147,7 +1130,7 @@ module upside_down() {
module sideways() {
$key_shape_type = "flat_sided_square";
$dish_overdraw_width = abs(extra_keytop_length_for_flat_sides());
extra_y_rotation = atan2($width_difference/2,$total_depth);
extra_y_rotation = atan2($width_difference/2,$total_depth); // TODO assumes centered top
translate([0,0,cos(extra_y_rotation) * total_key_width()/2])
rotate([0,90 + extra_y_rotation ,0]) children();
}
@@ -1175,7 +1158,14 @@ module auto_place() {
translate_u(x,-y) children(child_index);
}
}
module arrows(profile, rows = [4,4,4,3]) {
// suggested settings for resin prints
module resin() {
$stem_slop = 0;
$stem_inner_slop = 0;
$stem_support_type = "disable";
children();
}module arrows(profile, rows = [4,4,4,3]) {
positions = [[0, 0], [1, 0], [2, 0], [1, 1]];
legends = ["←", "↓", "→", "↑"];
@@ -3325,7 +3315,7 @@ function unit_length(length) = $unit * (length - 1) + 18.16;
// extra length to the vertical tine of the inside cherry cross
// splits the stem into halves - allows easier fitment
extra_vertical = 0.6;
extra_vertical = 100;
module inside_cherry_cross(slop) {
// inside cross
@@ -3511,7 +3501,7 @@ function unit_length(length) = $unit * (length - 1) + 18.16;
// extra length to the vertical tine of the inside cherry cross
// splits the stem into halves - allows easier fitment
extra_vertical = 0.6;
extra_vertical = 100;
module inside_cherry_cross(slop) {
// inside cross
@@ -3707,7 +3697,7 @@ function unit_length(length) = $unit * (length - 1) + 18.16;
// extra length to the vertical tine of the inside cherry cross
// splits the stem into halves - allows easier fitment
extra_vertical = 0.6;
extra_vertical = 100;
module inside_cherry_cross(slop) {
// inside cross
@@ -4066,7 +4056,7 @@ function unit_length(length) = $unit * (length - 1) + 18.16;
// extra length to the vertical tine of the inside cherry cross
// splits the stem into halves - allows easier fitment
extra_vertical = 0.6;
extra_vertical = 100;
module inside_cherry_cross(slop) {
// inside cross
@@ -4309,7 +4299,7 @@ function unit_length(length) = $unit * (length - 1) + 18.16;
// extra length to the vertical tine of the inside cherry cross
// splits the stem into halves - allows easier fitment
extra_vertical = 0.6;
extra_vertical = 100;
module inside_cherry_cross(slop) {
// inside cross
@@ -4378,7 +4368,7 @@ module tines_support(stem_type, stem_support_height, slop) {
}
// 2 vertical tines holding either side of the cruciform
for (x = [1.15, -1.15]) {
for (x = [2, -2]) {
translate([x,0,$stem_support_height / 2]) {
cube([
0.5,
@@ -5051,45 +5041,6 @@ module legends(depth=0) {
}
}
}
module autolegends(depth=0) {
if (len($front_autolegends) > 0) {
front_of_key() {
for (i=[0:len($front_legends)-1]) {
rotate([90,0,0]) keytext($front_legends[i][0], $front_legends[i][1], $front_legends[i][2], depth);
}
}
}
if (len($autolegends) > 0) {
// legends are printed in a square grid - 1, 4, 9 legends, etc
grid_size = len($autolegends)^0.5;
echo("grid_size", grid_size);
max_width = (top_total_key_width() - $legend_margin * (grid_size + 1)) / grid_size;
max_height = (top_total_key_height() - $legend_margin * (grid_size + 1)) / grid_size;
top_of_key() {
for (column=[0:grid_size-1]) {
for (row=[0:grid_size-1]) {
top_left_corner = [-top_total_key_width()/2, top_total_key_height()/2];
centering_offset = [max_width / 2, -max_height / 2];
position_offset = [(max_width + $legend_margin) * column, (-max_height-$legend_margin) * row];
margin_offset = [$legend_margin, -$legend_margin];
translate(top_left_corner + centering_offset + position_offset + margin_offset) {
translate([0,0,-depth]) {
color($tertiary_color) linear_extrude(height=$dish_depth + depth){
// resize([0, max_height, 0]) {
resize([max_width, 0], auto=true) {
text(text=$autolegends[row * grid_size + column], font=$font, halign="center", valign="center");
}
// }
}
}
}
}
}
}
}
}
// use skin() instead of successive hulls. much more correct, and looks faster
// too, in most cases. successive hull relies on overlapping faces which are
// not good. But, skin works on vertex sets instead of shapes, which makes it
@@ -6298,10 +6249,7 @@ module additive_features(inset) {
if($key_bump) keybump($key_bump_depth, $key_bump_edge);
if(!inset && $children > 0) color($secondary_color) children();
}
if($outset_legends) {
legends(0);
autolegends(0);
}
if($outset_legends) legends(0);
// render the clearance check if it's enabled, but don't have it intersect with anything
if ($clearance_check) %clearance_check();
}
@@ -6311,10 +6259,7 @@ module subtractive_features(inset) {
top_of_key() {
if (inset && $children > 0) color($secondary_color) children();
}
if(!$outset_legends) {
legends($inset_legend_depth);
autolegends($inset_legend_depth);
}
if(!$outset_legends) legends($inset_legend_depth);
// subtract the clearance check if it's enabled, letting the user see the
// parts of the keycap that will hit the cherry switch
// this is a little confusing as it eats the stem too
@@ -6530,14 +6475,12 @@ $double_sculpted = false;
//valign = "top" or "center" or "bottom"
// Currently does not work with thingiverse customizer, and actually breaks it
$legends = [];
$autolegends = [];
//list of front legends to place on a key format: [text, halign, valign, size]
//halign = "left" or "center" or "right"
//valign = "top" or "center" or "bottom"
// Currently does not work with thingiverse customizer, and actually breaks it
$front_legends = [];
$front_autolegends = [];
// print legends on the front of the key instead of the top
$front_print_legends = false;
@@ -6545,9 +6488,6 @@ $front_print_legends = false;
// how recessed inset legends / artisans are from the top of the key
$inset_legend_depth = 0.2;
// legends are not allowed to print within this many mm of the edge of the key
$legend_margin = 0.8;
// Dimensions of alps stem
$alps_stem = [4.45, 2.25];

View File

@@ -9,11 +9,8 @@ include <./includes.scad>
// example key
$stem_inner_slop = 0;
dcs_row(5) autolegend(["q", "w", "a", "z", "e", "r", "t", "", "hoobastank"]) {
$stem_positions = [[2,2]];
key();
}
dcs_row(5) legend("⇪", size=9) key();
// example row
/* for (x = [0:1:4]) {
translate_u(0,-x) dcs_row(x) key();

View File

@@ -3,4 +3,3 @@
include <features/key_bump.scad>
include <features/clearance_check.scad>
include <features/legends.scad>
include <features/autolegends.scad>

View File

@@ -1,39 +0,0 @@
module autolegends(depth=0) {
if (len($front_autolegends) > 0) {
front_of_key() {
for (i=[0:len($front_legends)-1]) {
rotate([90,0,0]) keytext($front_legends[i][0], $front_legends[i][1], $front_legends[i][2], depth);
}
}
}
if (len($autolegends) > 0) {
// legends are printed in a square grid - 1, 4, 9 legends, etc
grid_size = len($autolegends)^0.5;
echo("grid_size", grid_size);
max_width = (top_total_key_width() - $legend_margin * (grid_size + 1)) / grid_size;
max_height = (top_total_key_height() - $legend_margin * (grid_size + 1)) / grid_size;
top_of_key() {
for (column=[0:grid_size-1]) {
for (row=[0:grid_size-1]) {
top_left_corner = [-top_total_key_width()/2, top_total_key_height()/2];
centering_offset = [max_width / 2, -max_height / 2];
position_offset = [(max_width + $legend_margin) * column, (-max_height-$legend_margin) * row];
margin_offset = [$legend_margin, -$legend_margin];
translate(top_left_corner + centering_offset + position_offset + margin_offset) {
translate([0,0,-depth]) {
color($tertiary_color) linear_extrude(height=$dish_depth + depth){
// resize([0, max_height, 0]) {
resize([max_width, 0], auto=true) {
text(text=$autolegends[row * grid_size + column], font=$font, halign="center", valign="center");
}
// }
}
}
}
}
}
}
}
}

View File

@@ -180,10 +180,7 @@ module additive_features(inset) {
if($key_bump) keybump($key_bump_depth, $key_bump_edge);
if(!inset && $children > 0) color($secondary_color) children();
}
if($outset_legends) {
legends(0);
autolegends(0);
}
if($outset_legends) legends(0);
// render the clearance check if it's enabled, but don't have it intersect with anything
if ($clearance_check) %clearance_check();
}
@@ -193,10 +190,7 @@ module subtractive_features(inset) {
top_of_key() {
if (inset && $children > 0) color($secondary_color) children();
}
if(!$outset_legends) {
legends($inset_legend_depth);
autolegends($inset_legend_depth);
}
if(!$outset_legends) legends($inset_legend_depth);
// subtract the clearance check if it's enabled, letting the user see the
// parts of the keycap that will hit the cherry switch
// this is a little confusing as it eats the stem too

View File

@@ -170,18 +170,6 @@ module front_legend(text, position=[0,0], size=undef) {
children();
}
module autolegend(texts) {
// $autolegends = [for(L=[$legends, [[text, position, font_size]]], a=L) a];
$autolegends = texts;
children();
}
module front_autolegend(texts) {
font_size = size == undef ? $font_size : size;
$front_autolegends = [for(L=[$front_legends, [[text, position, font_size]]], a=L) a];
children();
}
module bump(depth=undef) {
$key_bump = true;
$key_bump_depth = depth == undef ? $key_bump_depth : depth;
@@ -207,7 +195,7 @@ module upside_down() {
module sideways() {
$key_shape_type = "flat_sided_square";
$dish_overdraw_width = abs(extra_keytop_length_for_flat_sides());
extra_y_rotation = atan2($width_difference/2,$total_depth);
extra_y_rotation = atan2($width_difference/2,$total_depth); // TODO assumes centered top
translate([0,0,cos(extra_y_rotation) * total_key_width()/2])
rotate([0,90 + extra_y_rotation ,0]) children();
}
@@ -235,3 +223,11 @@ module auto_place() {
translate_u(x,-y) children(child_index);
}
}
// suggested settings for resin prints
module resin() {
$stem_slop = 0;
$stem_inner_slop = 0;
$stem_support_type = "disable";
children();
}

View File

@@ -147,14 +147,12 @@ $double_sculpted = false;
//valign = "top" or "center" or "bottom"
// Currently does not work with thingiverse customizer, and actually breaks it
$legends = [];
$autolegends = [];
//list of front legends to place on a key format: [text, halign, valign, size]
//halign = "left" or "center" or "right"
//valign = "top" or "center" or "bottom"
// Currently does not work with thingiverse customizer, and actually breaks it
$front_legends = [];
$front_autolegends = [];
// print legends on the front of the key instead of the top
$front_print_legends = false;
@@ -162,9 +160,6 @@ $front_print_legends = false;
// how recessed inset legends / artisans are from the top of the key
$inset_legend_depth = 0.2;
// legends are not allowed to print within this many mm of the edge of the key
$legend_margin = 0.8;
// Dimensions of alps stem
$alps_stem = [4.45, 2.25];

View File

@@ -36,7 +36,7 @@ module tines_support(stem_type, stem_support_height, slop) {
}
// 2 vertical tines holding either side of the cruciform
for (x = [1.15, -1.15]) {
for (x = [2, -2]) {
translate([x,0,$stem_support_height / 2]) {
cube([
0.5,

View File

@@ -2,7 +2,7 @@ include <../functions.scad>
// extra length to the vertical tine of the inside cherry cross
// splits the stem into halves - allows easier fitment
extra_vertical = 0.6;
extra_vertical = 100;
module inside_cherry_cross(slop) {
// inside cross