include include default_laser_holder_padding = [4, 1.5, 1.5]; // d - laser body diameter // l - laser body length // padding - see `laser_holder_wo_holes` for details function laser_holder_size( d = default_laser_d, l = 45, padding = default_laser_holder_padding) = ([d, l / 2, d] + padding * 2); // create a holder for laser with diameter `d` and // length `l`. no holes // with one-side `padding` for each axis module laser_holder_wo_holes( d = default_laser_d, l = 45, padding = default_laser_holder_padding) { translate([0, -l / 2 , 0]) cube(laser_holder_size(d = d, l = l, padding = padding), center = true); } // create a hole for laser holder for laser with diameter `d`. // hole will have diameter `hd` and height `hh` module laser_holder_tension_hole(d = default_laser_d, hd = 4, hh = 4) { //tension_holes_angle = -45; tension_holes_angle = -90; rotate([0, tension_holes_angle, 0]) translate([0, 0, d / 2 - hh / 2]) cylinder($fn = diameterToFn(hd), d = hd, h = hh * 3); } // d - laser body diameter // hd - hole diameter // hh - hole height // padding - see `laser_holder_wo_holes` for details module laser_holder_bottom_hole( d = default_laser_d, hd = 4, hh = 4, padding = default_laser_holder_padding) { //translate([0, -10, -((d + hh) / 2)]) z_padding = $tiny_padding; translate([0, 0, -d / 2 - padding[2] - z_padding]) cylinder($fn = diameterToFn(hd), d = hd, h = hh + z_padding * 2); } // see `laser_holder_bottom_hole` for args details module laser_holder_bottom_holes( d = default_laser_d, l = default_laser_l, hd = 4, hh = 4, padding = default_laser_holder_padding) { x_mults = [-1, +1]; y_mults = [1 / 3, 2 / 3]; union() { for (x_mult = x_mults, y_mult = y_mults) { x = (d / 2 + padding[0] / 2 - $tiny_padding) * x_mult; y = -l * y_mult; translate([x, y, 0]) laser_holder_bottom_hole(); } } } module laser_holder_holes_(d = default_laser_d, l = default_laser_l, d_padding = 0.5) { union() { laser_body(d = d + d_padding); // front tension hole translate([0, -l * 1 / 3, 0]) laser_holder_tension_hole(d=d); // back tension hole translate([0, -l * 2 / 3, 0]) laser_holder_tension_hole(d=d); // bottom holes //laser_holder_bottom_holes(); } } // create a holder for laser with diameter `d` and // length `l`. with holes. // hole for laser has diameter `d` + padding `d_padding` module laser_holder(d = default_laser_d, l = default_laser_l, d_padding = 0.5) { difference() { laser_holder_wo_holes(); laser_holder_holes_(d=d, l=l, d_padding = d_padding); } } //laser_holder_wo_holes(); //*#laser_body(); //laser_holder(); //laser_holder_bottom_holes();