From a44e0bb016833c5ba41bbcd0a5b46b760c81f63b Mon Sep 17 00:00:00 2001 From: phschoen Date: Sun, 18 Dec 2022 02:36:27 +0100 Subject: [PATCH] add licences and add option for 2 clusters (thumb and fingers) --- config.scad | 50 ++++-- constant.scad | 12 ++ keycap_gen.scad | 12 ++ keycap_stl.scad | 12 ++ keycaps.scad | 11 ++ kinessis.scad | 1 - main.scad | 105 ++---------- matlab/calc_angle_switch.m | 10 ++ matlab/calc_finger_pos.m | 9 + matlab/euklid_dist.m | 9 + matlab/find_next_switch_pos.m | 9 + matlab/local_minimas.m | 9 + matlab/start.m | 9 + matlab/test.m | 9 + pcb/amoeba-royale.scad | 11 ++ pcb/pmw3360_sensor.scad | 11 ++ pcb/rp2040.scad | 11 ++ switch.scad | 11 ++ switch_cutout.scad | 11 ++ switch_holder.scad | 11 ++ switch_holder_plate.scad | 315 +++++++++++++++++++--------------- trackball/trackball.scad | 1 + 22 files changed, 403 insertions(+), 246 deletions(-) diff --git a/config.scad b/config.scad index 7db1ae8..36012cf 100644 --- a/config.scad +++ b/config.scad @@ -1,42 +1,54 @@ -switch_t=[ +/* + * 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 . + */ + +switch_finger_t=[ // colum 3 - [ [0,70,50], [37,60,20] ], + [ [0,70,50], [30 ,60,20] , [50, 60, 20] , [70, 60,20] , [95, 60,20] ], // colum 2 - [ [0,40,40], [32,40,10] ], + [ [0,40,40], [30 ,40,10] , [50, 40, 10] , [70, 40,10] , [95, 40,10] ], // colum 2 - [ [0,20,25], [28.5, 20, 5] ], + [ [0,20,25], [28.5,20, 5] , [50, 20, 5] , [70, 20, 5] , [95, 20, 5] ], // colum 1 - [ [0, 0,15], [25,0,0] ] + [ [0, 0,15], [25 ,0 ,0 ] , [50, 0, 0] , [70, 0, 0] , [95, 0, 0] ] ]; -switch_r=[ +switch_finger_r=[ // row 3 - [ [0,0,0], [0,0,-10] ], + [ [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] ], + [ [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] ], + [ [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,0], [0,0,-10] , [0,0,-10] , [0,0,-10] , [0,0,-10] , [0,0,-10] ] ]; switch_thumb_t=[ // colum 2 - [ [0,70,50], [37,60,20] , [37,60,20] ], + [ [-35,-45,15], [-9,-30,15] , [30,-30,15] ], // colum 1 - [ [0,40,40], [32,40,10], [32,40,10] ], + [ [-25,-70,10], [0,-50,10], [30,-50,10] ], ]; -switch_thumb__r=[ - [ [0,0,0], [10,0,-10] , [10,0,-10] ], +switch_thumb_r=[ + [ [0,0,30], [10,0,20] , [10,0,10] ], // row 1 - [ [0,0,0], [10,0,-10] , [0,0,-10] ] + [ [0,0,30], [10,0,20] , [0,0,10] ] ]; switch_keycap=[ - [["mt3", 1], ["SA", 1], ], - [["mt3", 1], ["SA", 1], ], - [["mt3", 1], ["SA", 1], ], - [["mt3", 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],], + [["mt3", 1], ["SA", 1], ["SA", 1],["SA", 1],["SA", 1],], ]; // the trackball diameter itself diff --git a/constant.scad b/constant.scad index 7973089..544c689 100644 --- a/constant.scad +++ b/constant.scad @@ -1,3 +1,15 @@ +/* + * 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 . + */ + $c=0.1; $fn=60; $e=0.01; diff --git a/keycap_gen.scad b/keycap_gen.scad index aac22d6..e860554 100644 --- a/keycap_gen.scad +++ b/keycap_gen.scad @@ -1,3 +1,15 @@ +/* + * 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 . + */ + // the point of this file is to be a sort of DSL for constructing keycaps. // when you create a method chain you are just changing the parameters // key.scad uses, it doesn't generate anything itself until the end. This diff --git a/keycap_stl.scad b/keycap_stl.scad index c26cdff..55f71e5 100644 --- a/keycap_stl.scad +++ b/keycap_stl.scad @@ -1,3 +1,15 @@ +/* + * 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 . + */ + module keycap(type="sa",row=1) { if(type == "sa" || type == "SA" ) { diff --git a/keycaps.scad b/keycaps.scad index 1879f8f..a6bedee 100644 --- a/keycaps.scad +++ b/keycaps.scad @@ -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 . + */ /* [Key] */ //length in units of key diff --git a/kinessis.scad b/kinessis.scad index 0ed0d84..bb6caf1 100644 --- a/kinessis.scad +++ b/kinessis.scad @@ -1,6 +1,5 @@ - // 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 ]]; diff --git a/main.scad b/main.scad index 4b33e72..ad7706f 100644 --- a/main.scad +++ b/main.scad @@ -1,86 +1,19 @@ -use ; - - -// rows - - -finger_colums=[-1,0,1,2,3,4]; -finger_rows = [ - 4, // -1 - 4, // 0 - 4, // 1 - 4, // 2 - 4, // 3 - 4, // 3 -]; -angle_switch_x=[ - [-10,0,10,20,30], // -1 - [-10,0,10,20,30], // 0 - [-10,0,10,20,30], // 1 - [-10,0,10,20,30], // 2 - [-10,0,10,20,30], // 3 - [-10,0,10,20,30], // 4 -]; - -offset_switch_y=[ - [0,0,0,0,0], // -1 - [0,0,0,0,0], // 0 - [0,0,0,0,0], // 1 - [0,0,0,0,0], // 2 - [0,0,0,0,0], // 3 - [0,0,0,0,0], // 4 -]; -offset_switch_z=[ - [0,0,0,0,0], // -1 - [0,0,0,0,0], // 0 - [0,0,0,0,0], // 1 - [0,0,0,0,0], // 2 - [0,0,0,0,0], // 3 - [0,0,0,0,0], // 4 -]; -angle_switch_y=[ - [0,0,0,0,0], // -1 - [0,0,0,0,0], // 0 - [0,0,0,0,0], // 1 - [0,0,0,0,0], // 2 - [0,0,0,0,0], // 3 - [0,0,0,0,0], // 4 -]; -keycaps_row=[ - [3,4,3,2,1,1], // -1 - [3,4,3,2,1,1], // 0 - [3,4,3,2,1,1], // 1 - [3,4,3,2,1,1], // 2 - [3,4,3,2,1,1], // 3 - [3,4,3,2,1,1], // 4 -]; -row_offset=[ - -15.1, -13.1, -13.15, -13.1 -]; - - - -//for(idx_x=[1:len(finger_colums)]) { -for(idx_x=[0:len(finger_colums)-1]) { - for(idx_y=[0:finger_rows[idx_x]-1]) { - // first try - finger_offset=19.0; - //translate([finger_offset*finger_colums[idx_x],finger_offset*idx_y,0]) - //rotate([angle_switch_x[idx_x][idx_y],angle_switch_y[idx_x][idx_y],0]) - // switch($t=$t, travel_max = 4, kap_type="sa", kap_row = keycaps_row[idx_x][idx_y]); - - // second try -// translate([0,0,42]) // lower by radius of keycaps -// rotate([20*(idx_y-2),0,0]) -// translate([0,0,-42]) // lower by radius of keycaps -// translate([0,0,row_offset[keycaps_row[idx_x][idx_y]-1]]) // bring keycaps in heigth -// switch($t=$t, travel_max = 4, kap_type="sa", kap_row = keycaps_row[idx_x][idx_y]); - - // third try - // cos alpha = b/c - translate([0,offset_switch_y[idx_x][idx_y],offset_switch_z[idx_x][idx_y]]) - rotate([angle_switch_x[idx_x][idx_y],angle_switch_y[idx_x][idx_y],0]) - translate([0,0,row_offset[keycaps_row[idx_x][idx_y]-1]]) // bring keycaps in heigth - switch($t=$t, travel_max = 4, kap_type="sa", kap_row = keycaps_row[idx_x][idx_y]); - } -} +/* + * 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 . + */ + +use ; + +include ; +include ; + +switch_holder_plate(switch_finger_r, switch_finger_t,10); +switch_holder_plate(switch_thumb_r, switch_thumb_t, 10); diff --git a/matlab/calc_angle_switch.m b/matlab/calc_angle_switch.m index 343a482..c38a0bc 100644 --- a/matlab/calc_angle_switch.m +++ b/matlab/calc_angle_switch.m @@ -1,3 +1,13 @@ +# +# Copyright 2022 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 . + function [angle_1,angle_2] = calc_angle_switch(idx,range,X,Y,Z) angle_1 = 0; angle_2 = 0; diff --git a/matlab/calc_finger_pos.m b/matlab/calc_finger_pos.m index d75f55d..62c3176 100644 --- a/matlab/calc_finger_pos.m +++ b/matlab/calc_finger_pos.m @@ -1,3 +1,12 @@ +# +# Copyright 2022 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 . function [org] = calc_finger_pos(angles,trans,translate) { org = [0,0,0]; diff --git a/matlab/euklid_dist.m b/matlab/euklid_dist.m index fef53f0..23d6ea3 100644 --- a/matlab/euklid_dist.m +++ b/matlab/euklid_dist.m @@ -1,3 +1,12 @@ +# +# Copyright 2022 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 . function dist=euklid_dist(a,b) v=abs(a-b); dist = sqrt(sum(v.*v)); diff --git a/matlab/find_next_switch_pos.m b/matlab/find_next_switch_pos.m index 08cdd7e..647ed4e 100644 --- a/matlab/find_next_switch_pos.m +++ b/matlab/find_next_switch_pos.m @@ -1,3 +1,12 @@ +# +# Copyright 2022 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 . function [p1,m1] = find_next_switch_pos(start_pos,X,Y,Z,switch_offset) D = []; for i = [1:length(X)] diff --git a/matlab/local_minimas.m b/matlab/local_minimas.m index 686e036..8b70e64 100644 --- a/matlab/local_minimas.m +++ b/matlab/local_minimas.m @@ -1,3 +1,12 @@ +# +# Copyright 2022 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 . function minis = local_minimas( D ) minis = [] for i = [1:length(D)-2] diff --git a/matlab/start.m b/matlab/start.m index 05b48dd..1faaf56 100644 --- a/matlab/start.m +++ b/matlab/start.m @@ -1,3 +1,12 @@ +# +# Copyright 2022 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 . clearvars clear close all diff --git a/matlab/test.m b/matlab/test.m index d09d8dc..af709da 100644 --- a/matlab/test.m +++ b/matlab/test.m @@ -1,3 +1,12 @@ +# +# Copyright 2022 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 . xf = [0:0.05:10]; yf = sin (2*pi*xf/5); xp = [0:10]; diff --git a/pcb/amoeba-royale.scad b/pcb/amoeba-royale.scad index b646fe1..dd8a956 100644 --- a/pcb/amoeba-royale.scad +++ b/pcb/amoeba-royale.scad @@ -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 . + */ amoeba_royale_pcb(); module amoeba_royale_pcb(color_pcb="green") { color(color_pcb) diff --git a/pcb/pmw3360_sensor.scad b/pcb/pmw3360_sensor.scad index a94ffba..edad595 100644 --- a/pcb/pmw3360_sensor.scad +++ b/pcb/pmw3360_sensor.scad @@ -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 . + */ include <../config.scad> include <../constant.scad> diff --git a/pcb/rp2040.scad b/pcb/rp2040.scad index 39f6f1b..3fe7c18 100644 --- a/pcb/rp2040.scad +++ b/pcb/rp2040.scad @@ -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 . + */ include <../config.scad> include <../constant.scad> diff --git a/switch.scad b/switch.scad index 5a31df9..2266827 100644 --- a/switch.scad +++ b/switch.scad @@ -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 . + */ include include diff --git a/switch_cutout.scad b/switch_cutout.scad index f87647b..eb7852a 100644 --- a/switch_cutout.scad +++ b/switch_cutout.scad @@ -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 . + */ include; include; use; diff --git a/switch_holder.scad b/switch_holder.scad index 92ac01f..fdc70f6 100644 --- a/switch_holder.scad +++ b/switch_holder.scad @@ -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 . + */ use ; use ; use ; diff --git a/switch_holder_plate.scad b/switch_holder_plate.scad index a5cc427..d55f7dd 100644 --- a/switch_holder_plate.scad +++ b/switch_holder_plate.scad @@ -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 . + */ include ; include ; @@ -6,215 +17,239 @@ use ; use ; use ; -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 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; thickness = switch_holder_height+1; -ctrl_pts_S = [ // 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 - 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 - 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]), + ]; -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); - sf_thicken(g_S, thickness,"FORWARD"); - //function_grapher(g_S,thickness,"FORWARD"); -} +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] ); + 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"); + } -// 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]) - { - %sphere(d=0.5); + 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"); + //function_grapher(g_S,thickness,"FORWARD"); + } } + + // 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); + } +} + + diff --git a/trackball/trackball.scad b/trackball/trackball.scad index 039ebe7..415c085 100644 --- a/trackball/trackball.scad +++ b/trackball/trackball.scad @@ -1,6 +1,7 @@ /* * Trackball * Copyright 2022 Thomas Buck - thomas@xythobuz.de + * Philipp Schönberger - mail@phschoen.de * * Required parts: * - 1x Raspberry Pi Pico