|
@ -1,3 +1,14 @@ |
|
|
|
|
|
/* |
|
|
|
|
|
* Copyright 2022 Thomas Buck - thomas@xythobuz.de |
|
|
|
|
|
* Philipp Schönberger - mail@phschoen.de |
|
|
|
|
|
* |
|
|
|
|
|
* This program is distributed in the hope that it will be useful, |
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
|
|
|
* GNU General Public License for more details. |
|
|
|
|
|
* |
|
|
|
|
|
* See <http://www.gnu.org/licenses/>. |
|
|
|
|
|
*/ |
|
|
include <config.scad>; |
|
|
include <config.scad>; |
|
|
include <constant.scad>; |
|
|
include <constant.scad>; |
|
|
|
|
|
|
|
@ -6,215 +17,239 @@ use <switch_holder.scad>; |
|
|
use <switch.scad>; |
|
|
use <switch.scad>; |
|
|
use <pcb/amoeba-royale.scad>; |
|
|
use <pcb/amoeba-royale.scad>; |
|
|
|
|
|
|
|
|
for(c=[0:len(switch_r[0])-1],r=[0:len(switch_r)-1]) { |
|
|
|
|
|
|
|
|
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]; |
|
|
|
|
|
|
|
|
echo("switches c",c,"d",r); |
|
|
|
|
|
translate(switch_t[r][c]) |
|
|
|
|
|
rotate(switch_r[r][c]) { |
|
|
|
|
|
if($show_switches == true) |
|
|
|
|
|
switch(0, $show_keycaps ? switch_keycap[r][c][0]: "none", switch_keycap[r][c][1] ); |
|
|
|
|
|
|
|
|
|
|
|
if($show_switch_pcb == true) |
|
|
|
|
|
translate([0,0,-switch_holder_height-amoeba_royale_pcb_h-$c]) |
|
|
|
|
|
amoeba_royale_pcb(); |
|
|
|
|
|
|
|
|
|
|
|
switch_holder_with_cutouts(type="B"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function switch_rc_point(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_bz(row,colum,a,h,offset=[0,-10,0]) = [ |
|
|
|
|
|
|
|
|
function switch_bz(switch_r,switch_t, row,colum,a,h,offset=[0,-10,0]) = [ |
|
|
[ |
|
|
[ |
|
|
switch_rc_point(row,colum,a[0],h,[0,0,0]), |
|
|
|
|
|
switch_rc_point(row,colum,a[1],h,[0,0,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(row,colum,a[0],h,offset), |
|
|
|
|
|
switch_rc_point(row,colum,a[1],h,offset), |
|
|
|
|
|
|
|
|
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), |
|
|
], |
|
|
], |
|
|
[ |
|
|
[ |
|
|
zero_axis("z", switch_rc_point(row,colum,a[0],h,offset), -20), |
|
|
|
|
|
zero_axis("z", switch_rc_point(row,colum,a[1],h,offset), -20) |
|
|
|
|
|
|
|
|
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) |
|
|
], |
|
|
], |
|
|
]; |
|
|
]; |
|
|
function switch_bz_edge(row,colum,a,h,offset1=[0,-10,0],offset2=[0,-10,0]) = [ |
|
|
|
|
|
|
|
|
function switch_bz_edge(switch_r,switch_t, row,colum,a,h,offset1=[0,-10,0],offset2=[0,-10,0]) = [ |
|
|
[ |
|
|
[ |
|
|
switch_rc_point(row,colum,a,h,$e*offset1), |
|
|
|
|
|
switch_rc_point(row,colum,a,h, 0*offset1), |
|
|
|
|
|
switch_rc_point(row,colum,a,h,$e*offset2), |
|
|
|
|
|
|
|
|
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(row,colum,a,h,offset1), |
|
|
|
|
|
switch_rc_point(row,colum,a,h,offset1+offset2), |
|
|
|
|
|
switch_rc_point(row,colum,a,h,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), |
|
|
], |
|
|
], |
|
|
[ |
|
|
[ |
|
|
zero_axis("z", switch_rc_point(row,colum,a,h,offset1), -20), |
|
|
|
|
|
zero_axis("z", switch_rc_point(row,colum,a,h,offset1+offset2), -20), |
|
|
|
|
|
zero_axis("z", switch_rc_point(row,colum,a,h,offset2), -20) |
|
|
|
|
|
|
|
|
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) |
|
|
], |
|
|
], |
|
|
]; |
|
|
]; |
|
|
function switch_bz_offset(a)= ( |
|
|
|
|
|
(a == "N" ) ? [ 10, 0, 0] : |
|
|
|
|
|
(a == "S" ) ? [-10, 0, 0] : |
|
|
|
|
|
(a == "O" ) ? [ 0, 10, 0] : |
|
|
|
|
|
(a == "W" ) ? [ 0,-10, 0] : |
|
|
|
|
|
undef |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function switch_bz_between(rows,colums,a,h,offset_bz=[2,0,0],offset_out=[0,-10,0]) = [ |
|
|
|
|
|
|
|
|
function switch_bz_between(switch_r,switch_t,rows,colums,a,h,offset_bz=[2,0,0],offset_out=[0,-10,0]) = [ |
|
|
[ |
|
|
[ |
|
|
switch_rc_point(rows[0],colums[0],a[0],h,[0,0,0]), |
|
|
|
|
|
switch_rc_point(rows[0],colums[0],a[0],h,[0,0,0]+offset_bz), |
|
|
|
|
|
switch_rc_point(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]-offset_bz), |
|
|
|
|
|
switch_rc_point(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,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(rows[0],colums[0],a[0],h,[0,0,0]+offset_out), |
|
|
|
|
|
switch_rc_point(rows[0],colums[0],a[0],h,[0,0,0]+offset_bz+offset_out), |
|
|
|
|
|
switch_rc_point(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(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]+offset_out), |
|
|
|
|
|
|
|
|
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), |
|
|
], |
|
|
], |
|
|
[ |
|
|
[ |
|
|
zero_axis("z", switch_rc_point(rows[0],colums[0],a[0],h,[0,0,0]+offset_out), -20), |
|
|
|
|
|
zero_axis("z", switch_rc_point(rows[0],colums[0],a[0],h,[0,0,0]+offset_bz+offset_out), -20), |
|
|
|
|
|
zero_axis("z", switch_rc_point(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(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_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), |
|
|
], |
|
|
], |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
function switch_bz_connection(rows,colums,a,h,offset_bz=[2,0,0]) = [ |
|
|
|
|
|
|
|
|
function switch_bz_connection(switch_r,switch_t,rows,colums,a,h,offset_bz=[2,0,0]) = [ |
|
|
[ |
|
|
[ |
|
|
switch_rc_point(rows[0],colums[0],a[0][0],h,[0,0,0]-$e*offset_bz), |
|
|
|
|
|
switch_rc_point(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]-$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(rows[0],colums[0],a[0][0],h,[0,0,0]), |
|
|
|
|
|
switch_rc_point(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]), |
|
|
|
|
|
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][1],h,[0,0,0]), |
|
|
], |
|
|
], |
|
|
[ |
|
|
[ |
|
|
switch_rc_point(rows[0],colums[0],a[0][0],h,[0,0,0]+offset_bz), |
|
|
|
|
|
switch_rc_point(rows[0],colums[0],a[0][1],h,[0,0,0]+offset_bz), |
|
|
|
|
|
|
|
|
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(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][0],h,[0,0,0]-offset_bz), |
|
|
|
|
|
switch_rc_point(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]-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(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][0],h,[0,0,0]), |
|
|
|
|
|
switch_rc_point(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]), |
|
|
|
|
|
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(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(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][1],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][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_bz_connection_cross(rows,colums,a,h,offset_bz=[2,0,0]) = [ |
|
|
|
|
|
|
|
|
function switch_bz_connection_cross(switch_r,switch_t,rows,colums,a,h,offset_bz=[2,0,0]) = [ |
|
|
[ |
|
|
[ |
|
|
switch_rc_point(rows[0],colums[0],a[0][0],h,[0,0,0]-$e*offset_bz), |
|
|
|
|
|
switch_rc_point(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]-$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(rows[0],colums[0],a[0][0],h,[0,0,0]), |
|
|
|
|
|
switch_rc_point(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]), |
|
|
|
|
|
switch_rc_point(switch_r,switch_t,rows[1],colums[0],a[0][1],h,[0,0,0]), |
|
|
], |
|
|
], |
|
|
[ |
|
|
[ |
|
|
switch_rc_point(rows[0],colums[0],a[0][0],h,[0,0,0]+offset_bz), |
|
|
|
|
|
switch_rc_point(rows[1],colums[0],a[0][1],h,[0,0,0]+offset_bz), |
|
|
|
|
|
|
|
|
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(rows[0],colums[1],a[1][0],h,[0,0,0]-offset_bz), |
|
|
|
|
|
switch_rc_point(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]-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(rows[0],colums[1],a[1][0],h,[0,0,0]), |
|
|
|
|
|
switch_rc_point(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]), |
|
|
|
|
|
switch_rc_point(switch_r,switch_t,rows[1],colums[1],a[1][1],h,[0,0,0]), |
|
|
], |
|
|
], |
|
|
[ |
|
|
[ |
|
|
switch_rc_point(rows[0],colums[1],a[1][0],h,[0,0,0]+$e*offset_bz), |
|
|
|
|
|
switch_rc_point(rows[1],colums[1],a[1][1],h,[0,0,0]+$e*offset_bz), |
|
|
|
|
|
|
|
|
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 reverse_bz(points) = [for(i = [len(points)-1:-1:0]) points[i], ]; |
|
|
function reverse_bz(points) = [for(i = [len(points)-1:-1:0]) points[i], ]; |
|
|
|
|
|
|
|
|
function switch_bz_all_w(colum,a,h,offset=[0,-10,0]) = [for (r=[0:3]) switch_bz(row, colum, a, h, offset),]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch_holder_plate(switch_thumb_r, switch_thumb_t, 10); |
|
|
|
|
|
|
|
|
|
|
|
module switch_holder_plate(switch_r, switch_t, w_extra) |
|
|
|
|
|
{ |
|
|
t_step = 0.1; |
|
|
t_step = 0.1; |
|
|
thickness = switch_holder_height+1; |
|
|
thickness = switch_holder_height+1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ctrl_pts_S = [ |
|
|
|
|
|
// S curve |
|
|
// S curve |
|
|
switch_bz(3,0,["SW","SO"],"top",[0,-10,0]), |
|
|
|
|
|
switch_bz(3,1,["SW","SO"],"top",[0,-10,0]), |
|
|
|
|
|
switch_bz_between([3], [0,1],["SO","SW"],"top",[1,0,0],[0,-10,0]), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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]), |
|
|
|
|
|
]; |
|
|
|
|
|
echo("ctrl_pts_S", ctrl_pts_S); |
|
|
|
|
|
// 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]), |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
ctrl_pts_N = [ |
|
|
// N curve |
|
|
// N curve |
|
|
switch_bz(0,0,["NO","NW"],"top",[0,10,0]), |
|
|
|
|
|
switch_bz(0,1,["NO","NW"],"top",[0,10,0]), |
|
|
|
|
|
switch_bz_between([0], [1,0],["NW","NO"],"top",[-1,0,0],[0,+10,0]), |
|
|
|
|
|
|
|
|
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]), |
|
|
|
|
|
]; |
|
|
|
|
|
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]), |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
// within OW |
|
|
|
|
|
switch_bz_connection([0], [1,0],[ ["NW", "SW"],["NO", "SO"] ],"top",[-1,0,0]), |
|
|
|
|
|
switch_bz_connection([1], [1,0],[ ["NW", "SW"],["NO", "SO"] ],"top",[-1,0,0]), |
|
|
|
|
|
switch_bz_connection([2], [1,0],[ ["NW", "SW"],["NO", "SO"] ],"top",[-1,0,0]), |
|
|
|
|
|
switch_bz_connection([3], [1,0],[ ["NW", "SW"],["NO", "SO"] ],"top",[-1,0,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]), |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
// within NS |
|
|
|
|
|
switch_bz_connection([0,1], [0],[ ["SW", "SO"],["NW", "NO"] ],"top",[0,-1,0]), |
|
|
|
|
|
switch_bz_connection([1,2], [0],[ ["SW", "SO"],["NW", "NO"] ],"top",[0,-1,0]), |
|
|
|
|
|
switch_bz_connection([2,3], [0],[ ["SW", "SO"],["NW", "NO"] ],"top",[0,-1,0]), |
|
|
|
|
|
switch_bz_connection([0,1], [1],[ ["SW", "SO"],["NW", "NO"] ],"top",[0,-1,0]), |
|
|
|
|
|
switch_bz_connection([1,2], [1],[ ["SW", "SO"],["NW", "NO"] ],"top",[0,-1,0]), |
|
|
|
|
|
switch_bz_connection([2,3], [1],[ ["SW", "SO"],["NW", "NO"] ],"top",[0,-1,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]), |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
switch_bz_connection_cross([1,0], [0,1],[ [ "NO", "SO"],["NW", "SW"] ],"top",[1,0,0]), |
|
|
|
|
|
switch_bz_connection_cross([2,1], [0,1],[ [ "NO", "SO"],["NW", "SW"] ],"top",[1,0,0]), |
|
|
|
|
|
switch_bz_connection_cross([3,2], [0,1],[ [ "NO", "SO"],["NW", "SW"] ],"top",[1,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]), |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
// W curve |
|
|
|
|
|
switch_bz(0,0,["NW","SW"],"top",[-10,0,0]), |
|
|
|
|
|
switch_bz(1,0,["NW","SW"],"top",[-10,0,0]), |
|
|
|
|
|
switch_bz(2,0,["NW","SW"],"top",[-10,0,0]), |
|
|
|
|
|
switch_bz(3,0,["NW","SW"],"top",[-10,0,0]), |
|
|
|
|
|
switch_bz_between([0,1], [0],["SW","NW"],"top",[1,0,0],[-10,0,0]), |
|
|
|
|
|
switch_bz_between([1,2], [0],["SW","NW"],"top",[1,0,0],[-10,0,0]), |
|
|
|
|
|
switch_bz_between([2,3], [0],["SW","NW"],"top",[1,0,0],[-10,0,0]), |
|
|
|
|
|
|
|
|
|
|
|
switch_bz_between([1,0], [1],["NO","SO"],"top",[1,0,0],[10,0,0]), |
|
|
|
|
|
switch_bz_between([2,1], [1],["NO","SO"],"top",[1,0,0],[10,0,0]), |
|
|
|
|
|
switch_bz_between([3,2], [1],["NO","SO"],"top",[1,0,0],[10,0,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]), |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
// O curve |
|
|
|
|
|
switch_bz(0,1,["SO","NO"],"top",[+10,0,0]), |
|
|
|
|
|
switch_bz(1,1,["SO","NO"],"top",[+10,0,0]), |
|
|
|
|
|
switch_bz(2,1,["SO","NO"],"top",[+10,0,0]), |
|
|
|
|
|
switch_bz(3,1,["SO","NO"],"top",[+10,0,0]), |
|
|
|
|
|
|
|
|
|
|
|
// edge |
|
|
// edge |
|
|
switch_bz_edge(3,0,"SW","top",[-10,0,0],[0,-10,0]), |
|
|
|
|
|
reverse_bz(switch_bz_edge(3,1,"SO","top",[ 10,0,0],[0,-10,0])), |
|
|
|
|
|
reverse_bz(switch_bz_edge(0,0,"NW","top",[-10,0,0],[0, 10,0])), |
|
|
|
|
|
switch_bz_edge(0,1,"NO","top",[ 10,0,0],[0, 10,0]), |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
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]), |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
ctrl_pts_OW_IN = [ |
|
|
|
|
|
// within NS |
|
|
|
|
|
for(r=[0:len(switch_r)-2], c=[0:len(switch_r[r])-1]) |
|
|
|
|
|
switch_bz_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]) |
|
|
|
|
|
switch_bz_connection_cross(switch_r,switch_t,[r+1,r], [c,c+1],[ [ "NO", "SO"],["NW", "SW"] ],"top",[1,0,0]), |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
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_E, |
|
|
|
|
|
ctrl_pts_OW_IN, |
|
|
|
|
|
ctrl_pts_NS_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]) { |
|
|
|
|
|
if($show_switches == true) |
|
|
|
|
|
switch(0, $show_keycaps ? switch_keycap[r][c][0]: "none", switch_keycap[r][c][1] ); |
|
|
|
|
|
|
|
|
for(k=[0:len(ctrl_pts_S)-1]) { |
|
|
|
|
|
g_S = bezier_surface(t_step, ctrl_pts_S[k]); |
|
|
|
|
|
// g_S = sf_splines(t_step, ctrl_pts_S); |
|
|
|
|
|
|
|
|
if($show_switch_pcb == true) |
|
|
|
|
|
translate([0,0,-switch_holder_height-amoeba_royale_pcb_h-$c]) |
|
|
|
|
|
amoeba_royale_pcb(); |
|
|
|
|
|
|
|
|
|
|
|
switch_holder_with_cutouts(type="B"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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]); |
|
|
|
|
|
// g_S = sf_splines(t_step, ctrl_pts[j][k]); |
|
|
sf_thicken(g_S, thickness,"FORWARD"); |
|
|
sf_thicken(g_S, thickness,"FORWARD"); |
|
|
//function_grapher(g_S,thickness,"FORWARD"); |
|
|
//function_grapher(g_S,thickness,"FORWARD"); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// draw bezier_points |
|
|
|
|
|
color("black") |
|
|
|
|
|
for(k=[0:len(ctrl_pts_S)-1]) |
|
|
|
|
|
for(i=[0:len(ctrl_pts_S[k])-1]) |
|
|
|
|
|
for(j=[0:len(ctrl_pts_S[k][i])-1]) |
|
|
|
|
|
translate(ctrl_pts_S[k][i][j]) |
|
|
|
|
|
|
|
|
// 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); |
|
|
%sphere(d=0.5); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|