case.scad: mods after the first testing print
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Thu, 16 Jan 2014 09:07:40 +0000 (10:07 +0100)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Thu, 16 Jan 2014 09:07:40 +0000 (10:07 +0100)
However, I may do it in a completely different way after all.

case.scad

index 2b5a351..6a000e8 100644 (file)
--- a/case.scad
+++ b/case.scad
@@ -1,32 +1,51 @@
+/* TODO
+- vybrani pro otevreni
+- mozna sirsi misto na baterku?
+- vetsi vybrani pro baterku ve vicku
+- kuzelova dira pro tlacitka
+- jine diry pro uchyceni
+- zvetsit vybrani na strane tlacitek
+- mozna prilis velky klip zasunovaciho konce baterky
+- diry pro neizolovany drat muzou byt mensi
+- sirsi zakladna
+- mensi horni cast klipu baterky - pri 0.7 je sirka nahore 16 mm.
+*/
+
+lowres = 1;
+
 // 18650 is ~18mm diameter, ~65mm length, 
-batt_diam = 18 + 0.3;
-batt_len = 65+1;
-batt_clip_h = 0.75 * batt_diam;
+batt_diam = 18 + 0.6;
+batt_len = 65 + 1.5;
 wall = 2.2;
-base_h = 4;
+base_h = 3;
 cable_sep = 2.5;
 
+
 eps = 0.01;
 infty = 300;
 
-pcb_len = 36;
-pcb_thick = 1.3;
-pcb_groove = 2;
-pcb_width = 11;
+pcb_len = 36 + 1;
+pcb_thick = 1.2 + 0.3;
+pcb_groove = 1;
+pcb_width = 11 + 0.5;
+
+batt_clip_h = base_h + pcb_width - pcb_groove;
 
-wire_thick = 2;
-wire_sep = 3;
-cable_out_diam = 4;
+wire_thick = 2.2;
+wire_sep = 3.5;
+cable_out_diam = 5.2;
 
-side_protrusion_len = 10;
-side_protrusion_diam = 2;
+pcbside_protrusion_len = 20;
+pcbside_protrusion_diam = 2.5;
+battside_protrusion_len = 10;
+battside_protrusion_diam = 2;
 
-base_batt_extend = wall+pcb_thick; // extend the base on the battery side
+base_batt_extend = wall + pcb_thick; // extend the base on the battery side
 
-cover_sep = 0.2;
+cover_sep = 0.1;
 
-uswitch_diam = 2.5;
-led_diam = 3.2;
+uswitch_diam = 2.5 + 0.5;
+led_diam = 3 + 0.5;
 s2_xoff = -160 * 25.4/1000;
 led_xoff = 90 * 25.4/1000;
 s1_xoff = 340 * 25.4/1000;
