pushing up to continue work elsewhere. actually abstracting ISO shape
This commit is contained in:
parent
65d6656056
commit
736f3a6d70
15
keys.scad
15
keys.scad
|
@ -197,11 +197,12 @@ module g20() {
|
||||||
/*$rounded_key = true;*/
|
/*$rounded_key = true;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
module fake_iso_enter() {
|
module iso_enter() {
|
||||||
$bottom_key_width = 18.16 * 1.9;
|
$bottom_key_width = 18.16;
|
||||||
$bottom_key_height = 18.16 * 2;
|
$bottom_key_height = 18.16;
|
||||||
$width_difference = 4;
|
$key_length = 1.5;
|
||||||
$height_difference = 4;
|
$key_height = 2;
|
||||||
|
|
||||||
$total_depth = 7;
|
$total_depth = 7;
|
||||||
$top_tilt = 0;
|
$top_tilt = 0;
|
||||||
$top_skew = 1.75;
|
$top_skew = 1.75;
|
||||||
|
@ -424,7 +425,7 @@ module legend(text, inset=false) {
|
||||||
children();
|
children();
|
||||||
}
|
}
|
||||||
|
|
||||||
translate_u(1.125, 0.5) fake_iso_enter() cherry() key();
|
translate_u(1.125, 0.5) iso_enter() cherry() key();
|
||||||
translate_u(0, 0) sa_row(2) legend("q", inset=true) cherry() {
|
translate_u(0, 0) sa_row(2) legend("q", inset=true) cherry() {
|
||||||
key();
|
/*key();*/
|
||||||
}
|
}
|
||||||
|
|
37
shapes.scad
37
shapes.scad
|
@ -3,7 +3,7 @@ unit = 19.05;
|
||||||
|
|
||||||
module key_shape(width, height, width_difference, height_difference, corner_size) {
|
module key_shape(width, height, width_difference, height_difference, corner_size) {
|
||||||
if ($key_shape_type == "iso_enter") {
|
if ($key_shape_type == "iso_enter") {
|
||||||
fakeISOEnter(width_difference/2);
|
ISO_enter(width, height, width_difference, height_difference, corner_size);
|
||||||
} else if ($key_shape_type == "normal") {
|
} else if ($key_shape_type == "normal") {
|
||||||
roundedSquare([width - width_difference, height - height_difference], corner_size);
|
roundedSquare([width - width_difference, height - height_difference], corner_size);
|
||||||
} else if ($key_shape_type == "circle") {
|
} else if ($key_shape_type == "circle") {
|
||||||
|
@ -26,28 +26,33 @@ module roundedSquare(size, radius, center = true) {
|
||||||
|
|
||||||
// corollary is roundedSquare
|
// corollary is roundedSquare
|
||||||
// NOT 3D
|
// NOT 3D
|
||||||
module fakeISOEnter(thickness_difference = 0){
|
module ISO_enter(width, height, width_difference, height_difference, corner_size){
|
||||||
// t is all modifications to the polygon array
|
function unit_length(length) = unit * (length - 1) + 18.16;
|
||||||
// t used to contain a corner radius adjustment, but due to
|
|
||||||
// the offset we need that expansion back
|
|
||||||
t = (thickness_difference - (unit - 18.16));
|
|
||||||
|
|
||||||
function unit(length) = unit * length;
|
|
||||||
|
// in order to make the ISO keycap shape generic, we are going to express the
|
||||||
|
// 'elbow point' in terms of ratios. an ISO enter is just a 1.5u key stuck on
|
||||||
|
// top of a 1.25u key, but since our key_shape function doesnt understand that
|
||||||
|
// and wants to pass just width and height, we make these ratios to know where
|
||||||
|
// to put the elbow joint
|
||||||
|
|
||||||
|
width_ratio = unit_length(1.25) / unit_length(1.5);
|
||||||
|
height_ratio = unit_length(1) / unit_length(2);
|
||||||
|
|
||||||
pointArray = [
|
pointArray = [
|
||||||
[unit(-.625) + t, unit(-1) + t],
|
[ -width_difference/2, -height_difference/2],
|
||||||
[unit(0.625) - t, unit(-1) + t],
|
[ -width_difference/2, -height + height_difference/2],
|
||||||
[unit(0.625) - t, unit(1) - t],
|
[-width * width_ratio + width_difference/2, -height + height_difference/2],
|
||||||
[unit(-0.875) + t, unit(1) - t],
|
[-width * width_ratio + width_difference/2,-height * height_ratio + height_difference/2],
|
||||||
[unit(-0.875) + t, unit(0) + t],
|
[ -width + width_difference/2,-height * height_ratio + height_difference/2],
|
||||||
[unit(-0.625) + t, unit(0) + t]
|
[ -width + width_difference/2, -height_difference/2]
|
||||||
];
|
];
|
||||||
|
|
||||||
minkowski(){
|
minkowski(){
|
||||||
circle(r=$corner_radius);
|
circle(r=corner_size);
|
||||||
// gives us rounded inner corner
|
// gives us rounded inner corner
|
||||||
offset(r=-$corner_radius*2) {
|
offset(r=-corner_size*2) {
|
||||||
polygon(points=pointArray);
|
translate([(width * width_ratio)/2, height/2]) polygon(points=pointArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue