2 Commits

Author SHA1 Message Date
  phschoen f1e361cf72 add more rounded cubes and pre/post z rotate for the switches 1 year ago
  phschoen 4c279668f9 add for loop for sw position and orientation 1 year ago
1 changed files with 60 additions and 124 deletions
  1. 60
    124
      hardware/trackball.scad

+ 60
- 124
hardware/trackball.scad View File

@@ -149,6 +149,8 @@ sensor_lens_off = 10.97;
149 149
 mx_co_w = 14.0;
150 150
 mx_co_w_add = 0.8;
151 151
 mx_co_h = 14.0;
152
+mx_co_keycap_w = mx_co_w + 2.5*2;
153
+mx_co_keycap_h = mx_co_h + 2.5*2;
152 154
 mx_co_h_off_1 = 1.0;
153 155
 mx_co_h_off_2 = 3.5;
154 156
 mx_co_h_off_3 = mx_co_h - 2 * (mx_co_h_off_1 + mx_co_h_off_2);
@@ -179,7 +181,7 @@ roller_thread_hole = roller_dia - 1;
179 181
 roller_small_hole = sphere_r_at_h(roller_ball_hold_off, roller_dia / 2) * 2;
180 182
 
181 183
 roller_ridge_h = 1.5;
182
-roller_mount_angle_off = 90;
184
+roller_mount_angle_off = 90-5;
183 185
 roller_mount_dia = roller_thread_dia + 2.0;
184 186
 
185 187
 ball_h = 15; // todo
@@ -190,30 +192,14 @@ roller_mount_holder_gap = 0.8;
190 192
 sensor_pcb_mount_gap = 2.0;
191 193
 
192 194
 sensor_pcb_support_h = 1.6 + 3.4;
193
-
194
-sw1_rot_x = -5;
195
-sw1_rot_z = -30 * (left_hand_version ? -1 : 1);
196
-sw1_trans_x = 0;
197
-sw1_trans_y = -base_dia / 2 - 0;
198
-sw1_trans_z = -17;
199
-
200
-sw2_rot_x = -5;
201
-sw2_rot_z = 15 * (left_hand_version ? -1 : 1);
202
-sw2_trans_x = 0;
203
-sw2_trans_y = -base_dia / 2 - 0;
204
-sw2_trans_z = -17;
205
-
206
-sw3_rot_x = -5;
207
-sw3_rot_z = 125 * (left_hand_version ? -1 : 1);
208
-sw3_trans_x = 0;
209
-sw3_trans_y = -base_dia / 2 - 0;
210
-sw3_trans_z = -17;
211
-
212
-sw4_rot_x = -5;
213
-sw4_rot_z = -125 * (left_hand_version ? -1 : 1);
214
-sw4_trans_x = 0;
215
-sw4_trans_y = -base_dia / 2 - 0;
216
-sw4_trans_z = -17;
195
+//         rotate                                     translate
196
+sw = [   // x z_pre_T z_post_T
197
+        [ [-5,      0, -33 * (left_hand_version ? -1 : 1)], [0,-base_dia / 2 - 2,-14.5]],// thumb
198
+        [ [-5,    -15,   3 * (left_hand_version ? -1 : 1)], [0,-base_dia / 2 - 2,-14.5]],// thumb
199
+        //[ [-5,      0, -70 * (left_hand_version ? -1 : 1)], [0,-base_dia / 2 - 0,-14.5]],// thumb
200
+        [ [-5,    -15, 140 * (left_hand_version ? -1 : 1)], [0,-base_dia / 2 - 3,-14.5]],// middle
201
+        [ [-5,      0, 100 * (left_hand_version ? -1 : 1)], [0,-base_dia / 2 - 2,-14.5]],// ring
202
+    ];
217 203
 
218 204
 sw_mount_w = mx_co_w + 7;
219 205
 sw_mount_co_l = 10;
@@ -278,7 +264,12 @@ module mx_switch_cutout(h) {
278 264
         
279 265
         translate([mx_co_w_add - mx_co_b_add / 2, -mx_co_b_add / 2, -1])
280 266
         cube([mx_co_b_w, mx_co_b_h, h - mx_co_th + 1]);
267
+        
281 268
     }
269
+    
270
+    
271
+    translate([-mx_co_keycap_w/2,-mx_co_keycap_h/2, h])
272
+    cube([mx_co_keycap_w, mx_co_keycap_h, 50]);
282 273
 }
