include box_width=30; box_height=12; box_border_width=0.5; rounding_edge=1; screw_offset=2.7; box_hull=1.5; led_diameter=8; led_margin=1.5; led_box_height=2.5; led_ring=0.5; wire_diam=1.0; wire_cache=0.6; wire_offset=10; wire_height=3; m14_head=2.5; m14_hole=1.5; m2_head_diam=3.8; m2_head_height=1.4; m2_hole=2.1; fn=64; module WireCache(wire_count){ difference(){ cuboid([wire_count*wire_diam+2*wire_cache,wire_diam+2*wire_cache,wire_cache*2], rounding=wire_cache+wire_diam/2, edges = "Z",$fn=fn); cuboid([wire_count*wire_diam,wire_diam,wire_cache*2+0.1], rounding=wire_diam/2, edges = "Z",$fn=fn); }; } module Module(){ difference(){ union() { color("red"){ difference(){ union(){ cuboid([box_width,box_width,box_height], rounding=rounding_edge,$fn=fn); translate([0,0,-box_border_width/2]) cuboid([box_width+2*box_border_width,box_width+2*box_border_width,box_border_width], rounding=rounding_edge+box_border_width, edges = "Z",$fn=fn); } union(){ for (r = [ 0 : 90 : 360 ]){ rotate([0,0,r]){ translate([box_width/2-(1.5*rounding_edge+m14_head/2+box_border_width),-box_width/2-box_border_width,0]) cuboid([m14_head+box_border_width,m14_head+box_border_width,6], rounding=m14_head/2+box_border_width/2, $fn=fn); translate([-box_width/2+(1.5*rounding_edge+m14_head/2+box_border_width),-box_width/2-box_border_width,0]) cuboid([m14_head+box_border_width,m14_head+box_border_width,6], rounding=m14_head/2+box_border_width/2, $fn=fn); translate([box_width/2-screw_offset,box_width/2-screw_offset,box_height/2]) cylinder(h=m2_head_height,r=m2_head_diam/2,center=true,$fn=fn); translate([box_width/2-screw_offset,box_width/2-screw_offset,box_height/2]) cylinder(h=5,r=m2_hole/2,center=true,$fn=fn); } } cuboid([box_width-2*box_hull,box_width-2*box_hull,box_height-2*box_hull], rounding=rounding_edge, edges = "Z",$fn=fn); } } for (r = [ 0 : 90 : 360 ]){ rotate([0,0,r]){ difference(){ union(){ translate([box_width/2-(1.5*rounding_edge+m14_head/2+box_border_width),-box_width/2-box_border_width,-box_border_width]) cylinder(h=box_border_width,r=m14_head/2+box_border_width,$fn=fn); translate([box_width/2-(1.5*rounding_edge+m14_head/2+box_border_width),-box_width/2-box_border_width,0]) cylinder(h=box_border_width,r=m14_head/2+box_border_width/2,$fn=fn); } translate([box_width/2-(1.5*rounding_edge+m14_head/2+box_border_width),-box_width/2-box_border_width,-box_border_width-0.1]) cylinder(h=3*box_border_width-0.1,r=m14_hole/2,$fn=fn); } difference(){ union(){ translate([-box_width/2+(1.5*rounding_edge+m14_head/2+box_border_width),-box_width/2-box_border_width,-box_border_width]) cylinder(h=box_border_width,r=m14_head/2+box_border_width,$fn=fn); translate([-box_width/2+(1.5*rounding_edge+m14_head/2+box_border_width),-box_width/2-box_border_width,0]) cylinder(h=box_border_width,r=m14_head/2+box_border_width/2,$fn=fn); } translate([-box_width/2+(1.5*rounding_edge+m14_head/2+box_border_width),-box_width/2-box_border_width,-box_border_width-0.1]) cylinder(h=3*box_border_width-0.1,r=m14_hole/2,$fn=fn); } } } rotate([90,0,90]) translate([0,wire_height,box_width/2]) WireCache(4); } rotate([0,0,45]){ translate([0,0,box_height/2]){ color("red") translate([0,0,led_box_height/2-rounding_edge/2]) cuboid([3*led_diameter+2*led_margin+6*led_ring,led_diameter+2*led_margin+2*led_ring,led_box_height+rounding_edge], rounding=rounding_edge,$fn=fn); color("red") rotate([90,0,0]) translate([wire_offset,wire_diam/2+wire_cache,led_diameter/2+led_margin+led_ring]) WireCache(4); color("red") translate([-led_diameter-2*led_ring,0,led_box_height]) cylinder(h=led_ring,r=led_diameter/2+led_ring,$fn=fn); color("red") translate([0,0,led_box_height]) cylinder(h=led_ring,r=led_diameter/2+led_ring,$fn=fn); color("red") translate([led_diameter+2*led_ring,0,led_box_height]) cylinder(h=led_ring,r=led_diameter/2+led_ring,$fn=fn); /* translate([-led_diameter-2*led_ring,0,led_box_height+led_ring/2]) sphere(led_diameter/2,$fn=fn); translate([0,0,led_box_height+led_ring/2]) sphere(led_diameter/2,$fn=fn); translate([led_diameter+2*led_ring,0,led_box_height+led_ring/2]) sphere(led_diameter/2,$fn=fn); */ } } } union(){ rotate([0,0,45]){ translate([0,0,box_height/2]){ union(){ translate([0,0,led_box_height/2-rounding_edge/2-box_hull]) cuboid([3*led_diameter+2*led_margin+6*led_ring-2*box_hull,led_diameter+2*led_margin+2*led_ring-2*box_hull,led_box_height+rounding_edge], rounding=rounding_edge, edges = "Z",$fn=fn); rotate([90,0,0]) translate([wire_offset,wire_diam/2+wire_cache,led_diameter/2+led_margin+led_ring]) cuboid([4*wire_diam,wire_diam,5], rounding=wire_diam/2,$fn=fn); translate([-led_diameter-2*led_ring,0,0]) cylinder(h=led_box_height+led_ring+0.001,r=led_diameter/2,$fn=fn); cylinder(h=led_box_height+led_ring+0.001,r=led_diameter/2,$fn=fn); translate([led_diameter+2*led_ring,0,0]) cylinder(h=led_box_height+led_ring+0.001,r=led_diameter/2,$fn=fn); } } } rotate([90,0,90]) translate([0,wire_height,box_width/2]) cuboid([4*wire_diam,wire_diam,5], rounding=wire_diam/2, edges = "Z",$fn=fn); } } } difference(){ Module(); //translate([0,0,box_height-0.001]) // cube([1.5*box_width,1.5*box_width,2*box_height],center=true); }