aboutsummaryrefslogtreecommitdiff
path: root/adclock.scad
blob: 3f332417ea38a0e12f1fb3ae7ca031dc325f67a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
 /*
  * Copyright 2021, tslil clingman
  *
  * This program is free software: you can redistribute it and/or modify it under
  * the terms of the GNU General Public License as published by the Free Software
  * Foundation, either version 3 of the License.
  *
  * 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.
  *
  * You should have received a copy of the GNU General Public License along with
  * this program. If not, see <https://www.gnu.org/licenses/>.
  */

// Adjustments
magic_x=-0.60;
magic_y=+0.35;

display_height=19.2+1;
pcb_width=27.7+1;
pcb_height=28; // not so important, no adjustment

bezel_height=15;
height=2*pcb_height+bezel_height*2;
body_depth=20;
wall_width=4;
width=pcb_width+wall_width;

column_dim=5;

cap_s=0.1;
cap_height=2.5;

side_w=15;
side_s=0.12;

base_height=5;
base_width=width*2.2;
base_s=0.20;

module mirror_copy(v=[1,0,0]) {
  children();
  mirror(v) children();
}

module body(depth) {
  // Body
  translate([-width/2,0,0])
    cube([width,depth,height]);
  // Side things
      mirror_copy() {
        color("grey")
          for (k=[1:3]) {
            factor=1-side_s*k;
            angle=5*k;
            translate([width/2-tan(angle/k)*height*factor,
                       depth-depth*factor*factor,
                       0])
              rotate([0,angle,0])
              cube([side_w*factor*factor,
                    depth*factor*factor,
                    height*factor]);
          }
      }
      // Base
      for (k=[0:1]) {
        w=base_width*(1+k*base_s);
        translate([-w/2,
                   -column_dim/2-depth*k*base_s,
                   -base_height*(1+k)])
          cube([w,depth*(1+k*base_s)+column_dim/2,base_height]);
      }
      // Cap
      translate([0,0,height])
        for (k=[0:3]) {
          factor=1-cap_s*k;
          w=width*factor;
          d=depth*factor;
          translate([-w/2,depth-d,cap_height*k])
            cube([w,d,cap_height]);
        }
      // Triangles on sides
      color("grey")
        mirror_copy()
        translate([width/2,depth,0])
        rotate([90,0,0])
        linear_extrude(height=depth+column_dim/2)
        polygon(points=[[0,0],[0,height/3],[(base_width-width)/3,0]]);
}

module front() {
  difference() {
    union() {
      body(body_depth);

      // Top triangle
      $fn=4;
      color("grey")
        translate([0,0,height-width/4])
        rotate([90,0,0])
        cylinder(r=width/4,h=column_dim/2);
      // Text
      color("grey") {
        rotate([90,0,0]) {
          translate([0,(bezel_height-wall_width)/2,0]) {
            linear_extrude(height=column_dim/5) {
              text("MINUTES",size=5,
                   font="EB Garamond",
                   halign="center",
                   valign="center",
                   $fn=100);
              translate([0, (bezel_height-wall_width)/2+
                            (height+display_height)/4,
                         0])
                text("HOURS",size=6,
                     font="EB Garamond",
                     halign="center",
                     valign="center",
                     $fn=100);
            }
          }
        }
      }
      // Straps
      mirror_copy() {
        color("gold") {
          $fn=20;
          translate([(width-column_dim)/2,-column_dim/2,0]) {
            cube([column_dim,column_dim,height]);
            translate([0,column_dim/2,height]) {
              rotate([0,90,0])
                cylinder(r=column_dim/2,h=column_dim);
              translate([0,0,-column_dim/2])
                cube([column_dim,body_depth,column_dim]);
            }
          }
        }
      }
    }
    // Cut away component space
    translate([(wall_width-width)/2,0,0]) {
      union() {
        // Display areas
        translate([0, -0.1, bezel_height-wall_width]) {
          // Bottom window
          cube([pcb_width,body_depth+2,display_height]);
          // Top window
          translate([0,0,(height-display_height)/2])
            cube([pcb_width,body_depth+2,display_height]);
        }
        // Inside
        translate([0, wall_width, 0])
          cube([width-wall_width,body_depth+2,height-column_dim/2]);
      }
    }
  }
}

