// Invent a really small battery holder I can wedge into the black handle battery_diam = 10; battery_width = 2.5; cylwall=0.48*2; nub=2; nub_x=4.7; nub_y=2.7; poly_x=4*nub_x; poly_y=4*nub_y; leg_thick=1; // Two batt_leg() parts get glued to either side of the batt_ring() to form // the complete battery holder part. This part gets glued into the black // handle (after adding the wires because there is no way to fiddle the // wires easily once the part is glued in). // module batt_leg() { union() { difference() { cube([4,2+battery_diam,leg_thick]); translate([(4-1)/2,-0.01,-1]) cube([1,2.5,leg_thick+2]); translate([(4-1)/2 + 1/2,2.5+battery_diam/2-0.1,leg_thick+1/2]) rotate([95,0,0]) cylinder(h=battery_diam/2, r=1/2, $fn=32); } translate([1,2+battery_diam-1,0]) cube([1,1,battery_width+leg_thick]); } } // This is a part used to help form the space we'll subtract off the black handle. // module solid_batt_leg() { union() { cube([4,2+battery_diam,leg_thick]); translate([1,2+battery_diam-1,0]) cube([1,1,battery_width+leg_thick]); translate([4/2, 0, -1.5/2]) rotate([-90,0,0]) cylinder(h=2+battery_diam,r=1.5/2,$fn=64); translate([2-1.5/2,0,-1.5/2]) cube([1.5,2+battery_diam,0.01+1.5/2]); } } // Here we have a small partial ring with little nubs on the end. It is // springy enough to hold the battery when slipped into it. // module batt_ring() { union() { difference() { // Make a thin cylinder union() { cylinder(h=battery_width, r=cylwall + battery_diam/2, $fn=64); // With a mounting area on top where side peices will be glued. translate([-2,0,0]) cube([4,2+battery_diam/2,battery_width]); } translate([0,0,-1]) cylinder(h=battery_width+2, r=battery_diam/2, $fn=64); // Cut a wedge out of it translate([0,0,-1]) linear_extrude(height=battery_width+2) polygon(points=[[0,0],[poly_x,-poly_y],[-poly_x,-poly_y]]); // Cut slot in mounting area translate([-1, (2+battery_diam/2)-0.99, -1]) cube([2,1,battery_width+2]); } // Put a couple of nubs on the end of the cut wedge translate([nub_x, -nub_y, 0]) cylinder(h=battery_width, r=nub/2, $fn=64); translate([-nub_x, -nub_y, 0]) cylinder(h=battery_width, r=nub/2, $fn=64); } } // Make printable part with the battery ring and two legs which can // be printed, then assembled. // module print_battery() { union() { batt_ring(); translate([-11,-battery_diam/2,0]) batt_leg(); translate([11-4,-battery_diam/2,0]) batt_leg(); } } // Make shell to represent the space the battery part needs, this gets // subtracted off the black handle // module batt_shell() { extra_rad = 1+ cylwall + battery_diam/2; rotate([90,0,0]) translate([0,battery_diam/2,-battery_width/2]) intersection() { union() { batt_ring(); translate([-4/2,-battery_diam/2,0.01-leg_thick]) solid_batt_leg(); translate([0,0,battery_width]) rotate([0,180,0]) translate([-4/2,-battery_diam/2,0.01-leg_thick]) solid_batt_leg(); cylinder(h=battery_width, r=extra_rad, $fn=64); translate([-extra_rad, -extra_rad, 0]) cube([extra_rad*2,extra_rad,battery_width]); } translate([-50,-battery_diam/2,-50]) cube([100,2+battery_diam,100]); } }