Browse Source

add kinesis model positions

main
phschoen 2 years ago
parent
commit
8a25498ffb
  1. 56
      config.scad
  2. 2
      constant.scad
  3. 227
      kinessis.scad
  4. 70
      kinessis_pos.scad
  5. 70
      main.scad
  6. 12
      switch_holder.scad
  7. 367
      switch_holder_plate.scad
  8. 55
      test_pos.scad

56
config.scad

@ -10,47 +10,14 @@
* See <http://www.gnu.org/licenses/>.
*/
switch_finger_t=[
// colum 3
[ [0,70,50], [30 ,60,20] , [50, 60, 20] , [70, 60,20] , [95, 60,20] ],
// colum 2
[ [0,40,40], [30 ,40,10] , [50, 40, 10] , [70, 40,10] , [95, 40,10] ],
// colum 2
[ [0,20,25], [28.5,20, 5] , [50, 20, 5] , [70, 20, 5] , [95, 20, 5] ],
// colum 1
[ [0, 0,15], [25 ,0 ,0 ] , [50, 0, 0] , [70, 0, 0] , [95, 0, 0] ]
];
t_pos=0;
r_pos=1;
k_pos=2;
switch_finger_r=[
// row 3
[ [0,0,0], [0,0,-10] , [0,0,-10] , [0,0,-10] , [0,0,-10] , [0,0,-10] ],
// row 2
[ [0,0,0], [20,0,-10] , [20,0,-10] , [20,0,-10] , [20,0,-10] , [20,0,-10] ],
// row 2
[ [0,0,0], [10,0,-10] , [10,0,-10] , [10,0,-10] , [10,0,-10] , [10,0,-10] ],
// row 1
[ [0,0,0], [0,0,-10] , [0,0,-10] , [0,0,-10] , [0,0,-10] , [0,0,-10] ]
];
switch_thumb_t=[
// colum 2
[ [-35,-45,15], [-9,-30,15] , [30,-30,15] ],
// colum 1
[ [-25,-70,10], [0,-50,10], [30,-50,10] ],
];
switch_thumb_r=[
[ [0,0,30], [10,0,20] , [10,0,10] ],
// row 1
[ [0,0,30], [10,0,20] , [0,0,10] ]
];
switch_keycap=[
[["mt3", 1], ["SA", 1], ["SA", 1],["SA", 1],["SA", 1],],
[["mt3", 1], ["SA", 1], ["SA", 1],["SA", 1],["SA", 1],],
[["mt3", 1], ["SA", 1], ["SA", 1],["SA", 1],["SA", 1],],
[["mt3", 1], ["SA", 1], ["SA", 1],["SA", 1],["SA", 1],],
];
//include <test_pos.scad>
include <kinessis_pos.scad>
switch_case_extra_width= 20;
// the trackball diameter itself
ball_dia = 38.0;
ball_h = 15;
@ -61,11 +28,14 @@ roller_count = 3;
bezier_between_keys = false;
$switch_with_pcb=true;
$show_switches=true;
$show_keycaps=true;
$show_switch_pcb=true;
$switch_with_pcb = false;
$show_switches = false;
$show_keycaps = false;
$show_switch_pcb = false;
$show_case = true;
$show_case_plate = true;
$show_case_debug = false;
//
// cutout types
//

2
constant.scad

@ -24,7 +24,7 @@ switch_dim_y=13.98;
switch_travel_max = 4;
switch_clamp_height =1.1;
switch_extra_keycap_width = 2.5;
switch_extra_keycap_width = 1.5;
switch_holder_width = switch_cutout_width + switch_extra_keycap_width*2;
switch_holder_height = 4.8;

227
kinessis.scad