283 274
 
284 275
 module mx_switch_test() {
@@ -565,6 +556,15 @@ module roller_mount_tri() {
565 556
     roller_mount_sensor_pcb_support();
566 557
 }
567 558
 
559
+module fully_rounded_cube(p,r,center) {
560
+    for(x=[r,p[0]-r],
561
+        y=[r,p[1]-r],
562
+        z=[r,p[2]-r]
563
+    ){
564
+        translate([x,y,z])
565
+        sphere(r,$fn=$fn/8);
566
+    }
567
+}
568 568
 module trackball_top() {
569 569
     translate([0, 0, ball_dia / 2 + ball_h]) {
570 570
         if (draw_ball_roller)
@@ -573,31 +573,15 @@ module trackball_top() {
573 573
         difference() {
574 574
             color("orange")
575 575
             hull() {
576
+                r=4;
576 577
                 roller_mount_tri_hull();
577
-                
578
-                rotate([0, 0, sw1_rot_z])
579
-                translate([sw1_trans_x, sw1_trans_y, sw1_trans_z])
580
-                rotate([90 + sw1_rot_x, 0, 0])
581
-                translate([0, 0, -0.5])
582
-                cube([sw_mount_w, sw_mount_w, 1], center = true);
583
-                
584
-                rotate([0, 0, sw2_rot_z])
585
-                translate([sw2_trans_x, sw2_trans_y, sw2_trans_z])
586
-                rotate([90 + sw2_rot_x, 0, 0])
587
-                translate([0, 0, -0.5])
588
-                cube([sw_mount_w, sw_mount_w, 1], center = true);
589
-                
590
-                rotate([0, 0, sw3_rot_z])
591
-                translate([sw3_trans_x, sw3_trans_y, sw3_trans_z])
592
-                rotate([90 + sw3_rot_x, 0, 0])
593
-                translate([0, 0, -0.5])
594
-                cube([sw_mount_w, sw_mount_w, 1], center = true);
595
-                
596
-                rotate([0, 0, sw4_rot_z])
597
-                translate([sw4_trans_x, sw4_trans_y, sw4_trans_z])
598
-                rotate([90 + sw4_rot_x, 0, 0])
599
-                translate([0, 0, -0.5])
600
-                cube([sw_mount_w, sw_mount_w, 1], center = true);
578
+                for ( i = [0:len(sw)-1] ){
579
+                    rotate([0,0,sw[i][0][2]])
580
+                    translate(sw[i][1])
581
+                    rotate([90+sw[i][0][0],0,sw[i][0][1]])
582
+                    translate([-sw_mount_w/2-r, -sw_mount_w/2-r, -r-r/2])
583
+                    fully_rounded_cube([sw_mount_w+r*2, sw_mount_w+r*2, 0], r);
584
+                }
601 585
             }
602 586
             
603 587
             roller_mount_tri_body();
@@ -606,65 +590,19 @@ module trackball_top() {
606 590
             translate([0, -base_dia / 2 - 1, -40])
607 591
             cube([base_dia / 2 + 1, base_dia + 2, 40]);
608 592
             
609
-            rotate([0, 0, sw1_rot_z])
610
-            translate([sw1_trans_x, sw1_trans_y, sw1_trans_z])
611
-            rotate([90 + sw1_rot_x, 0, 0])
612
-            translate([0, 0, -sw_mount_co_l]) {
613
-                mx_switch_cutout(sw_mount_co_l + 1);
614
-                
615
-                translate([0, 0, 2])
616
-                rotate([90, 0, 0])
617
-                cylinder(d = 4, h = 20);
618
-            }
619
-            
620
-            rotate([0, 0, sw2_rot_z])
621
-            translate([sw2_trans_x, sw2_trans_y, sw2_trans_z])
622
-            rotate([90 + sw2_rot_x, 0, 0])
623
-            translate([0, 0, -sw_mount_co_l]) {
624
-                mx_switch_cutout(sw_mount_co_l + 1);
625
-                
626
-                translate([0, 0, 2])
627
-                rotate([90, 0, 0])
628
-                cylinder(d = 4, h = 20);
629
-            }
630
-            
631
-            rotate([0, 0, sw3_rot_z])
632
-            translate([sw3_trans_x, sw3_trans_y, sw3_trans_z])
633
-            rotate([90 + sw3_rot_x, 0, 0])
634
-            translate([0, 0, -sw_mount_co_l]) {
635
-                mx_switch_cutout(sw_mount_co_l + 1);
636
-                
637
-                translate([0, 0, 2])
638
-                rotate([90, 0, 0])
639
-                cylinder(d = 4, h = 20);
640
-            }
641
-            
642
-            rotate([0, 0, sw4_rot_z])
643
-            translate([sw4_trans_x, sw4_trans_y, sw4_trans_z])
644
-            rotate([90 + sw4_rot_x, 0, 0])
645
-            translate([0, 0, -sw_mount_co_l]) {
646
-                mx_switch_cutout(sw_mount_co_l + 1);
647
-                
648
-                translate([0, 0, 2])
649
-                rotate([90, 0, 0])
650
-                cylinder(d = 4, h = 20);
651
-            }
652 593
             
653
-            /*
654
-            hull() {
655
-                rotate([0, 0, sw1_rot_z])
656
-                translate([sw1_trans_x, sw1_trans_y, sw1_trans_z])
657
-                rotate([90 + sw1_rot_x, 0, 0])
658
-                translate([0, 0, -sw_mount_co_l + 5])
659
-                mx_switch_cutout(sw_mount_co_l - 10);
660
-                
661
-                rotate([0, 0, sw2_rot_z])
662
-                translate([sw2_trans_x, sw2_trans_y, sw2_trans_z])
663
-                rotate([90 + sw2_rot_x, 0, 0])
664
-                translate([0, 0, -sw_mount_co_l + 5])
665
-                mx_switch_cutout(sw_mount_co_l - 10);
594
+            for ( i = [0:len(sw)-1] ){
595
+                rotate([0,0,sw[i][0][2]])
596
+                translate(sw[i][1])
597
+                rotate([90+sw[i][0][0],0,sw[i][0][1]])
598
+                translate([0, 0, -sw_mount_co_l]) {
599
+                    mx_switch_cutout(sw_mount_co_l + 1);
600
+                    
601
+                    translate([0, 0, 2])
602
+                    rotate([90, 0, 0])
603
+                    cylinder(d = 4, h = 20);
604
+                }
666 605
             }
667
-            */
668 606
             
669 607
         
670 608
             for (r = screw_angles)
@@ -672,29 +610,27 @@ module trackball_top() {
672 610
             translate([screw_off, 0, -ball_dia / 2 - 11 -1]) {
673 611
                 cylinder(d = screw_insert_dia, h = screw_insert_h + 1);
674 612
             }
613
+            
614
+            
615
+            
675 616
         }
676 617
         
677 618
         roller_mount_sensor_pcb_support();
678 619
     
679
-        if (draw_switches) {
680
-            %rotate([0, 0, sw1_rot_z])
681
-            translate([sw1_trans_x, sw1_trans_y, sw1_trans_z])
682
-            rotate([90 + sw1_rot_x, 0, 0])
683
-            mx_switch($t);
684
-        
685
-            %rotate([0, 0, sw2_rot_z])
686
-            translate([sw2_trans_x, sw2_trans_y, sw2_trans_z])
687
-            rotate([90 + sw2_rot_x, 0, 0])
620
+        if (draw_switches)
621
+        for ( i = [0:len(sw)-1] ){
622
+            rotate([0,0,sw[i][0][2]])
623
+            translate(sw[i][1])
624
+            rotate([90+sw[i][0][0],0,sw[i][0][1]])
625
+            translate([0, 0, 1.])
688 626
             mx_switch($t);
689
-        
690
-            %rotate([0, 0, sw3_rot_z])
691
-            translate([sw3_trans_x, sw3_trans_y, sw3_trans_z])
692
-            rotate([90 + sw3_rot_x, 0, 0])
693
-            mx_switch($t);
694
-        
695
-            %rotate([0, 0, sw4_rot_z])
696
-            translate([sw4_trans_x, sw4_trans_y, sw4_trans_z])
697
-            rotate([90 + sw4_rot_x, 0, 0])
627
+        }
628
+        if (draw_keycap)
629
+        for ( i = [0:len(sw)-1] ){
630
+            rotate([0,0,sw[i][0][2]])
631
+            translate(sw[i][1])
632
+            rotate([90+sw[i][0][0],0,sw[i][0][1]])
633
+            translate([0, 0, 1.])
698 634
             mx_switch($t);
699 635
         }
700 636
     }

Loading…
Cancel
Save