diff --git a/customizer.scad b/customizer.scad index 8ffb4de..f3575c3 100644 --- a/customizer.scad +++ b/customizer.scad @@ -900,7 +900,66 @@ module dss_row(n=3, column=0) { children(); } } +// a safe theoretical distance between two vertices such that they don't collapse. hard to use +SMALLEST_POSSIBLE = 1/128; +$fs=0.1; +$unit=19.05; +// Regular polygon shapes CIRCUMSCRIBE the sphere of diameter $bottom_key_width +// This is to make tiling them easier, like in the case of hexagonal keycaps etc +// this function doesn't set the key shape, so you can't use it directly without some fiddling +module typewriter_row(n=3, column=0) { + $bottom_key_width = $unit - 0.5; + $bottom_key_height = $unit - 0.5; + $width_difference = 0; + $height_difference = 0; + $dish_type = "spherical"; + $key_shape_type = "circular"; + $inverted_dish = true; + $stem_inset = -4.5; + $stem_throw = 5; + $dish_depth = 1; + $dish_skew_x = 0; + $dish_skew_y = 0; + $top_skew = 0; + $height_slices = 1; + $stem_support_type = "disable"; +// $corner_radius = 1; + + // this is _incredibly_ intensive + /* $rounded_key = true; */ + + $top_tilt_y = side_tilt(column); + extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0; + + base_depth = 3.5; + if (n <= 1){ + $total_depth = base_depth + 2.5 + extra_height; + $top_tilt = -13; + + children(); + } else if (n == 2) { + $total_depth = base_depth + 0.5 + extra_height; + $top_tilt = -7; + + children(); + } else if (n == 3) { + $total_depth = base_depth + extra_height; + $top_tilt = 0; + + children(); + } else if (n == 4){ + $total_depth = base_depth + 0.5 + extra_height; + $top_tilt = 7; + + children(); + } else { + $total_depth = base_depth + extra_height; + $top_tilt = 0; + + children(); + } +} // man, wouldn't it be so cool if functions were first order module key_profile(key_profile_type, row, column=0) { if (key_profile_type == "dcs") { @@ -921,6 +980,8 @@ module key_profile(key_profile_type, row, column=0) { hipro_row(row, column) children(); } else if (key_profile_type == "grid") { grid_row(row, column) children(); + } else if (key_profile_type == "typewriter") { + typewriter_row(row, column) children(); } else if (key_profile_type == "hexagon") { hexagonal_row(row, column) children(); } else if (key_profile_type == "octagon") { @@ -3296,6 +3357,8 @@ module key_shape(size, delta, progress = 0) { regular_polygon_shape(size, delta, progress); } else if ($key_shape_type == "octagon") { regular_polygon_shape(size, delta, progress, sides=8); + } else if ($key_shape_type == "circular") { + regular_polygon_shape(size, delta, progress, sides=36); } else { echo("Warning: unsupported $key_shape_type"); } @@ -4877,7 +4940,7 @@ module keytext(text, position, font_size, depth) { woffset = (top_total_key_width()/3.5) * position[0]; hoffset = (top_total_key_height()/3.5) * -position[1]; translate([woffset, hoffset, -depth]){ - color($tertiary_color) linear_extrude(height=2){ + color($tertiary_color) linear_extrude(height=$dish_depth + depth){ text(text=text, font=$font, size=font_size, halign="center", valign="center"); } } diff --git a/src/key_profiles.scad b/src/key_profiles.scad index 15f44d9..393fc82 100644 --- a/src/key_profiles.scad +++ b/src/key_profiles.scad @@ -14,6 +14,7 @@ include include include include +include // man, wouldn't it be so cool if functions were first order module key_profile(key_profile_type, row, column=0) { @@ -35,6 +36,8 @@ module key_profile(key_profile_type, row, column=0) { hipro_row(row, column) children(); } else if (key_profile_type == "grid") { grid_row(row, column) children(); + } else if (key_profile_type == "typewriter") { + typewriter_row(row, column) children(); } else if (key_profile_type == "hexagon") { hexagonal_row(row, column) children(); } else if (key_profile_type == "octagon") { diff --git a/src/key_profiles/typewriter.scad b/src/key_profiles/typewriter.scad new file mode 100644 index 0000000..347cce5 --- /dev/null +++ b/src/key_profiles/typewriter.scad @@ -0,0 +1,57 @@ +include <../constants.scad> +// Regular polygon shapes CIRCUMSCRIBE the sphere of diameter $bottom_key_width +// This is to make tiling them easier, like in the case of hexagonal keycaps etc + +// this function doesn't set the key shape, so you can't use it directly without some fiddling +module typewriter_row(n=3, column=0) { + $bottom_key_width = $unit - 0.5; + $bottom_key_height = $unit - 0.5; + $width_difference = 0; + $height_difference = 0; + $dish_type = "spherical"; + $key_shape_type = "circular"; + $inverted_dish = true; + $stem_inset = -4.5; + $stem_throw = 5; + $dish_depth = 1; + $dish_skew_x = 0; + $dish_skew_y = 0; + $top_skew = 0; + $height_slices = 1; + $stem_support_type = "disable"; +// $corner_radius = 1; + + // this is _incredibly_ intensive + /* $rounded_key = true; */ + + $top_tilt_y = side_tilt(column); + extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0; + + base_depth = 3.5; + if (n <= 1){ + $total_depth = base_depth + 2.5 + extra_height; + $top_tilt = -13; + + children(); + } else if (n == 2) { + $total_depth = base_depth + 0.5 + extra_height; + $top_tilt = -7; + + children(); + } else if (n == 3) { + $total_depth = base_depth + extra_height; + $top_tilt = 0; + + children(); + } else if (n == 4){ + $total_depth = base_depth + 0.5 + extra_height; + $top_tilt = 7; + + children(); + } else { + $total_depth = base_depth + extra_height; + $top_tilt = 0; + + children(); + } +} \ No newline at end of file diff --git a/src/shapes.scad b/src/shapes.scad index ac893c5..7a4ccb4 100644 --- a/src/shapes.scad +++ b/src/shapes.scad @@ -28,6 +28,8 @@ module key_shape(size, delta, progress = 0) { regular_polygon_shape(size, delta, progress); } else if ($key_shape_type == "octagon") { regular_polygon_shape(size, delta, progress, sides=8); + } else if ($key_shape_type == "circular") { + regular_polygon_shape(size, delta, progress, sides=36); } else { echo("Warning: unsupported $key_shape_type"); }