]> www.fi.muni.cz Git - heater.git/blobdiff - case.scad
case.scad: improvements from the second testing print
[heater.git] / case.scad
index b1e5a3f61ddab292b1731be9170bda8aed93defe..e4acfcb8313a0df44c1b116dc14586a280b7a10e 100644 (file)
--- a/case.scad
+++ b/case.scad
@@ -1,15 +1,20 @@
-lowres = 0;
+/* TODO
+   - nabeh zaklapavaciho hranolu by mel byt zkoseny
+   - vystup pro kabel leze do vystupu pro snuru pri vetsim wall
+   - diry pro uchyceni jsou mozna prilis male
+*/
+lowres = 1; // fast rendering or fine printing with print-friendly orientation
 
 eps = 0.01;
 infty = 300;
 
-wall = 1.5; // generic wall thickness
+wall = 2.0; // generic wall thickness
 
 // 18650 is ~18mm diameter, ~65mm length, 
 batt_diam = 18 + 0.6;
 batt_len = 65 + 1.5;
 
-cable_sep = 1;
+cable_sep = 2;
 
 // front flat area
 front_flat_len = batt_len + 4*wall + 2*cable_sep;
@@ -30,7 +35,7 @@ cable_out_diam = 5.2;
 
 batt_end_h = wire_sep/2 + wire_thick/2 + 1.5;;
 
-lid_sep = 0.5; // the lid is made this much smaller to separate from the body
+lid_sep = 0.1; // the lid is made this much smaller to separate from the body
 
 sw_diam = 2.5 + 0.5;
 led_diam = 3 + 0.5;
@@ -40,6 +45,9 @@ pcb_xoff = 90 * 25.4/1000; // offset of the LED from the middle of the PCB
 prg_len = 10; // programming connector
 prg_width = 7;
 
+rear_clip_hole_dist = 10; // distance between the holes in the rear clip
+rear_clip_aspect = 0.35; // w/h aspect ratio of the ellipse of the rear clip
+
 module case_body() {
        hull() {
                translate([-batt_len/2-2*wall-cable_sep, -batt_diam/2-wall, 0])
@@ -57,6 +65,12 @@ module case_body() {
                        -batt_diam/2-2*pcb_comp_h-pcb_thick-wall])
                        cube([front_flat_len, pcb_width+wall, eps]);
        };
+       for (x = [-1, 1]) scale([x, 1, 1]) hull() {
+               for (x0 = [0-wall, 10+wall])
+                       translate([batt_len/2-wall-wire_thick-x0, batt_diam/2, 0])
+                               rotate([-90, 0, 0]) scale([rear_clip_aspect, 1, 1])
+                               cylinder(r=batt_diam/2 + 2*wall + wire_thick, h=wall);
+               };
 };
 
 module case() {
@@ -148,15 +162,15 @@ module case() {
                        translate([0, batt_diam/2 - pcb_width,
                                -batt_diam/2-pcb_comp_h-pcb_thick])
                                cube([wall + cable_sep + eps, pcb_width, eps]);
-                       translate([cable_sep, batt_diam/2 - pcb_width + 1.5*wall,
+                       translate([cable_sep, batt_diam/2 - pcb_width + wall,
                                -batt_diam/2-pcb_comp_h-pcb_thick-wall])
                                cube([wall + eps, pcb_width-2*wall, eps]);
                };
                // cable lead to battery contacts
                for (x=[1, -1]) scale([x, 1, 1])
                        rotate([-140, 0, 0])
-                       translate([batt_len/2+wire_thick/2, 0, batt_diam/2-2*wall])
-                               cylinder(r=wire_thick/2, h = 5);
+                       translate([batt_len/2+wire_thick/2, 0, batt_diam/2-2.7])
+                               cylinder(r=wire_thick/2, h = 5.4);
                
                // mounting holes
                for(x=[-1,1]) scale([x, 1, 1])
@@ -164,13 +178,13 @@ module case() {
                        vert_torus();
                        
                for (x = [-1, 1]) scale([x, 1, 1]) for (x0 = [0, 10])
-                       translate([batt_len/2-wall-wire_thick-x0, 0, batt_end_h-wire_thick/2])
+                       translate([batt_len/2-wall-wire_thick-x0, 0, batt_diam/2+wire_thick/2+wall])
                        rotate([-90, 0, 0])
                        scale([2,1,1]) cylinder (r=wire_thick/2, h=infty, $fn=16);
        };
        // clip barrier
        for (x = [-1, 1]) scale([x, 1, 1])
-               translate([batt_len/2+wall-eps, batt_diam/2-pcb_width+wall+lid_sep,
+               translate([batt_len/2+wall-eps, batt_diam/2-pcb_width+wall/2+lid_sep,
                        -batt_diam/2-pcb_thick-pcb_comp_h + wall + lid_sep])
                        cube([cable_sep+eps, pcb_width-2*wall-2*lid_sep, wall]);
 };
@@ -195,6 +209,12 @@ module lid_body() {
                        translate([cable_sep+wall/2, batt_diam/2 - pcb_width + 1.5*wall +lid_sep,
                                batt_diam/2+pcb_comp_h+pcb_thick+wall/2-lid_sep])
                                cube([wall/2-lid_sep, pcb_width-2*wall-2*lid_sep, eps]);
+                       // rear cone
+                       translate([cable_sep+wall-lid_sep, 0, -batt_diam/2-wall]) difference() {
+                               scale([0.5, 1, 1])
+                               cylinder(r = batt_diam/2 - lid_sep,  h = eps);
+                               translate([-infty, -infty/2, -infty/2]) cube(infty);
+                       };
                };
 };
 
@@ -213,6 +233,13 @@ module lid() {
                        translate([-batt_len/2-cable_sep-wall, batt_diam/2-pcb_width+0.5*wall+0.5*lid_sep, batt_diam/2 + pcb_comp_h+pcb_thick-wall-lid_sep])
                        cube([batt_len + 2*wall + 2* cable_sep, pcb_width-1.5*wall-1.5*lid_sep, eps]);
                };
+               // holes for the mounting clips on the body
+               for (x = [-1, 1]) scale([x, 1, 1]) hull() {
+               for (x0 = [0-wall, 10+wall])
+                       translate([batt_len/2-wall-wire_thick-x0, batt_diam/2-lid_sep+eps, 0])
+                               rotate([-90, 0, 0]) scale([rear_clip_aspect, 1, 1])
+                               cylinder(r=batt_diam/2 + 2*wall + wire_thick+lid_sep/rear_clip_aspect, h=wall+lid_sep+eps);
+               };
        };
 };