| 1 | // simple spinner control for a 5 3/8 inch by 8 1/2 inch project box |
| 2 | // from the craft store. |
| 3 | |
| 4 | |
| 5 | panel_height = (5 + 1/2) * 25.4; |
| 6 | panel_width = (8 + 5/8) * 25.4; |
| 7 | wall_width = 7.5; |
| 8 | |
| 9 | |
| 10 | |
| 11 | button_d = (1 + 1/8) * 25.4; |
| 12 | button_spacing = 36; // based on https://www.slagcoin.com/joystick/layout.html |
| 13 | $button_d = button_d; |
| 14 | |
| 15 | module line (pos0, pos1, width=0.5) { |
| 16 | hull () { |
| 17 | translate (pos0) circle (width); |
| 18 | translate (pos1) circle (width); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | module button (bezel = $button_d+4, lines=true) { |
| 23 | if (lines) { |
| 24 | line ([-bezel/2, 0], [bezel/2, 0]); |
| 25 | line ([0, -bezel/2], [0, bezel/2]); |
| 26 | } |
| 27 | // line (); |
| 28 | difference () { |
| 29 | circle (d=$button_d); |
| 30 | circle (d=$button_d-2); |
| 31 | } |
| 32 | circle (d = $button_d/4); |
| 33 | %circle(d=bezel); |
| 34 | } |
| 35 | |
| 36 | module panel_layout () { |
| 37 | // buttons |
| 38 | translate ([panel_width/5, panel_height/2]) { |
| 39 | translate ([0, 0]) button (); |
| 40 | translate ([button_spacing, -button_spacing/2]) button (); |
| 41 | } |
| 42 | |
| 43 | // spinner |
| 44 | translate ([panel_width-panel_width/5, panel_height-panel_height/4]) { |
| 45 | translate ([0, 0]) button (); |
| 46 | } |
| 47 | |
| 48 | |
| 49 | } |
| 50 | |
| 51 | module panel_outline () { |
| 52 | difference () { |
| 53 | square ([panel_width, panel_height]); |
| 54 | translate ([wall_width/2, wall_width/2]) square ([panel_width-wall_width, panel_height-wall_width]); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | union () { |
| 59 | panel_outline (); |
| 60 | panel_layout (); |
| 61 | } |
| 62 | |
| 63 | |
| 64 | |
| 65 | // centering aid for drilling pilot hole |
| 66 | |
| 67 | module template_button (bezel = $button_d+4) { |
| 68 | difference () { |
| 69 | circle (d=$button_d); |
| 70 | circle (d = 3); |
| 71 | } |
| 72 | |
| 73 | } |
| 74 | |
| 75 | //linear_extrude (3) template_button ($fa=0.1, $fs=0.1); |