back_pcb_width = 20.1+1;
back_pcb_height = 91.5+1;
back_button_dim = 6.25+1;
back_button1_z = 43.67;
back_button2_z = 8.82+back_button_dim+back_button1_z;
back_inner_depth = 20; // minimum governed by usb connector depth
usb_pcb_width = 14.20;
usb_pcb_depth = 15.10;
usb_con_height = 4.1;
screw_diam = 2+0.5;
screw_head_diam = 3.8+0.5;
screw_countersink_depth = 1.4+0.5;

module back() {
  mirror([0,1,0]) {
    difference(){
      union(){
        body(back_inner_depth);
        // different straps
        mirror_copy() {
          translate([-width/2,
                     -column_dim/2,
                     height-column_dim/2]) {
            cube([width/2,column_dim,column_dim]);
            translate([0,column_dim/2,0]) {
              cylinder(r=column_dim/2,h=column_dim,$fn=20);
              translate([-column_dim/2,0,0])
                cube([column_dim,
                      back_inner_depth,
                      column_dim]);
            }
          }
        }
      }
      // we have to cut away the triangle part a bit
      translate([-width,-column_dim,0])
        cube([width*2,column_dim,height-column_dim/2]);
      // make room for PCB, buttons
      translate([0,0,height-back_pcb_height-column_dim/2]) {
        // PCB
        translate([-back_pcb_width/2,wall_width,0])
          cube([back_pcb_width,back_inner_depth,back_pcb_height]);
        // button holes
        translate([-back_button_dim/2,-1,0]) {
          translate([0,0,back_button1_z])
            cube([back_button_dim,wall_width+2,back_button_dim]);
          translate([0,0,back_button2_z])
            cube([back_button_dim,wall_width+2,back_button_dim]);
        }
      }
      // usb connector area
      translate([back_pcb_width/2-1,-body_depth,-base_height*2-1])
        cube([usb_pcb_width+2,
              body_depth*3,
              usb_con_height+2]);
      // side screw holes
      mirror_copy() {
        $fn=20;
        translate([width/2+(base_width-width)/3-wall_width,
                   -1, screw_head_diam/2]) {
          // Outer shaft
          rotate([-90,0,0])
            cylinder(r=screw_head_diam/2,
                     h=back_inner_depth-screw_countersink_depth+1);
          // Inner
          translate([0,back_inner_depth-screw_countersink_depth,0])
            rotate([-90,0,0])
            cylinder(r=screw_diam/2,h=screw_countersink_depth+2);
        }
      }
      // top screw hole
      translate([0,-column_dim/2-1,height]) {
        $fn=20;
        rotate([-90,0,0])
          cylinder(r=screw_head_diam/2,
                   h=back_inner_depth+column_dim/2
                     -screw_countersink_depth+1);
        translate([0,back_inner_depth-screw_countersink_depth+column_dim/2])
          rotate([-90,0,0])
          cylinder(r=screw_diam/2,h=screw_countersink_depth+2);

      }

    }
  }
  // text
  rotate([90,0,180]) {
    translate([0,0,0]) {
      linear_extrude(height=column_dim/5) {
        translate([0,height-column_dim,0])
          text("for",size=7,
               font="EB Garamond",
               halign="center",
               valign="top",
               $fn=100);
        translate([0,height-column_dim-15,0])
          text("Claire",size=7,
               font="EB Garamond",
               halign="center",
               valign="bottom",
               $fn=100);
        translate([0,22,0])
          text("on the",size=7,
               font="EB Garamond",
               halign="center",
               valign="bottom",
             $fn=100);
        translate([0,12,0])
        text("occasion",size=7.5,
             font="EB Garamond",
             halign="center",
             valign="bottom",
             $fn=100);
        translate([0,2,0])
        text("of her ABD",size=8,
             font="EB Garamond",
             halign="center",
             valign="bottom",
             $fn=100);
      }
    }
  }
}

front();
translate([0,back_inner_depth+body_depth,0])
    back();