@@ -40,23 +59,23 @@ module base() {
                        cube([batt_len + 2*wall + 2*cable_sep, batt_diam + 2*wall, base_h], center=true);
                        // under the PCB
                        translate([0, -batt_diam/2-wall-pcb_thick/2-wall/2, 0])
-                               cube([pcb_len + 2*wall, pcb_thick + wall + eps, base_h], center=true);
+                               cube([batt_len + 2*wall, pcb_thick + wall + eps, base_h], center=true);
                        // battery-side extension
-                       translate([0, batt_diam/2 + wall + base_batt_extend, -base_h/4+side_protrusion_diam/4])
-                               cube([batt_len + 2*wall, eps, base_h/2+side_protrusion_diam/2], center=true);
+                       translate([0, batt_diam/2 + wall + base_batt_extend, 0])
+                               cube([batt_len + 2*wall, eps, base_h], center=true);
                };
        };
 }
 module base_protrusions() {
        // pcb-side side protrusion
-       translate([-side_protrusion_len/2, -batt_diam/2-2*wall-pcb_thick, base_h/2])
+       translate([-pcbside_protrusion_len/2, -batt_diam/2-2*wall-pcb_thick, base_h-pcbside_protrusion_diam/2])
                rotate([0, 90, 0])
-               cylinder(r = side_protrusion_diam/2, h = side_protrusion_len, $fn = 6);
+               cylinder(r = pcbside_protrusion_diam/2, h = pcbside_protrusion_len, $fn = 6);
        
        // battery-side side protrusion
-       translate([-side_protrusion_len/2, batt_diam/2+wall+base_batt_extend, base_h/2])
+       translate([-battside_protrusion_len/2, batt_diam/2+wall+base_batt_extend, base_h-battside_protrusion_diam/2])
                rotate([0, 90, 0])
-               cylinder(r = side_protrusion_diam/2, h = side_protrusion_len, $fn = 6);
+               cylinder(r = battside_protrusion_diam/2, h = battside_protrusion_len, $fn = 6);
 };
 
 module pcb_clips() {
@@ -71,16 +90,16 @@ module pcb_clips() {
 module batt_clips() {
        difference() {
                union() {
-                       // rear part of the battery clip
-                       translate([-(batt_len/2-pcb_len/2+pcb_groove+wall)/2-pcb_len/2+pcb_groove, 0, batt_clip_h/2+wall/2])
-                               cube([batt_len/2-pcb_len/2+pcb_groove + wall, batt_diam + 2*wall, batt_clip_h + wall], center=true);
-                       // front (+) part of the battery clip
+                       // frot + rear part of the battery clip
+                       for (r = [0, 180]) {
+                       rotate([0, 0, r])
                        translate([batt_len/2+wall/2, 0, batt_clip_h/2+wall/2])
                                hull() {
                                        cube([wall, batt_diam + 2*wall, batt_clip_h + wall], center=true); 
-                                       translate([-10/2, 0, -batt_clip_h/2])
-                                       cube([10, batt_diam+2*wall, wall], center=true);
+                                       translate([-15/2, 0, -batt_clip_h/2])
+                                       cube([15, batt_diam+2*wall, wall], center=true);
                                };
+                       }
                        // middle clips
                        translate([pcb_clip_off+pcb_clip_w/2, 0, batt_clip_h/2+wall/2])
                                hull() {
@@ -88,6 +107,13 @@ module batt_clips() {
                                        translate([0, 0, -batt_clip_h/2])
                                        cube([2*pcb_clip_w, batt_diam+2*wall, wall], center=true);
                                };
+                       // pcb holder - pcb side only
+                       translate([-pcb_len/2-wall, -batt_diam/2-wall, 0])
+                               hull() {
+                                       cube([pcb_groove + wall, batt_diam/2 + wall, base_h + pcb_width + wall - pcb_groove]);
+                                       translate([-3*(pcb_groove+wall), 0, 0])
+                                       cube([4*(pcb_groove+wall), batt_diam/2 + wall, base_h]);
+                               };
                }
                // top part rounded
                difference() {
@@ -129,7 +155,7 @@ module main() {
                        cylinder(r=wire_thick/2, h = infty, $fn=6);
 
                // holes for wire from battery to the PCB
-               translate([-infty/2, -batt_diam/2, wall + pcb_groove + wire_thick/2])
+               translate([-infty/2, -batt_diam/2, base_h + wire_thick/2])
                        rotate([0, 90, 0])
                        rotate([0, 0, 90])
                        cylinder(r=wire_thick/2, h = infty, $fn=6);
@@ -147,6 +173,11 @@ module main() {
                                        cylinder(r=wire_thick/2, h=infty, $fn=6);
                        };
                };
+               // hole for easy opening
+               translate([-battside_protrusion_len/2, batt_diam/2+wall+base_batt_extend, base_h-3*battside_protrusion_diam/2])
+               rotate([0, 90, 0])
+               cylinder(r = battside_protrusion_diam/2, h = battside_protrusion_len, $fn = 4);
+               
        };
 };
 
@@ -154,9 +185,12 @@ module cover_internal() {
        hull() { 
                base();
                // battery + wall + cable space
-               translate([-batt_len/2-wall, 0, batt_diam/2+wall])
+               translate([-batt_len/2, 0, batt_diam/2+wall])
                        rotate([0, 90, 0])
-                       cylinder(r=batt_diam/2+wall, h = batt_len + 2*wall);
+                       cylinder(r=batt_diam/2, h = batt_len);
+               // battery top
+               translate([0, 0, wall + batt_clip_h])
+                       cube([batt_len+2*wall + cable_sep, batt_diam + 2*wall, eps], center=true);
                // space for PCB
                translate([-pcb_len/2-wall, -batt_diam/2-2*wall-pcb_thick, base_h-pcb_groove])
                        cube([pcb_len+2*wall, wall+pcb_thick, pcb_width+wall]);
@@ -166,21 +200,24 @@ module cover_internal() {
 module cover_hole() {
        difference() {
                cover_internal();
-               translate([-infty/2, -infty/2, wall + batt_clip_h])
-                       cube(infty);
+               for (r = [0, 180]) {
+                       rotate([0, 0, r]) 
+                       translate([batt_len/2, -infty/2, wall + batt_clip_h])
+                               cube(infty);
+               }
        };
        base_protrusions();
-       // battery();
-       translate([-batt_len/2-cable_sep, 0, batt_diam/2+wall])
-               rotate([0, 90, 0])
-               cylinder(r=batt_diam/2, h = batt_len + 2*cable_sep);
 };
 
 module cover() {
        difference() {
                minkowski() {
                        cover_internal();
-                       sphere(wall+cover_sep, $fn=16);
+                       if (lowres == 1) {
+                               sphere(wall+cover_sep, $fn=6);
+                       } else {
+                               sphere(wall+cover_sep, $fn=16);
+                       }
                }
                minkowski() {
                        cover_hole();
@@ -206,13 +243,20 @@ module cover() {
 translate([0, -19, 0])
        main($fn=128);
 
-// translate([0, -40, 0])
-//     cover_hole();
+/*
+translate([0, 19, 0])
+       cover_hole();
+*/
 
 // cover($fn=128);
 // translate([0, 17, batt_diam + 3*wall + cover_sep])
 // rotate([180, 0, 0])
 //     cover($fn=128);
 
-translate([0, 19, 0])
-       cover($fn=128);
+translate([0, 19, 0]) {
+       if (lowres == 1) {
+               cover($fn=16);
+       } else {
+               cover($fn=128);
+       }
+}