From: Jan "Yenya" Kasprzak Date: Wed, 26 Nov 2014 22:26:13 +0000 (+0100) Subject: case.scad: version for metal springs X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=4b77d03b555d38074ebf95a39ce9137ba09cc56f;p=heater.git case.scad: version for metal springs --- diff --git a/case.scad b/case.scad index 596b0da..43583c4 100644 --- a/case.scad +++ b/case.scad @@ -22,13 +22,11 @@ pcb_comp_h = 2.2; // height of the components on board pcb_comp_h2 = 4.5; // height of the components on board - component side pcb_groove = 1; -body_top_h = 0.35 * batt_diam; // cube-shaped part of the body +body_top_h = 0.38 * batt_diam; // cube-shaped part of the body -wire_thick = 2.2; +wire_thick = 2.5; wire_sep = 3.5; -batt_end_h = wire_sep/2 + wire_thick/2 + 1.5;; - lid_sep = 0.2; // the lid is made this much smaller to separate from the body // sw_diam = 2.5 + 0.5; @@ -54,6 +52,11 @@ clip_pretension = 0.5; plus_width = 4.5; // width of the + sign +batt_contact_w = 12; +clip_cyl_r = 1; +batt_end_h = body_top_h - 4*clip_cyl_r;; + + module case_body() { hull() { translate([-batt_len/2-2*wall-cable_sep, -batt_diam/2-wall, 0]) @@ -100,7 +103,19 @@ module case() { // rotate([20, 0, 0]) translate([-batt_len/2, -batt_diam/2, 0]) cube([batt_len, batt_diam, batt_diam]); - + // upper longer cube-shaped part + difference() { + translate([-batt_len/2-cable_sep-wall, -batt_diam/2, batt_end_h]) + cube([batt_len+2*cable_sep+2*wall, batt_diam, batt_diam]); + for (x = [-1,1]) scale([x, 1, 1]) + translate([batt_len/2 + wall + cable_sep, -infty/2, batt_end_h + 3*clip_cyl_r]) + rotate([-90, 0, 0]) + cylinder(r = clip_cyl_r, h = infty, $fn=4); + } + // grabbing holes + for (x=[-1,1]) scale([x,1,1]) + translate([batt_len/2 + 2*wall + cable_sep+10-wall, 0, 0]) + cylinder(r1 = 7, r2 = 10-wall/4, h = body_top_h + eps); // battery cylinder for the lower part translate([-batt_len/2, 0, 0]) rotate([0, 90, 0]) @@ -153,68 +168,25 @@ module case() { translate([-sw_xoff, 0, 0]) cylinder(r=sw_diam/2, h=infty, $fn=6); }; - // space under the wire holes for battery contacts - translate([-batt_len/2-2*wall-cable_sep-eps, 0, 0]) - difference() { - rotate([0, 90, 0]) - cylinder(r = batt_diam/2-wall, h = batt_len + 4*wall + 2*cable_sep + 2*eps); - translate([-infty/2, -infty/2, -batt_end_h]) - cube(infty); - }; - // space above the wire holes for battery contacts - translate([-batt_len/2-2*wall-cable_sep-eps, -batt_diam/2, batt_end_h]) - cube([batt_len + 4*wall + 2*cable_sep + 2*eps, - batt_diam, - batt_end_h]); - // wire holes for battery contacts - for (x = [-1, 1]) - for (y = [-1, 1]) - translate([-batt_len/2-wall-eps, x*wire_sep/2, y*wire_sep/2]) - rotate([0, 90, 0]) - cylinder(r = wire_thick/2, h = batt_len + 2*wall + 2*eps, $fn=6); // wire hole from PCB to battery contacts - // translate([-batt_len/2-wall-eps, 0, -batt_diam/2-pcb_comp_h + wire_thick/2]) - rotate([40, 0, 0]) - translate([-batt_len/2-wall-eps, 0, -batt_diam/2 - wall/2 - wire_thick/2]) - rotate([0, 90, 0]) - cylinder(r = wire_thick/2, h = batt_len + 2*wall + 2*eps, $fn=6); - // hole behind the battery contacts - for(x=[1, -1]) - scale([x, 1, 1]) translate([batt_len/2+wall+cable_sep, 0, 0]) hull() { - translate([0, -batt_diam/2, 0]) - cube([wall + eps, batt_diam, infty]); - rotate([0, 90, 0]) - cylinder(r = batt_diam/2, h = wall+eps); - translate([0, batt_diam/2 - pcb_width, - -batt_diam/2-pcb_comp_h-pcb_thick]) - cube([wall + eps, pcb_width, eps]); - translate([0, batt_diam/2 - pcb_width + 0.5*wall, - -batt_diam/2-pcb_comp_h-pcb_comp_h2-pcb_thick]) - cube([wall + eps, pcb_width-0.5*wall, eps]); - }; - // inner hole behind the battery contacts - for(x=[1, -1]) - scale([x, 1, 1]) translate([batt_len/2+wall, 0, 0]) hull() { - translate([0, -batt_diam/2+wall, 0]) - cube([cable_sep + eps, batt_diam-2*wall, infty]); - rotate([0, 90, 0]) - cylinder(r = batt_diam/2-wall, h = cable_sep+eps); - }; - // cable lead to battery contacts - for (x=[1, -1]) scale([x, 1, 1]) - rotate([-140, 0, 0]) - translate([batt_len/2-eps, -wire_thick/2, batt_diam/2-2.7]) - cube([wall+cable_sep+2*eps, wire_thick, 5.4]); - + rotate([-48, 0, 0]) + translate([-batt_len/2-wall-cable_sep, 0, -wire_thick/2-wall/2]) + cube([batt_len + 2*wall + 2* cable_sep, batt_diam/2 + wire_thick + wall, wire_thick]); // mounting holes for(x=[-1,1]) scale([x, 1, 1]) translate([batt_len/2-mounthole_w/2, batt_diam/2+wall+mounthole_h/2, -infty/2]) scale([1, mounthole_h/mounthole_w, 1]) cylinder(r = mounthole_w/2, h = infty); - // grabbing gap + // holes in front of battery contacts for(x=[-1,1]) scale([x, 1, 1]) - translate([batt_len/2+cable_sep+wall+10, batt_diam/2-pcb_width/2, -batt_diam/2-pcb_comp_h-pcb_comp_h2-pcb_thick-wall-eps]) - cylinder(r1 = 10, r2 = 10 - wall, h = wall + 2*eps); + translate([batt_len/2-eps, wall/2-batt_contact_w/2, + wall/2-batt_contact_w/2]) + cube([wall+2*eps, batt_contact_w-wall, infty]); + // holes for battery contacts + for(x=[-1,1]) scale([x, 1, 1]) + translate([batt_len/2+wall-eps, -batt_contact_w/2, + -batt_contact_w/2]) + cube([cable_sep+2*eps, batt_contact_w, infty]); // internal plus sign - vertical line translate([-batt_len/2 + 0.5*wall+plus_width/2, -plus_width/2, -batt_diam/2-wall]) cube([wall, plus_width, infty]); @@ -231,86 +203,33 @@ module case() { translate([sw_xoff + sw_diam/2 + wall, batt_diam/2-pcb_width/2-wall/2, -batt_diam/2-pcb_thick-pcb_comp_h-pcb_comp_h2-wall-eps]) cube([plus_width, wall, wall/2]); }; - // clip barrier - for (x = [-1, 1]) scale([x, 1, 1]) hull () { - translate([batt_len/2+wall+cable_sep-eps, batt_diam/2-pcb_width+wall/2+lid_sep, - -batt_diam/2-pcb_thick-pcb_comp_h + wall + lid_sep]) - cube([wall+eps, pcb_width-2*wall-2*lid_sep, wall]); - translate([batt_len/2+wall+cable_sep-eps, batt_diam/2-pcb_width+3*wall/2+lid_sep, - -batt_diam/2-pcb_thick-pcb_comp_h + 3*wall + lid_sep]) - cube([eps, pcb_width-4*wall-2*lid_sep, eps]); - }; }; module lid_body() { - translate([-batt_len/2 - wall - cable_sep - lid_sep, -batt_diam/2+lid_sep, -batt_diam/2 -wall]) - cube([batt_len + 2*wall + 2*cable_sep + 2*lid_sep, batt_diam-2*lid_sep, batt_diam/2 - batt_end_h + wall - lid_sep]); - hull () { - translate([-batt_len/2 - 2*wall - cable_sep, - -batt_diam/2, -batt_diam/2-wall]) - cube([batt_len + 4*wall + 2*cable_sep, - batt_diam, eps]); - translate([-batt_len/2 - 3*wall - cable_sep, - -batt_diam/2 - wall, -body_top_h-wall/2-lid_sep]) - cube([batt_len + 6*wall + 2*cable_sep, - batt_diam + 2*wall, wall/2]); - }; - // clip behind the battery contacts - for(x=[1, -1]) - scale([x, 1, 1]) translate([batt_len/2+wall+cable_sep+lid_sep, 0, 0]) hull() { - translate([0, -batt_diam/2+lid_sep, -batt_diam/2]) - cube([wall-lid_sep, batt_diam-2*lid_sep, eps]); - rotate([0, 90, 0]) - cylinder(r = batt_diam/2-lid_sep, h = wall-lid_sep); - translate([-clip_pretension, batt_diam/2 - pcb_width + 0.5*wall + lid_sep, - batt_diam/2+pcb_comp_h+pcb_comp_h2+pcb_thick-lid_sep]) - cube([wall+clip_pretension, pcb_width-0.5*wall-1.5*lid_sep, eps]); - }; - // outer part of the clip behind the battery contacts - for (x=[1, -1]) scale([x, 1, 1]) translate([batt_len/2+2*wall+cable_sep+lid_sep, 0, 0]) hull() { - translate([0, -batt_diam/2 - wall, -body_top_h-wall/2-lid_sep]) - cube([wall-lid_sep, batt_diam + 2*wall, wall/2]); - difference() { - scale([0.3, 1, 1]) - sphere(batt_diam/2+wall); - translate([-infty/2, -infty/2, -infty-body_top_h-lid_sep+2*wall]) - cube(infty); - translate([-infty-clip_pretension, -infty/2, -infty/2]) - cube(infty); - }; - translate([-clip_pretension, - batt_diam/2 - pcb_width, - batt_diam/2+pcb_comp_h+pcb_comp_h2+pcb_thick+wall]) - cube([wall-lid_sep, pcb_width+wall, eps]); + // outer part + hull() { + // smaller outermost part + translate([-batt_len/2 - wall - cable_sep, -batt_diam/2, -batt_diam/2 - wall]) + cube([batt_len + 2*wall + 2*cable_sep, batt_diam, eps]); + // this part goes above the main body + translate([-batt_len/2 - 2*wall - cable_sep, -batt_diam/2-wall, -body_top_h - lid_sep]) + cube([batt_len + 4*wall + 2*cable_sep, batt_diam+2*wall, eps]); }; -}; + // the part which goes inside the main body + translate([-batt_len/2 - wall - cable_sep + lid_sep, -batt_diam/2+lid_sep, -batt_diam/2 -wall]) + cube([batt_len + 2*wall + 2*cable_sep - 2*lid_sep, batt_diam-2*lid_sep, batt_diam/2 - batt_end_h + wall - lid_sep]); + // clips + for (x = [-1, 1]) scale([x, 1, 1]) + translate([batt_len/2 + wall + cable_sep - lid_sep, batt_diam/2 - lid_sep, -batt_end_h-lid_sep-clip_cyl_r]) + rotate([90, 0, 0]) + cylinder(r = clip_cyl_r, h = batt_diam-2*lid_sep, $fn = 4); +} module lid() { difference() { lid_body(); - translate([-batt_len/2+eps, 0, 0]) rotate([0, 90, 0]) - cylinder(r=batt_diam/2, h=batt_len-2*eps); - // clip barrier - for (x = [-1, 1]) scale([x, 1, 1]) hull () { - translate([batt_len/2+wall+cable_sep-clip_pretension, batt_diam/2-pcb_width+wall/2, - batt_diam/2+pcb_thick+pcb_comp_h-2*wall]) - cube([wall+clip_pretension+eps, pcb_width-2*wall, wall]); - translate([batt_len/2+wall+cable_sep-eps, batt_diam/2-pcb_width+wall/2, - batt_diam/2+pcb_thick+pcb_comp_h-4*wall + lid_sep]) - cube([eps, pcb_width-2*wall, eps]); - }; -/* - hull() { - difference() { - translate([-batt_len/2-cable_sep-wall, 0, 0]) rotate([0, 90, 0]) - cylinder(r=batt_diam/2-wall-lid_sep, h=batt_len+2*wall+2*cable_sep); - translate([-infty/2, -batt_diam/2, -infty-wire_sep/2-wire_thick/2]) - cube([infty, batt_diam, infty]); - }; - 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]); - }; -*/ + translate([-batt_len/2-lid_sep, 0, 0]) rotate([0, 90, 0]) + cylinder(r=batt_diam/2 + lid_sep, h=batt_len+2*lid_sep); }; };