|
|
@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|