/* This is a box to hold a 110v switch for the 3D printer SG-1 from electronicgeeks.com. The box goes under the powersupply and covers the power supply and cover the wires. */ // allviews box // viewsopts h2 // testviews test-switch test-switch-back include include <../cadlib.h> len=122; width=51; height=58; height1=45; switchw=13.5; switchl=29; // This is the minimum hole to let the switch in module boxtong(pos){ holeh=33.5; difference(){ translate([len-pos-5,width-5,0]) cube([15,5,holeh+5]); translate([len-pos,width-6,holeh]) rotate([-90,0,0]) cylinder(r=1.6,h=10,$fn=20); } } module box(){ difference(){ cube([len,width,height]); union(){ // Remove the interior translate([-1,1,1]) cube([len,width,height]); // A hole for the switch translate([len-5,5+switchw/2,height1/2-switchl/2]) cube([10,switchw,switchl]); // A hole for the wire translate([len-5,width-10,10]) rotate([0,90,0]) cylinder(r=4,h=10,$fn=20); // A hole for the screw translate([len-5,9,height1+(height-height1)/2]) rotate ([0,90,0]) cylinder(r=2,h=10,$fn=20); } } // Make the hole for the wire stronger difference(){ translate([len-5,width-10-8,0]) cube([5,18,17]); translate([len-6,width-10,10]) rotate([0,90,0]) cylinder(r=4,h=10,$fn=20); } // Make the face holding the switch stronger translate([len-5,28,0]) cube([5,5,height1]); // Make the whole box a bit stronger translate([0,0,1]) rotate([0,90,0]) quarter_concave(width,1,20,4); translate([len/2,0,1]) rotate([0,90,0]) quarter_concave(width,1,20,4); // Plate going on the interior side of the powersupply // so a screw hold the box in place difference(){ union(){ translate([len-5,0,height1]) cube([5-2.5,20,height-height1]); translate([len-5,0,height1-2]) cube([4,20,2]); // Help to print, a progressive width translate([len-5,20,height1-2]) rotate([180,0,0]) intersection(){ cube([4,20,4]); rotate([0,45,0]) cube([10,20,10]); } } translate([len-5,9,height1+(height-height1)/2]) rotate ([0,90,0]) cylinder(r=1.6,h=10,$fn=20); } // place two tong to screw the box from the inside of the printer boxtong(98+5); boxtong(58+5); } module view2(){ } module main_view(view){ if (view=="box"){ box(); }else if (view=="test-switch"){ intersection(){ box(); translate([len-10,-1,-1]) cube([15,width+2,height+2]); } }else if (view=="test-switch-back"){ translate([0,0,width]) rotate([-90,0,0]) intersection(){ box(); translate([0,width-2,-1]) cube([len,10,height+2]); } } }