chiark / gitweb /
b84f08d40960d4ccf7403a17670e625f9950616d
[reprap-play.git] / digispark-with-cable.scad
1 // -*- C -*-
2
3 include <utils.scad>
4
5 //tongue_w = 11.92 + 0.4;
6
7 usb_w = 12.01 + 0.19;
8 usb_wall_w = 0.51;
9 usb_tongue_d = 8.97 - 0.2;
10 usb_tongue_w_slop = +0.5;
11 usb_wall_h = 4.54 - 2.04;
12 usb_ceil_th = 0.425;
13
14 side_wall_th = 1.5;
15
16 board_l = 17.56 + 0.2;
17 board_w = 19.14 + 0.2;
18 board_th = 1.92 + 0.1;
19
20 sw_to_edge = board_w/2 + 0.1;
21
22 front_wall_th = 0.75;
23 // egress_w = 8.0;
24
25 wall_y_min = -board_l - side_wall_th; // XXXX remove
26 main_y_min = -board_l - side_wall_th;
27 ceil_y_min = wall_y_min - 5;;
28
29 small_walls = [
30                [ [0, 0], [-sw_to_edge, -1.0] ],
31                [ [sw_to_edge-4.5, -4.5], [sw_to_edge, -5.7] ],
32 //             [ [3.0, -11.72],              [sw_to_edge, -13.38] ],
33                [ [-sw_to_edge+3.85, -14.90], [sw_to_edge, -13.38] ],
34                ];
35 chip_cutout = [[ -sw_to_edge + 4.20,    -3.75 ],
36                [ -sw_to_edge + 11.95,  -11.90 ]];
37
38 strain_w = 2.0 + 0.5;
39 strain_t = 1.0 + 0.5;
40 strain_pitch_across = 5;
41 strain_pitch_along = 10;
42 strain_groove_d = 2;
43 strain_groove_w = 3;
44
45 fit_gap_z = 0.5;
46
47 // calculated
48
49 top_top_z = usb_wall_h;
50 top_base_z = -board_th;
51
52 strain_0_y_c = main_y_min - strain_w/2;
53 strain_1_y_c = strain_0_y_c - strain_pitch_along;
54 total_y_min = strain_1_y_c - strain_w/2 - side_wall_th;
55
56 bottom_wall_top_z = (top_top_z + top_base_z) * 0.5 - fit_gap_z/2;
57 cover_wall_top_z  = (top_top_z + top_base_z) * 0.5 + fit_gap_z/2;
58
59 bop_side_wall_x = +board_w/2 + side_wall_th;
60
61 module BothSides(){
62   for (m=[0,1]) {
63     mirror([m,0]) {
64       children();
65     }
66   }
67 }
68 module FrontWallsPlan(slop) {
69   BothSides(){
70     rectfromto([ -board_w/2 - side_wall_th,    0             ],
71                [ -usb_w/2 - slop,              front_wall_th ]);
72   }
73 }
74 module TopSmallWallsPlan() {
75   for (m=[0,1]) {
76     mirror([m,0]) {
77       rectfromto([ -usb_w/2,              -0.01        ],
78                  [ -usb_w/2 + usb_wall_w, usb_tongue_d ]);
79     }
80   }
81   FrontWallsPlan(0);
82   for (w=small_walls) {
83     rectfromto(w[0], w[1]);
84   }
85 }
86 module TopCeilPlan() {
87   difference(){
88     BothSides(){
89       rectfromto([ -usb_w/2,              -0.01        ],
90                  [ 0.1,                   usb_tongue_d ]);
91       rectfromto([ -board_w/2 - side_wall_th, 0            ],
92                  [ 0.1,                       ceil_y_min   ]);
93     }
94     rectfromto(chip_cutout[0], chip_cutout[1]);
95   }
96 }
97 module TopMainWallsPlan() {
98   BothSides(){
99     rectfromto([ -board_w/2 - side_wall_th, 0          ],
100                [ -board_w/2,                wall_y_min ]);
101   }
102   FrontWallsPlan(usb_tongue_w_slop);
103   rectfromto([ -board_w/2 - side_wall_th + 0, -      board_l   ],
104              [ +board_w/2 + side_wall_th,            total_y_min ]);
105 }
106
107 module Top(){ ////toplevel
108   difference(){
109     union(){
110       linextr(0, usb_wall_h)
111         TopSmallWallsPlan();
112       linextr(usb_wall_h - usb_ceil_th, usb_wall_h)
113         TopCeilPlan();
114       linextr(-board_th, usb_wall_h)
115         TopMainWallsPlan();
116     }
117
118     for (y_c = [strain_0_y_c, strain_1_y_c]) {
119       for (x_c = [-1,+1] * strain_pitch_across/2) {
120         translate([x_c, y_c, 0])
121           linextr(-20, 20)
122           square([ strain_t, strain_w ], center=true);
123       }
124     }
125     linextr_y_xz(total_y_min-1, main_y_min)
126       translate([0, top_base_z])
127       scale([1, strain_groove_d/strain_groove_w])
128       circle(strain_groove_w/2, $fn = 8);
129   }
130 }
131
132 module BottomMainElevation(){ ////toplevel
133   difference(){
134 //    rectfromto([ 
135   }
136 }
137 module Bottom(){ ////toplevel
138 }