--- /dev/null
+wall = 1.5;
+tolerance = 0.5;
+
+infty = 300;
+eps = 0.01;
+
+pcb_w = 80 + 2*tolerance;
+pcb_h = 36 + 2*tolerance;
+pcb_thick = 1.6 + tolerance;
+
+disp_w = 71 + 2*tolerance;
+disp_h = 24 + 2*tolerance;
+disp_thick = 7.2 + tolerance;
+disp_hole_thick = 4 + tolerance;
+
+disp_yoff = -1;
+
+window_w = 68;
+window_h = 18;
+
+ledside_clip_w = disp_h/2;
+
+cable_dist = 5;
+
+trimpot_w = 7.5 + 1.5;
+trimpot_h = 6.5 + 1.5;
+trimpot_hole = 4;
+trimpot_xoff = 11;
+trimpot_yoff = 3.25;
+
+frame_thick = 6 + tolerance;
+support_w = 0.75;
+
+module box_body() {
+ translate([-pcb_w/2 - wall, -pcb_h/2 - wall, 0])
+ cube([pcb_w + 2*wall, pcb_h + 2*wall,
+ cable_dist + pcb_thick + disp_thick + wall]);
+ translate([-pcb_w/2 - wall, , 0])
+ cube([pcb_w + 2*wall, pcb_h/2 + wall,
+ frame_thick + 2*cable_dist + pcb_thick + disp_thick + 2*wall]);
+};
+
+module box() {
+ difference() {
+ box_body();
+ // front hole
+ hull() {
+ translate([-window_w/2-wall, disp_yoff-window_h/2-wall, -eps])
+ cube([window_w+2*wall, window_h+2*wall, eps]);
+ translate([-window_w/2, disp_yoff-window_h/2, wall])
+ cube([window_w, window_h, eps]);
+ };
+ // display hole
+ translate([-disp_w/2, disp_yoff - disp_h/2, wall])
+ cube([disp_w, disp_h, frame_thick + 2*cable_dist + pcb_thick + disp_thick]);
+ // pcb hole
+ translate([-pcb_w/2, -pcb_h/2, wall + disp_hole_thick])
+ cube([pcb_w, pcb_h, frame_thick + 2*cable_dist + pcb_thick + disp_thick + wall + eps - disp_hole_thick]);
+ // trimpot slot
+ translate([pcb_w/2-trimpot_xoff-trimpot_w/2, pcb_h/2-trimpot_h, wall])
+ cube([trimpot_w, trimpot_h, disp_thick+eps]);
+ // trimpot hole
+ translate([pcb_w/2-trimpot_xoff, pcb_h/2-trimpot_yoff, -eps])
+ cylinder(r1 = trimpot_hole/2 + wall,
+ r2 = trimpot_hole/2, h = wall + 2*eps);
+ // hole for the frame
+ translate([-pcb_w/2-wall-eps, support_w, cable_dist + pcb_thick + disp_thick + wall])
+ cube([pcb_w + 2*wall + 2*eps, pcb_h/4 - support_w, frame_thick]);
+ };
+ // LED-side battery clip
+ hull() {
+ translate([-pcb_w/2, -ledside_clip_w/2,
+ wall + pcb_thick + disp_thick])
+ cube([wall, ledside_clip_w, wall]);
+ translate([-pcb_w/2, -ledside_clip_w/2,
+ 3*wall + pcb_thick + disp_thick])
+ cube([eps, ledside_clip_w, eps]);
+ };
+ // LED-side battery clip
+ translate([pcb_w/2-wall, -pcb_h/2-eps, wall + pcb_thick + disp_thick])
+ cube([wall, pcb_h + 2*eps, wall]);
+
+};
+
+box($fn = 128);
+