@ -1,5 +1,6 @@
// tip dip pip mcp
finger_h = 0.1*[
[ 10, 15, 18, 28 ], [ 10, 15, 18, 28 ], [ 10, 15, 18, 28 ], [ 10, 15, 18, 28 ], [ 10, 15, 18, 28 ]];
@ -76,59 +77,187 @@ function calc_angles(idx,t)=[
function pi()=3.14159265358979323846;
function m_transpose(m) =
let(
column = len(m[0]),
row = len(m)
)
[
for(y = 0; y < column; y = y + 1)
[
for(x = 0; x < row; x = x + 1)
m[x][y]
]
];
function transpose(m) =
let(
column = len(m),
row = 1
)
[
for(y = 0; y < column; y = y + 1)
[
m[y]
]
];
function sum(lt) =
let(end = len(lt) - 1)
end == 0 ? lt[0] :
let(
cum_total = [
for(i = 0, s = lt[0], is_continue = i < end;
is_continue;
i = i + 1, is_continue = i < end, s = is_continue ? s + lt[i] : undef) s]
)
cum_total[end - 1] + lt[end];
module line(c="blue",p1=[0,0,0],p2,d=0.05)
{
color(c)
hull() {
translate ( p1*2.54) sphere(d);
translate ( p2*2.54) sphere(d);
}
y = acos( (( p1*2.54)-( p2*2.54))[1] / sqrt( (( p1*2.54)-( p2*2.54))[0] *((p1*2.54)-( p2*2.54))[0] + ((p1*2.54)-( p2*2.54))[1]*((p1*2.54)-( p2*2.54))[1]));
x = acos( (( p1*2.54)-( p2*2.54))[1] / sqrt( (( p1*2.54)-( p2*2.54))[0] *((p1*2.54)-( p2*2.54))[0] + ((p1*2.54)-( p2*2.54))[1]*((p1*2.54)-( p2*2.54))[1]));
echo([ p2*2.54, [0,
atan((sqrt(
(
((p1-p2)*2.54 )[0]*((p1-p2)*2.54 )[0]
+
((p1-p2)*2.54 )[1]*((p1-p2)*2.54 )[1]
) )/
((p1-p2)*2.54 )[2] )),
atan( ((p1-p2)*2.54 )[1] /((p1-p2)*2.54 )[0] ) ]]);
}
// scale since patent is in inch
scale([25.4,25.4,25.4])
//scale([27.4,25.4,25.4])
{
d_t=0.01;
d_1a=0.01;
d_1b=0.1;
d_2=0.01;
d_3=0.01;
d_4a=0.01;
d_4b=0.01;
// finger thumb
color("magenta")hull() { translate([2.660100,3.769870,2.090850]) sphere(d_t); translate([2.666560,3.808380,1.894690]) sphere(d_t); }
color("magenta")hull() { translate([1.973320,3.510470,2.010680]) sphere(d_t); translate([1.980350,3.553940,1.815560]) sphere(d_t); }
color("magenta")hull() { translate([2.245370,2.853450,1.888880]) sphere(d_t); translate([2.261190,2.888580,1.692630]) sphere(d_t); }
color("magenta")hull() { translate([2.534610,2.192950,1.774750]) sphere(d_t); translate([2.534420,2.232090,1.578620]) sphere(d_t); }
color("magenta")hull() { translate([3.121180,2.762650,1.907540]) sphere(d_t); translate([3.118430,2.801320,1.711340]) sphere(d_t); }
color("magenta")hull() { translate([3.798070,3.053630,1.922090]) sphere(d_t); translate([3.787220,3.098700,1.727540]) sphere(d_t); }
// finger 1
color("red")hull() { translate([5.626412,4.890490,4.921143]) sphere(d_1a); translate([3.603139,5.951178,1.756010]) sphere(d_1a); }
color("red")hull() { translate([3.601304,5.185127,1.597157]) sphere(d_1a); translate([5.626412,4.890490,4.921143]) sphere(d_1a); }
color("red") hull() { translate([5.626412,4.859049,4.921143]) sphere(d_1a); translate([3.680820,4.407240,1.571830]) sphere(d_1a); }
color("red") hull() { translate([3.686250,6.574620,2.042010]) sphere(d_1a); translate([5.626412,4.890490,4.921143]) sphere(d_1a); }
color("green")hull() { translate([4.324486,6.084067,1.400235]) sphere(d_1b); translate([5.476960,5.040864,4.524379]) sphere(d_1b); }
color("green")hull() { translate([5.476960,5.040864,4.524379]) sphere(d_1b); translate([4.328402,5.307730,1.240122]) sphere(d_1b); }
color("green")hull() { translate([4.391585,4.517622,1.249485]) sphere(d_1b); translate([5.476960,5.040864,4.524379]) sphere(d_1b); }
color("green")hull() { translate([4.510779,3.754514,1.427841]) sphere(d_1b); translate([5.476960,5.040864,4.524379]) sphere(d_1b); }
color("green")hull() { translate([5.476960,5.040864,4.524379]) sphere(d_1b); translate([4.380041,6.806573,1.721562]) sphere(d_1b); }
// finger 2
color("blue")hull() { translate([5.614666,5.194831,3.515830]) sphere(d_2); translate([5.065645,6.200934,1.067919]) sphere(d_2); }
color("blue")hull() { translate([5.080251,5.408403,0.874860]) sphere(d_2); translate([5.614666,5.194831,3.515830]) sphere(d_2); }
color("blue")hull() { translate([5.614666,5.194831,3.515830]) sphere(d_2); translate([5.143544,4.896416,0.922400]) sphere(d_2); }
color("blue")hull() { translate([5.249757,3.838946,1.206208]) sphere(d_2); translate([5.614666,5.194831,3.515830]) sphere(d_2); }
color("blue")hull() { translate([5.101057,6.901806,1.483988]) sphere(d_2); translate([5.614666,5.194831,3.515830]) sphere(d_2); }
line("magenta" ,[2.666560,3.808380,1.894690],[2.660100,3.769870,2.090850]);
line("magenta", [1.980350,3.553940,1.815560],[1.973320,3.510470,2.010680]);
line("magenta", [2.261190,2.888580,1.692630],[2.245370,2.853450,1.888880]);
line("magenta", [2.534610,2.192950,1.774750],[2.534420,2.232090,1.578620]);
line("magenta", [3.121180,2.762650,1.907540],[3.118430,2.801320,1.711340]);
line("magenta", [3.798070,3.053630,1.922090],[3.787220,3.098700,1.727540]);
for(i = [
[[6.75665, 9.57547, 5.31076], [0, -11.2583, 80.4774]] ,
[[5.01223, 8.91659, 5.10713], [0, -12.7175, 80.8136]] ,
[[5.70324, 7.24776, 4.79776], [0, -11.107, 65.7567]] ,
[[6.43743, 5.66951, 4.00969], [0, 11.2859, -89.7219]] ,
[[7.92081, 7.11535, 4.3468], [0, 11.1772, -85.9323]] ,
[[9.61954, 7.8707, 4.38795], [0, 13.4026, -76.4644]] ,
])
color("magenta")
translate(i[0])
rotate(i[1])
cylinder(d=0.05, h =10);
for(i = [
[[9.36308, 16.6995, 5.18671] , [0, 41.7436,-40.9591], ], // red 1
[[9.15197, 15.116, 4.46027] , [0, 35.82, -27.665], ], // red 2
[[9.14731, 13.1702, 4.05678] , [0, 31.6187, -8.27799], ], // red 3
[[9.34928, 11.1944, 3.99245] , [0, 30.8097, 13.0736], ], // red 4
])
color("red")
translate(i[0])
rotate(i[1])
cylinder(d=0.05, h =10);
for(i = [
[ [11.1253, 17.2887, 4.37277], [0, 36.5622, -58.15] ], // green 0
[ [10.9842, 15.4535, 3.5566], [0, 26.4538, -42.1509] ], // green 1
[ [10.9941, 13.4816, 3.14991], [0, 19.7498, -13.0805] ], // green 2
[ [11.1546, 11.4748, 3.17369], [0, 20.1998, 25.738] ], // green 3
[ [11.4574, 9.53647, 3.62672], [0, 27.4539, 53.0897] ], // green 4
])
color("green")
translate(i[0])
rotate(i[1])
cylinder(d=0.05, h =9);
for(i = [
[[12.9567, 17.5306, 3.76933], [0, 41.261, -73.2541] ],
[[12.8667, 15.7504, 2.71251], [0, 25.0898, -61.3791] ],
[[12.9038, 13.7373, 2.22214], [0, 12.2935, -21.7835] ],
[[13.0646, 12.4369, 2.3429], [0, 12.1358, 32.3507] ],
[[13.3344, 9.75092, 3.06377], [0, 31.2974, 74.9369] ],
])
color("blue")
translate(i[0])
rotate(i[1])
cylinder(d=0.05, h =7);
for(i = [
[[14.9523, 17.5466, 3.60612], [0, 33.4625, -77.0026]] ,
[[14.9599, 15.7283, 2.71953], [0, 20.3697, -69.2842]] ,
[[15.0261, 13.7548, 2.27958], [0, 8.62728, -39.7016]] ,
[[15.1474, 11.7358, 2.31069], [0, 9.91521, 53.965]] ,
[[15.3169, 9.78303, 2.81112], [0, 22.0582, 77.4566]] ,
])
color("brown")
translate(i[0])
rotate(i[1])
cylinder(d=0.05, h =8.5);
for(i = [
[[17.0407, 16.9158, 3.60332], [0, 29.4563, -77.3251]] ,
[[17.1098, 13.0971, 2.51373], [0, 6.38541, -25.8394]] ,
[[17.2136, 11.1048, 2.63309], [0, 11.3871, 63.4095]] ,
[[17.3572, 9.19213, 3.19471], [0, 23.5255, 79.5863]] ,
])
color("gray")
translate(i[0])
rotate(i[1])
cylinder(d=0.05, h =8.9);
/* // finger 1 */
/* line("red", [5.626412,4.890490,4.921143],[3.603139,5.951178,1.756010]); */
/* line("red", [5.626412,4.890490,4.921143],[3.601304,5.185127,1.597157]); */
/* line("red", [5.626412,4.859049,4.921143],[3.680820,4.407240,1.571830]); */
/* line("red", [5.626412,4.890490,4.921143],[3.686250,6.574620,2.042010]); */
/* // finger 2 */
/* line("green", [5.476960,5.040864,4.524379],[4.324486,6.084067,1.400235]); */
/* line("green", [5.476960,5.040864,4.524379],[4.328402,5.307730,1.240122]); */
/* line("green", [5.476960,5.040864,4.524379],[4.391585,4.517622,1.249485]); */
/* line("green", [5.476960,5.040864,4.524379],[4.510779,3.754514,1.427841]); */
/* line("green", [5.476960,5.040864,4.524379],[4.380041,6.806573,1.721562]); */
/* line("blue", [5.614666,5.194831,3.515830],[5.065645,6.200934,1.067919]); */
/* line("blue", [5.614666,5.194831,3.515830],[5.080251,5.408403,0.874860]); */
/* line("blue", [5.614666,5.194831,3.515830],[5.143544,4.896416,0.922400]); */
/* line("blue", [5.614666,5.194831,3.515830],[5.249757,3.838946,1.206208]); */
/* line("blue", [5.614666,5.194831,3.515830],[5.101057,6.901806,1.483988]); */
// finger 3
color("brown")hull() { translate([6.306084,5.091255,4.240877]) sphere(d_3); translate([5.889712,6.192233,1.070680]) sphere(d_3); }
color("brown")hull() { translate([5.915799,5.415294,0.897474]) sphere(d_3); translate([6.306084,5.091255,4.240877]) sphere(d_3); }
color("brown")hull() { translate([6.306084,5.091255,4.240877]) sphere(d_3); translate([5.963534,4.620381,0.909720]) sphere(d_3); }
color("brown")hull() { translate([6.030270,3.851587,1.106739]) sphere(d_3); translate([6.306084,5.091255,4.240877]) sphere(d_3); }
color("brown")hull() { translate([5.886720,6.908103,1.419731]) sphere(d_3); translate([6.306084,5.091255,4.240877]) sphere(d_3); }
// finger 4
color("gray")hull() { translate([6.736145,5.156350,0.989659]) sphere(d_4a); translate([7.085053,4.987385,4.453756]) sphere(d_4a); }
color("gray")hull() { translate([7.085053,4.987385,4.453756]) sphere(d_4a); translate([6.777004,4.371971,1.036648]) sphere(d_4a); }
color("gray")hull() { translate([6.708940,6.659750,1.418630]) sphere(d_4a); translate([7.085053,4.987385,4.453756]) sphere(d_4a); }
color("gray")hull() { translate([6.833560,3.618950,1.257760]) sphere(d_4a); translate([7.085053,4.987385,4.453756]) sphere(d_4a); }
color("cyan")hull() { translate([7.569335,6.085933,1.084243]) sphere(d_4b); translate([7.736480,5.132073,3.684937]) sphere(d_4b); }
color("cyan")hull() { translate([7.736480,5.132073,3.684937]) sphere(d_4b); translate([7.606606,5.316667,0.918996]) sphere(d_4b); }
color("cyan")hull() { translate([7.654340,4.532530,0.976580]) sphere(d_4b); translate([7.736480,5.132073,3.684937]) sphere(d_4b); }
color("cyan")hull() { translate([7.545530,6.778350,1.459020]) sphere(d_4b); translate([7.736480,5.132073,3.684937]) sphere(d_4b); }
/* line("brown", [6.306084,5.091255,4.240877],[5.889712,6.192233,1.070680]); */
/* line("brown", [6.306084,5.091255,4.240877],[5.915799,5.415294,0.897474]); */
/* line("brown", [6.306084,5.091255,4.240877],[5.963534,4.620381,0.909720]); */
/* line("brown", [6.306084,5.091255,4.240877],[6.030270,3.851587,1.106739]); */
/* line("brown", [6.306084,5.091255,4.240877],[5.886720,6.908103,1.419731]); */
/* // finger 4 */
/* line("gray", [7.085053,4.987385,4.453756],[6.736145,5.156350,0.989659]); */
/* line("gray", [7.085053,4.987385,4.453756],[6.777004,4.371971,1.036648]); */
/* line("gray", [7.085053,4.987385,4.453756],[6.708940,6.659750,1.418630]); */
/* line("gray", [7.085053,4.987385,4.453756],[6.833560,3.618950,1.257760]); */
/* line("cyan", [7.736480,5.132073,3.684937],[7.569335,6.085933,1.084243]); */
/* line("cyan", [7.736480,5.132073,3.684937],[7.606606,5.316667,0.918996]); */
/* line("cyan", [7.736480,5.132073,3.684937],[7.654340,4.532530,0.976580]); */
/* line("cyan", [7.736480,5.132073,3.684937],[7.545530,6.778350,1.459020]); */
for(i = [
[[19.1656, 17.217, 3.70591], [0, 36.6697, -83.3839]] ,
[[19.2261, 15.4583, 2.75398], [0, 20.4233, -80.061]] ,
[[19.3208, 13.5043, 2.33425], [0, 4.66506, -54.8711]] ,
[[19.442, 11.5126, 2.48051], [0, 12.595, 82.1988]] ,
])
color("cyan")
translate(i[0])
rotate(i[1])
cylinder(d=0.05, h =7);
}

70
kinessis_pos.scad

@ -0,0 +1,70 @@
switch_config = [
// first cluster aka thumb
//
// position go colum first
[
// colum 1
[
// translate rotate key type Row type
[[50.3009, 90.2701, 46.1152], [11.2583,0,22.5], ["mt3", 1],],
[[57.4342, 73.3699, 42.9928], [11.2583,0,22.5], ["mt3", 2],],
[[64.3743, 56.6951, 40.0969], [11.2583,0,22.5], ["mt3", 2],],
],
// colum 2
[
// translate rotate key type Row type
[[67.7306, 96.7329, 48.1251], [11.2583,0,22.5], ["mt3", 1],],
[[79.2081, 71.1535, 43.468], [11.2583,0,22.5], ["mt3", 3],],
],
// colum 3
[
// translate rotate key type Row type
[[96.1954, 78.707, 43.8795], [11.2583,0,22.5], ["mt3", 3],],
],
],
[
[
/* [10*[9.36308, 16.6995, 5.18671], [-1* -40.95910,0*41.74360, 0,] , ["mt3", 1],], // red 1 */
/* [10*[9.15197, 15.1160, 4.46027], [-1* -27.66500,0*35.82000, 0,] , ["mt3", 2],],// red 2 */
/* [10*[9.14731, 13.1702, 4.05678], [-1* -8.27799,0*31.61870, 0,] , ["mt3", 3],],// red 3 */
/* [10*[9.34928, 11.1944, 3.99245], [-1* 13.07360,0*30.80970, 0,] , ["mt3", 4],],// red 4 */
[[93.6307, 166.995, 51.8671], [ 29, 31, 7 ] , ["mt3", 1], "red"],
[[91.5197, 151.16, 44.6027], [ 19, 31, 7 ] , ["mt3", 2], "red"],
[[91.4731, 131.702, 40.5678], [ 8, 31, 7 ] , ["mt3", 3], "red"],
[[93.4928, 111.944, 39.9245], [ -3, 31, 7 ] , ["mt3", 4], "red"],
], [
[[111.253, 172.887, 43.7277], [31, 19, 4,] , ["mt3", 4], "green"],// green 4 */
[[109.842, 154.535, 35.566], [18, 19, 4,] , ["mt3", 1], "green"],// green 0 */
[[109.941, 134.816, 31.4991], [ 5, 19, 4,] , ["mt3", 2], "green"],// green 1 */
[[111.546, 114.748, 31.7369], [-8, 19, 4,] , ["mt3", 3], "green"],// green 2 */
[[114.574, 95.3647, 36.2672], [-21, 19, 4,] , ["mt3", 4], "green"],// green 3 */
], [
[[129.567, 175.306, 37.6933], [ 40, 11, 4,] , ["mt3", 1], "blue"],
[[128.667, 157.504, 27.1251], [ 23, 11, 4,] , ["mt3", 2], "blue"],
[[129.038, 137.373, 22.2214], [ 5, 11, 4,] , ["mt3", 3], "blue"],
[[130.646, 124.369, 23.4290], [ -6, 11, 4,] , ["mt3", 4], "blue"],
[[133.344, 97.5092, 30.6377], [-30, 11, 4,] , ["mt3", 4], "blue"],
], [
[[149.523, 175.466, 36.0612], [ 33, 6, 4,] , ["mt3", 1], "red" ],
[[149.599, 157.283, 27.1953], [ 19, 6, 4,] , ["mt3", 2], "red" ],
[[150.261, 137.548, 22.7958], [ 5, 6, 4,] , ["mt3", 3], "red" ],
[[151.474, 117.358, 23.1069], [ -8, 6, 4,] , ["mt3", 4], "red" ],
[[153.169, 97.8303, 28.1112], [-22, 6, 4,] , ["mt3", 4], "red" ],
],
[
[[170.407, 169.158, 36.0332], [ 29, 5, 3,] , ["mt3", 1],],
[[170.752, 150.933, 28.3675], [ 17, 5, 3,] , ["mt3", 1],],
[[171.098, 130.971, 25.1373], [ 3, 6, 3,] , ["mt3", 2],],
[[172.136, 111.048, 26.3309], [ -10, 6, 3,] , ["mt3", 3],],
[[173.572, 91.9213, 31.9471], [ -23, 6, 3,] , ["mt3", 4],],
],
[
[[191.656, 172.170, 37.0591], [ 37, 2, 4,] , ["mt3", 1],],
[[192.261, 154.583, 27.5398], [ 20, 2, 4,] , ["mt3", 2],],
[[193.208, 135.043, 23.3425], [ 4, 2, 4,] , ["mt3", 3],],
[[194.420, 115.126, 24.8051], [ -13, 2, 4,] , ["mt3", 4],],
]
],
];

70
main.scad

@ -15,5 +15,71 @@ use <switch_holder_plate.scad>;
include <config.scad>;
include <constant.scad>;
switch_holder_plate(switch_finger_r, switch_finger_t,10);
switch_holder_plate(switch_thumb_r, switch_thumb_t, 10);
for(i = [0:len(switch_config)])
switch_holder_plate(switch_config[i],switch_case_extra_width);
module line(c="blue",p1=[0,0,0],p2,d=1)
{
p1 = p1 *10;
p2 = p2 *10;
color(c)
hull() {
translate ( p1*2.54) sphere(d);
translate ( p2*2.54) sphere(d);
}
y = acos( (( p1*2.54)-( p2*2.54))[1] / sqrt( (( p1*2.54)-( p2*2.54))[0] *((p1*2.54)-( p2*2.54))[0] + ((p1*2.54)-( p2*2.54))[1]*((p1*2.54)-( p2*2.54))[1]));
x = acos( (( p1*2.54)-( p2*2.54))[1] / sqrt( (( p1*2.54)-( p2*2.54))[0] *((p1*2.54)-( p2*2.54))[0] + ((p1*2.54)-( p2*2.54))[1]*((p1*2.54)-( p2*2.54))[1]));
echo([ p2*2.54, [0,
atan((sqrt(
(
((p1-p2)*2.54 )[0]*((p1-p2)*2.54 )[0]
+
((p1-p2)*2.54 )[1]*((p1-p2)*2.54 )[1]
) )/
((p1-p2)*2.54 )[2] )),
atan( ((p1-p2)*2.54 )[1] /((p1-p2)*2.54 )[0] ) ]]);
}
for(f=[0:5])
for(i = switch_config[1][f])
color(i[3])
translate(i[0])
rotate(i[1])
{
cylinder(d=1, h =150);
}
// finger 1
line("red", [5.626412,4.890490,4.921143],[3.603139,5.951178,1.756010]);
line("red", [5.626412,4.890490,4.921143],[3.601304,5.185127,1.597157]);
line("red", [5.626412,4.859049,4.921143],[3.680820,4.407240,1.571830]);
line("red", [5.626412,4.890490,4.921143],[3.686250,6.574620,2.042010]);
// finger 2
line("green", [5.476960,5.040864,4.524379],[4.324486,6.084067,1.400235]);
line("green", [5.476960,5.040864,4.524379],[4.328402,5.307730,1.240122]);
line("green", [5.476960,5.040864,4.524379],[4.391585,4.517622,1.249485]);
line("green", [5.476960,5.040864,4.524379],[4.510779,3.754514,1.427841]);
line("green", [5.476960,5.040864,4.524379],[4.380041,6.806573,1.721562]);
line("blue", [5.614666,5.194831,3.515830],[5.065645,6.200934,1.067919]);
line("blue", [5.614666,5.194831,3.515830],[5.080251,5.408403,0.874860]);
line("blue", [5.614666,5.194831,3.515830],[5.143544,4.896416,0.922400]);
line("blue", [5.614666,5.194831,3.515830],[5.249757,3.838946,1.206208]);
line("blue", [5.614666,5.194831,3.515830],[5.101057,6.901806,1.483988]);
// finger 3
line("brown", [6.306084,5.091255,4.240877],[5.889712,6.192233,1.070680]);
line("brown", [6.306084,5.091255,4.240877],[5.915799,5.415294,0.897474]);
line("brown", [6.306084,5.091255,4.240877],[5.963534,4.620381,0.909720]);
line("brown", [6.306084,5.091255,4.240877],[6.030270,3.851587,1.106739]);
line("brown", [6.306084,5.091255,4.240877],[5.886720,6.908103,1.419731]);
// finger 4
line("gray", [7.085053,4.987385,4.453756],[6.736145,5.156350,0.989659]);
line("gray", [7.085053,4.987385,4.453756],[6.777004,4.371971,1.036648]);
line("gray", [7.085053,4.987385,4.453756],[6.708940,6.659750,1.418630]);
line("gray", [7.085053,4.987385,4.453756],[6.833560,3.618950,1.257760]);
line("cyan", [7.736480,5.132073,3.684937],[7.569335,6.085933,1.084243]);
line("cyan", [7.736480,5.132073,3.684937],[7.606606,5.316667,0.918996]);
line("cyan", [7.736480,5.132073,3.684937],[7.654340,4.532530,0.976580]);
line("cyan", [7.736480,5.132073,3.684937],[7.545530,6.778350,1.459020]);

12
switch_holder.scad

@ -30,7 +30,7 @@ module switch_holder_with_cutouts(type="C")
{
difference() {
switch_holder(borders=[1,1,1,1]);
switch_holder(borders=[1,1,1,1],thickness=switch_extra_keycap_width, type=type);
color("red")
switch_cutout();
}
@ -93,16 +93,16 @@ module switch_holder(borders=[0,1,0,0,0],thickness=2.5,type="C") {
function switch_point(a, h) = (
(a == "NW" && h == "top") ? [-switch_holder_width/2, switch_holder_width/2,0] :
(a == "SW" && h == "top") ? [-switch_holder_width/2,-switch_holder_width/2,0] :
(a == "NO" && h == "top") ? [ switch_holder_width/2, switch_holder_width/2,0] :
(a == "SO" && h == "top") ? [ switch_holder_width/2,-switch_holder_width/2,0] :
(a == "NE" && h == "top") ? [ switch_holder_width/2, switch_holder_width/2,0] :
(a == "SE" && h == "top") ? [ switch_holder_width/2,-switch_holder_width/2,0] :
(a == "NW" && h == "bot") ? [-switch_holder_width/2, switch_holder_width/2,-switch_holder_height] :
(a == "SW" && h == "bot") ? [-switch_holder_width/2,-switch_holder_width/2,-switch_holder_height] :
(a == "NO" && h == "bot") ? [ switch_holder_width/2, switch_holder_width/2,-switch_holder_height] :
(a == "SO" && h == "bot") ? [ switch_holder_width/2,-switch_holder_width/2,-switch_holder_height] :
(a == "NE" && h == "bot") ? [ switch_holder_width/2, switch_holder_width/2,-switch_holder_height] :
(a == "SE" && h == "bot") ? [ switch_holder_width/2,-switch_holder_width/2,-switch_holder_height] :
(a == "N" && h == "top") ? [0, switch_holder_width/2,0] :
(a == "S" && h == "top") ? [0,-switch_holder_width/2,0] :
(a == "O" && h == "top") ? [ switch_holder_width/2,0,0] :
(a == "E" && h == "top") ? [ switch_holder_width/2,0,0] :
(a == "w" && h == "top") ? [-switch_holder_width/2,0,0] :
undef
);

367
switch_holder_plate.scad

@ -17,239 +17,206 @@ use <switch_holder.scad>;
use <switch.scad>;
use <pcb/amoeba-royale.scad>;
function switch_rc_point(switch_r,switch_t, row,colum,a,h,offset=[0,0,0]) = v_rot(switch_r[row][colum]) * (switch_point(a,h) + offset) + switch_t[row][colum];
function switch_rc_point(switch_config, c, r, a, h, offset=[0,0,0]) =
v_rot(switch_config[c][r][r_pos]) *
(switch_point(a,h) + offset) +
switch_config[c][r][t_pos];
function switch_bz(switch_r,switch_t, row,colum,a,h,offset=[0,-10,0]) = [
function switch_bz(switch_config, c, r, a, h, offset=[0,-10,0]) = [
[
switch_rc_point(switch_r,switch_t, row,colum,a[0],h,[0,0,0]),
switch_rc_point(switch_r,switch_t, row,colum,a[1],h,[0,0,0]),
switch_rc_point(switch_config, c, r, a[0], h, [0,0,0]),
switch_rc_point(switch_config, c, r, a[1], h, [0,0,0]),
],
[
switch_rc_point(switch_r,switch_t, row,colum,a[0],h,offset),
switch_rc_point(switch_r,switch_t, row,colum,a[1],h,offset),
switch_rc_point(switch_config, c, r, a[0], h, offset),
switch_rc_point(switch_config, c, r, a[1], h, offset),
],
[
zero_axis("z", switch_rc_point(switch_r,switch_t, row,colum,a[0],h,offset), -20),
zero_axis("z", switch_rc_point(switch_r,switch_t, row,colum,a[1],h,offset), -20)
zero_axis("z", switch_rc_point(switch_config, c, r, a[0], h, offset), -20),
zero_axis("z", switch_rc_point(switch_config, c, r, a[1], h, offset), -20)
],
];
function switch_bz_edge(switch_r,switch_t, row,colum,a,h,offset1=[0,-10,0],offset2=[0,-10,0]) = [
function switch_bz_edge(switch_config, c, r, a, h, offset1=[0,-10,0],offset2=[0,-10,0]) = [
[
switch_rc_point(switch_r,switch_t, row,colum,a,h,$e*offset1),
switch_rc_point(switch_r,switch_t, row,colum,a,h, 0*offset1),
switch_rc_point(switch_r,switch_t, row,colum,a,h,$e*offset2),
switch_rc_point(switch_config, c, r, a, h, $e*offset1),
switch_rc_point(switch_config, c, r, a, h, 0*offset1),
switch_rc_point(switch_config, c, r, a, h, $e*offset2),
],
[
switch_rc_point(switch_r,switch_t, row,colum,a,h,offset1),
switch_rc_point(switch_r,switch_t, row,colum,a,h,offset1+offset2),
switch_rc_point(switch_r,switch_t, row,colum,a,h,offset2),
switch_rc_point(switch_config, c, r, a, h, offset1),
switch_rc_point(switch_config, c, r, a, h, offset1+offset2),
switch_rc_point(switch_config, c, r, a, h, offset2),
],
[
zero_axis("z", switch_rc_point(switch_r,switch_t, row,colum,a,h,offset1), -20),
zero_axis("z", switch_rc_point(switch_r,switch_t, row,colum,a,h,offset1+offset2), -20),
zero_axis("z", switch_rc_point(switch_r,switch_t, row,colum,a,h,offset2), -20)
zero_axis("z", switch_rc_point(switch_config, c, r, a, h, offset1), -20),
zero_axis("z", switch_rc_point(switch_config, c, r, a, h, offset1+offset2), -20),
zero_axis("z", switch_rc_point(switch_config, c, r, a, h, offset2), -20)
],
];
function switch_bz_between(switch_r,switch_t,rows,colums,a,h,offset_bz=[2,0,0],offset_out=[0,-10,0]) = [
function switch_bz_between(switch_config, colums, rows, a, h, offset_bz=[2,0,0], offset_out=[0,-10,0]) = [
[
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0],h,[0,0,0]+offset_bz),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]-offset_bz),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]),
switch_rc_point(switch_config, colums[0], rows[0], a[0], h, [0,0,0]-offset_bz),
switch_rc_point(switch_config, colums[0], rows[0], a[0], h, [0,0,0]),
switch_rc_point(switch_config, colums[0], rows[0], a[0], h, [0,0,0]+offset_bz),
switch_rc_point(switch_config, colums[len(colums) == 1 ? 0 : 1], rows[len(rows) == 1 ? 0 : 1], a[1], h, [0,0,0]-offset_bz),
switch_rc_point(switch_config, colums[len(colums) == 1 ? 0 : 1], rows[len(rows) == 1 ? 0 : 1], a[1], h, [0,0,0]),
switch_rc_point(switch_config, colums[len(colums) == 1 ? 0 : 1], rows[len(rows) == 1 ? 0 : 1], a[1], h, [0,0,0]+offset_bz),
],
[
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0],h,[0,0,0]+offset_out),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0],h,[0,0,0]+offset_bz+offset_out),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]-offset_bz+offset_out),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]+offset_out),
switch_rc_point(switch_config, colums[0], rows[0], a[0], h, [0,0,0]-offset_bz+offset_out),
switch_rc_point(switch_config, colums[0], rows[0], a[0], h, [0,0,0]+offset_out),
switch_rc_point(switch_config, colums[0], rows[0], a[0], h, [0,0,0]+offset_bz+offset_out),
switch_rc_point(switch_config, colums[len(colums) == 1 ? 0 : 1], rows[len(rows) == 1 ? 0 : 1], a[1], h, [0,0,0]-offset_bz+offset_out),
switch_rc_point(switch_config, colums[len(colums) == 1 ? 0 : 1], rows[len(rows) == 1 ? 0 : 1], a[1], h, [0,0,0]+offset_out),
switch_rc_point(switch_config, colums[len(colums) == 1 ? 0 : 1], rows[len(rows) == 1 ? 0 : 1], a[1], h, [0,0,0]+offset_bz+offset_out),
],
[
zero_axis("z", switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0],h,[0,0,0]+offset_out), -20),
zero_axis("z", switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0],h,[0,0,0]+offset_bz+offset_out), -20),
zero_axis("z", switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]-offset_bz+offset_out), -20),
zero_axis("z", switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]+offset_out), -20),
zero_axis("z", switch_rc_point(switch_config, colums[0], rows[0], a[0], h, [0,0,0]-offset_bz+offset_out), -20),
zero_axis("z", switch_rc_point(switch_config, colums[0], rows[0], a[0], h, [0,0,0]+offset_out), -20),
zero_axis("z", switch_rc_point(switch_config, colums[0], rows[0], a[0], h, [0,0,0]+offset_bz+offset_out), -20),
zero_axis("z", switch_rc_point(switch_config, colums[len(colums) == 1 ? 0 : 1], rows[len(rows) == 1 ? 0 : 1], a[1], h, [0,0,0]-offset_bz+offset_out), -20),
zero_axis("z", switch_rc_point(switch_config, colums[len(colums) == 1 ? 0 : 1], rows[len(rows) == 1 ? 0 : 1], a[1], h, [0,0,0]+offset_out), -20),
zero_axis("z", switch_rc_point(switch_config, colums[len(colums) == 1 ? 0 : 1], rows[len(rows) == 1 ? 0 : 1], a[1], h, [0,0,0]+offset_bz+offset_out), -20),
],
];
function switch_line_connection(switch_r,switch_t,rows,colums,a,h,offset_bz=[2,0,0]) = [
[
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][0],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][1],h,[0,0,0]),
],
[
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][0],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][1],h,[0,0,0]),
],
function switch_line_connection(switch_config, colums, rows, a) = [
switch_rc_point(switch_config, colums[0], rows[0], a[0][0], "top", [0,0,0]),
switch_rc_point(switch_config, colums[0], rows[0], a[0][1], "top", [0,0,0]),
switch_rc_point(switch_config, colums[len(colums) == 1 ? 0 : 1], rows[len(rows) == 1 ? 0 : 1], a[1][1], "top", [0,0,0]),
switch_rc_point(switch_config, colums[len(colums) == 1 ? 0 : 1], rows[len(rows) == 1 ? 0 : 1], a[1][0], "top", [0,0,0]),
switch_rc_point(switch_config, colums[0], rows[0], a[0][0], "bot", [0,0,0]),
switch_rc_point(switch_config, colums[0], rows[0], a[0][1], "bot", [0,0,0]),
switch_rc_point(switch_config, colums[len(colums) == 1 ? 0 : 1], rows[len(rows) == 1 ? 0 : 1], a[1][1], "bot", [0,0,0]),
switch_rc_point(switch_config, colums[len(colums) == 1 ? 0 : 1], rows[len(rows) == 1 ? 0 : 1], a[1][0], "bot", [0,0,0]),
];
function switch_bz_connection(switch_r,switch_t,rows,colums,a,h,offset_bz=[2,0,0]) = [
[
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][0],h,[0,0,0]-$e*offset_bz),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][1],h,[0,0,0]-$e*offset_bz),
],
[
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][0],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][1],h,[0,0,0]),
],
[
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][0],h,[0,0,0]+offset_bz),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][1],h,[0,0,0]+offset_bz),
],
[
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][0],h,[0,0,0]-offset_bz),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][1],h,[0,0,0]-offset_bz),
],
[
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][0],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][1],h,[0,0,0]),
],
[
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][0],h,[0,0,0]+$e*offset_bz),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][1],h,[0,0,0]+$e*offset_bz),
],
];
function switch_line_connection_cross(switch_r,switch_t,rows,colums,a,h,offset_bz=[2,0,0]) = [
[
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][0],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[1],colums[0],a[0][1],h,[0,0,0]),
],
[
switch_rc_point(switch_r,switch_t,rows[0],colums[1],a[1][0],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[1],colums[1],a[1][1],h,[0,0,0]),
],
];
function switch_bz_connection_cross(switch_r,switch_t,rows,colums,a,h,offset_bz=[2,0,0]) = [
[
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][0],h,[0,0,0]-$e*offset_bz),
switch_rc_point(switch_r,switch_t,rows[1],colums[0],a[0][1],h,[0,0,0]-$e*offset_bz),
],
[
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][0],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[1],colums[0],a[0][1],h,[0,0,0]),
],
[
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][0],h,[0,0,0]+offset_bz),
switch_rc_point(switch_r,switch_t,rows[1],colums[0],a[0][1],h,[0,0,0]+offset_bz),
],
[
switch_rc_point(switch_r,switch_t,rows[0],colums[1],a[1][0],h,[0,0,0]-offset_bz),
switch_rc_point(switch_r,switch_t,rows[1],colums[1],a[1][1],h,[0,0,0]-offset_bz),
],
[
switch_rc_point(switch_r,switch_t,rows[0],colums[1],a[1][0],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[1],colums[1],a[1][1],h,[0,0,0]),
],
[
switch_rc_point(switch_r,switch_t,rows[0],colums[1],a[1][0],h,[0,0,0]+$e*offset_bz),
switch_rc_point(switch_r,switch_t,rows[1],colums[1],a[1][1],h,[0,0,0]+$e*offset_bz),
],
function switch_line_connection_cross(switch_config, colums, rows, a,h,offset_bz=[2,0,0]) = [
switch_rc_point(switch_config, colums[0], rows[0], a[0][0], "top", [0,0,0]),
switch_rc_point(switch_config, colums[0], rows[1], a[0][1], "top", [0,0,0]),
switch_rc_point(switch_config, colums[1], rows[1], a[1][1], "top", [0,0,0]),
switch_rc_point(switch_config, colums[1], rows[0], a[1][0], "top", [0,0,0]),
switch_rc_point(switch_config, colums[0], rows[0], a[0][0], "bot", [0,0,0]),
switch_rc_point(switch_config, colums[0], rows[1], a[0][1], "bot", [0,0,0]),
switch_rc_point(switch_config, colums[1], rows[1], a[1][1], "bot", [0,0,0]),
switch_rc_point(switch_config, colums[1], rows[0], a[1][0], "bot", [0,0,0]),
];
function reverse_bz(points) = [for(i = [len(points)-1:-1:0]) points[i], ];
switch_holder_plate(switch_thumb_r, switch_thumb_t, 10);
switch_holder_plate(switch_config[0], 10);
module switch_holder_plate(switch_r, switch_t, w_extra)
module switch_holder_plate(switch_config, w_extra)
{
t_step = 0.1;
thickness = switch_holder_height+1;
t_step = 0.1;
thickness = switch_holder_height+1;
c_max=len(switch_config)-1;
function r_max(c) = len(switch_config[c])-1;
ctrl_pts_S = [
for(c=[0:c_max], r=[r_max(c)])
switch_bz(switch_config, c, r, ["SW","SE"], "top", [0,-w_extra,0]),
];
// S curve
ctrl_pts_S = [
for(r=len(switch_r)-1, c=[0:len(switch_r[r])-1])
switch_bz(switch_r,switch_t,r,c,["SW","SO"],"top",[0,-w_extra,0]),
// North curve
ctrl_pts_N = [
for(c=[0:c_max], r=[0])
switch_bz(switch_config, c, r, ["NE","NW"], "top", [0,w_extra,0]),
];
// West curve
ctrl_pts_W = [
for(c=[0], r=[0:r_max(c)])
switch_bz(switch_config, c, r, ["NW","SW"], "top", [-w_extra,0,0]),
];
// between the s curves
ctrl_pts_S_B = [
for(r=len(switch_r)-1, c=[0:len(switch_r[r])-2])
switch_bz_between(switch_r,switch_t,[r], [c,c+1],["SO","SW"],"top",[1,0,0],[0,-w_extra,0]),
// East curve
ctrl_pts_E = [
for(c=[c_max], r=[0:r_max(c)])
switch_bz(switch_config, c, r, ["SE","NE"], "top", [+w_extra,0,0]),
];
ctrl_pts_N = [
// N curve
for(r=0, c=[0:len(switch_r[r])-1])
switch_bz(switch_r,switch_t,r,c,["NO","NW"],"top",[0,w_extra,0]),
// edge
ctrl_pts_EDGE = [
switch_bz_edge(switch_config, 0, r_max(0), "SW", "top", [-w_extra,0,0], [0,-w_extra,0]),
switch_bz_edge(switch_config, c_max, 0, "NE", "top", [ w_extra,0,0], [0, w_extra,0]),
reverse_bz(switch_bz_edge(switch_config, c_max, r_max(c_max), "SE", "top", [ w_extra,0,0], [0,-w_extra,0])),
reverse_bz(switch_bz_edge(switch_config, 0, 0, "NW", "top", [-w_extra,0,0], [0, w_extra,0])),
];
ctrl_pts_N_B = [
for(r=0, c=[0:len(switch_r[r])-2])
switch_bz_between(switch_r,switch_t,[r], [c+1,c],["NW","NO"],"top",[-1,0,0],[0,+w_extra,0]),
];
// W curve
ctrl_pts_W = [
for(r=[0:len(switch_r)-1], c=0)
switch_bz(switch_r,switch_t,r,c,["NW","SW"],"top",[-w_extra,0,0]),
];
// between the s curves
//
ctrl_pts_S_B = [
for(c=[0:c_max-1], r=[r_max(c)])
switch_bz_between(switch_config, [c, c+1], [r], ["SE","SW"], "top", [1,0,0], [0,-w_extra,0]),
];
ctrl_pts_W_B = [
for(r=[0:len(switch_r)-2], c=0)
switch_bz_between(switch_r,switch_t,[r,r+1], [c],["SW","NW"],"top",[1,0,0],[-w_extra,0,0]),
];
// O curve
ctrl_pts_O = [
for(r=[0:len(switch_r)-1], c=len(switch_r[r])-1)
switch_bz(switch_r,switch_t,r,c,["SO","NO"],"top",[+w_extra,0,0]),
];
// North curve between the keys
ctrl_pts_N_B = [
for(c=[0:c_max-1], r=[0])
switch_bz_between(switch_config, [c+1,c], [r], ["NW","NE"], "top", [-1,0,0], [0,+w_extra,0]),
];
ctrl_pts_O_B = [
for(r=[0:len(switch_r)-2], c=len(switch_r[r])-1)
switch_bz_between(switch_r,switch_t,[r+1,r], [c],["NO","SO"],"top",[1,0,0],[w_extra,0,0]),
];
/* // West curve between the keys */
ctrl_pts_W_B = [
for(c=[0], r=[0:r_max(c)])
switch_bz_between(switch_config, [c], [r,r+1], ["SW","NW"], "top", [1,0,0], [-w_extra,0,0]),
];
// edge
ctrl_pts_E = [
switch_bz_edge(switch_r,switch_t,len(switch_r)-1,0,"SW","top",[-w_extra,0,0],[0,-w_extra,0]),
switch_bz_edge(switch_r,switch_t,0,len(switch_r[0])-1,"NO","top",[ w_extra,0,0],[0, w_extra,0]),
reverse_bz(switch_bz_edge(switch_r,switch_t,len(switch_r)-1,len(switch_r[0])-1,"SO","top",[ w_extra,0,0],[0,-w_extra,0])),
reverse_bz(switch_bz_edge(switch_r,switch_t,0,0,"NW","top",[-w_extra,0,0],[0, w_extra,0])),
];
ctrl_pts_NS_IN = [
// within OW
for(r=[0:len(switch_r)-1], c=[0:len(switch_r[r])-2])
switch_bz_connection(switch_r,switch_t,[r], [c+1,c],[ ["NW", "SW"],["NO", "SO"] ],"top",[-1,0,0]),
];
/* // East curve between the keys */
ctrl_pts_E_B = [
for(c=[c_max], r=[0:r_max(c)])
switch_bz_between(switch_config, [c], [r+1,r], ["NE","SE"],"top",[1,0,0],[w_extra,0,0]),
];
ctrl_pts_OW_IN = [
// within NS
for(r=[0:len(switch_r)-2], c=[0:len(switch_r[r])-1]) (
(bezier_between_keys == true) ?
switch_bz_connection(switch_r,switch_t,[r,r+1], [c],[ ["SW", "SO"],["NW", "NO"] ],"top",[0,-1,0]) :
switch_line_connection(switch_r,switch_t,[r,r+1], [c],[ ["SW", "SO"],["NW", "NO"] ],"top",[0,-1,0])
)
];
ctrl_pts_CROSS_IN = [
for(r=[0:len(switch_r)-2], c=[0:len(switch_r[r])-2]) (
(bezier_between_keys == true) ?
switch_bz_connection_cross(switch_r,switch_t,[r+1,r], [c,c+1],[ [ "NO", "SO"],["NW", "SW"] ],"top",[1,0,0]) :
switch_line_connection_cross(switch_r,switch_t,[r+1,r], [c,c+1],[ [ "NO", "SO"],["NW", "SW"] ],"top",[1,0,0])
)
];
// North-South between the keys
ctrl_pts_NS_IN = [
for(c=[0:c_max], r=[0:r_max(c)-1])
switch_line_connection(switch_config, [c], [r,r+1], [ ["SW", "SE"], ["NW", "NE"], ], "top")
];
// East West between the keys
ctrl_pts_EW_IN = [
for(c=[0:c_max-1], r=[0:r_max(c)])
switch_line_connection(switch_config, [c,c+1], [r], [["NE", "SE"],["NW", "SW"] ,], "top"),
];
// the cross section between 4 keys
//
//
ctrl_pts_CROSS_IN = [
for(c=[0:c_max-1], r=[0:r_max(c)-1])
switch_line_connection_cross(switch_config, [c,c+1], [r,r+1], [["SE", "NE"],["SW", "NW"] ,]),
];
ctrl_pts = [
ctrl_pts_S ,
ctrl_pts_S_B,
ctrl_pts_N_B , ctrl_pts_N,
ctrl_pts_W_B , ctrl_pts_W,
ctrl_pts_O_B , ctrl_pts_O,
ctrl_pts_N,
ctrl_pts_W,
ctrl_pts_E,
ctrl_pts_OW_IN,
ctrl_pts_EDGE,
ctrl_pts_S_B ,
ctrl_pts_N_B ,
ctrl_pts_W_B ,
ctrl_pts_E_B ,
];
echo("ctrlptr sB",ctrl_pts_S_B);
poly_pts = [
ctrl_pts_NS_IN,
ctrl_pts_EW_IN,
ctrl_pts_CROSS_IN,
];
];
for(r=[0:len(switch_r)-1], c=[0:len(switch_r[r])-1])
translate(switch_t[r][c])
rotate(switch_r[r][c]) {
for(c=[0:len(switch_config)-1], r=[0:len(switch_config[c])-1])
translate(switch_config[c][r][t_pos])
rotate(switch_config[c][r][r_pos]) {
if($show_switches == true)
switch(0, $show_keycaps ? switch_keycap[r][c][0]: "none", switch_keycap[r][c][1] );
switch(0, $show_keycaps ? switch_config[c][r][k_pos][0]: "none", switch_config[c][r][k_pos][1] );
if($show_switch_pcb == true)
translate([0,0,-switch_holder_height-amoeba_royale_pcb_h-$c])
@ -258,6 +225,7 @@ ctrl_pts_CROSS_IN = [
switch_holder_with_cutouts(type="B");
}
if($show_case == true)
for(j=[0:len(ctrl_pts)-1]) {
for(k=[0:len(ctrl_pts[j])-1]) {
g_S = bezier_surface(t_step, ctrl_pts[j][k]);
@ -267,15 +235,42 @@ ctrl_pts_CROSS_IN = [
}
}
if($show_case_plate == true)
for(j=[0:len(poly_pts)-1]) {
for(k=[0:len(poly_pts[j])-1]) {
all_cube_faces= [
[0,1,2,3], // bot
[4,5,1,0], // front
[7,6,5,4], // top
[5,6,2,1], // right
[6,7,3,2], // back
[7,4,0,3], // left
];
polyhedron(poly_pts[j][k], all_cube_faces);
}
}
// draw bezier_points
/* color("black") */
/* for(k=[0:len(ctrl_pts)-1]) */
/* for(i=[0:len(ctrl_pts[k])-1]) */
/* for(j=[0:len(ctrl_pts[k][i])-1]) */
/* translate(ctrl_pts[k][i][j]) */
/* { */
/* %sphere(d=0.5); */
/* } */
if($show_case_debug == true)
%color("black")
for(k=[0:len(ctrl_pts)-1])
for(i=[0:len(ctrl_pts[k])-1])
for(j=[0:len(ctrl_pts[k][i])-1])
for(l=[0:len(ctrl_pts[k][i][j])-1])
translate(ctrl_pts[k][i][j][l])
{
//echo (ctrl_pts[k][i][j][l]);
sphere(d=1);
}
if($show_case_debug == false)
%color("blue")
for(k=[0:len(poly_pts)-1])
for(i=[0:len(poly_pts[k])-1])
for(j=[0:len(poly_pts[k][i])-1])
translate(poly_pts[k][i][j])
{
//echo (poly_pts[k][i][j][l]);
sphere(d=1);
}
}

55
test_pos.scad

@ -0,0 +1,55 @@
switch_config = [
// first cluster aka thumb
//
// position go colum first
[
// colum 1
[
// translate rotate key type Row type
[[-35,-45, 15] , [ 0, 0, 30] , ["mt3", 1],],
[[-25,-70, 10] , [ 0, 0, 30] , ["mt3", 1],],
],
// colum 2
[
[[ -9,-30, 15] , [ 10, 0, 20] , ["mt3", 2],],
[[ 0,-50, 10] , [ 10, 0, 20] , ["mt3", 2],],
],
// colum 3
[
// translate rotate key type Row type
[[ 30,-30, 15] , [ 10, 0, 10] , ["mt3", 3],],
[[ 30,-50, 10] , [ 0, 0, 10] , ["mt3", 3],],
],
],
// second cluster aka fingers
[
[
// translate rotate key type Row type
[[ 0, 70, 50] ,[0,0,0] ,["mt3", 1], ],
[[ 0, 40, 40] ,[0,0,0] ,["mt3", 1], ],
[[ 0, 20, 25] ,[0,0,0] ,["mt3", 1], ],
[[ 0, 0, 15] ,[0,0,0] ,["mt3", 1], ],
], [
[[ 30.0, 60, 20] ,[0,0,-10] ,["mt3", 1], ],
[[ 30.0, 40, 10] ,[20,0,-10] ,["mt3", 1], ],
[[ 28.5, 20, 5] ,[10,0,-10] ,["mt3", 1], ],
[[ 25.0, 0, 0] ,[0,0,-10] ,["mt3", 1], ],
], [
[[50, 60, 20] , [0,0,-10] ,["mt3", 1], ],
[[50, 40, 10] , [20,0,-10] ,["mt3", 1], ],
[[50, 20, 5] , [10,0,-10] ,["mt3", 1], ],
[[50, 0, 0] , [0,0,-10] ,["mt3", 1], ],
], [
[[70, 60,20] , [0,0,-10] ,["mt3", 1], ],
[[70, 40,10] , [20,0,-10] ,["mt3", 1], ],
[[70, 20, 5] , [10,0,-10] ,["mt3", 1], ],
[[70, 0, 0] , [0,0,-10] ,["mt3", 1], ],
], [
[[95, 60,20] , [0,0,-10] ,["mt3", 1], ],
[[95, 40,10] , [20,0,-10] ,["mt3", 1], ],
[[95, 20, 5] , [10,0,-10] ,["mt3", 1], ],
[[95, 0, 0] , [0,0,-10] ,["mt3", 1], ],
],
],
];
Loading…
Cancel
Save