/* * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * Jeroen Domburg wrote this file. As long as you retain * this notice you can do whatever you want with this stuff. If we meet some day, * and you think this stuff is worth it, you can buy me a beer in return. * ---------------------------------------------------------------------------- */ //All measurements in mm $fa=8; //segments/360 degrees $fs=0.1; //min size of fragment $fn=32; //override amount of facets scale=50/300; //1-to-6 wall=2.5; //real mms overlap=5; //real mms; overlap between halves overlapth=1.5; //real mms: thickness of material in overlap //1 - cutout //2 - full render //3 - intersection case - pcb //4 - front half / back half //5 - front half / back half side-by-side //6 - back //7 - front type=6; if (type==1) { difference() { union() { mac_half_front(wall, scale, overlap, overlapth); translate([0,1,0]) mac_half_back(wall, scale, overlap, overlapth); } translate([125*scale, -500, -500]) cube([1000, 1000, 1000], false); } displaypcb(wall, scale); translate([0,1,0]) usbserpcb_mounted(wall); } else if (type==2) { union() { mac_half_front(wall, scale, overlap, overlapth); mac_half_back(wall, scale, overlap, overlapth); } displaypcb(wall, scale); usbserpcb_mounted(wall); } else if (type==3) { intersection() { union() { mac_half_front(wall, scale, overlap, overlapth); mac_half_back(wall, scale, overlap, overlapth); } displaypcb(wall, scale); } } else if (type==4 || type==5) { translate([0, 10, 0]) union() { mac_half_back(wall, scale, overlap, overlapth); usbserpcb_mounted(wall); } rotate([0,0,type==5?180:0]) union () { mac_half_front(wall, scale, overlap, overlapth); *color("red") displaypcb(wall, scale); } } else if (type==6) { mac_half_back(wall, scale, overlap, overlapth); } else if (type==7) { mac_half_front(wall, scale, overlap, overlapth); } module mac_half_front(wall, scale, overlap, overlapth) { union() { scale(scale) union() { difference() { mac_hull(wall/scale); mac_crack_divider(); } intersection() { mac_overlap_inner_edge(overlapth/scale); difference() { mac_crack_divider_expanded(-0.8/scale); mac_crack_divider_expanded(overlap/scale); } } } difference() { union() { //bottom screen tab translate([17+wall, -1, 8]) rotate([-20, 0, 0]) cube([10, 2, 3]); //top tab translate([14.5+wall, 1, 50]) cube([4, 5, 3]); } displaypcb(wall, scale); } } } module mac_half_back(wall, scale, overlap, overlapth) { union() { difference() { union() { scale(scale) difference() { intersection() { mac_hull(wall/scale); mac_crack_divider(); } intersection() { mac_overlap_inner_edge(overlapth/scale); difference() { mac_crack_divider(); mac_crack_divider_expanded(overlap/scale); } } } //front tab for usb-ser conv translate([wall, 37.7-26-2, 0]) cube([16, 2, wall+1.7]); //back tabs for usb-ser conv translate([0, 37-5, wall+1.9]) cube([16+wall, 7, 3]); } usb_hole(wall); mouse_hole(wall); usbserpcb_mounted(wall); } //Enable for signatures in backplate //Disabled because 3d-printer doesn't really show these... //translate([wall, 38.2, 8+wall]) rotate([90, 0, 0]) scale(.2) linear_extrude(height = 3.3) import(file = "signatures.dxf"); } } module usb_hole(wall) { w=3; //extra width for bevel i=0.2; //inset of bevel translate([16+wall,37.7,wall]) rotate([0,0,180]) union() { translate([4.5, -100, 1.6]) cube([7.55, 100 , 3.65]); translate([4.5-w/2, -wall+i-10, 1.6-w/2]) cube([7.55+w, 10 , 3.65+w]); } } module mouse_hole(wall) { translate([26+wall, 37.7, wall+3.2]) rotate([-90, 0, 0]) cylinder(d=2, 50); } module usbserpcb_mounted(wall) { translate([16+wall,37.7,wall]) rotate([0,0,180]) usbserpcb(); } module usbserpcb() { cube([16, 26, 1.6]); translate([4.5, 0, 1.6]) cube([7.55, 9 , 3.65]); } //generates square hull you can cut the inner overlap out of module mac_overlap_inner_edge(overlapth, isInner) { difference() { translate([overlapth, -200, overlapth]) cube([247.6-overlapth*2,500,334-overlapth*2]); translate([overlapth*2, -200, overlapth*2]) cube([247.6-overlapth*4,500,334-overlapth*4]); } } module mac_hull(wall) { difference() { mac_hull_solid(0); union() { mac_hull_solid(wall); translate([0, -25.4, 44.5]) rotate([-5,0, 0]) union() { //Cutout the screen in the back of the frontplate as well translate([247.6/2, 0, 185]) rotate([90, 0, 0]) scale(1.69) mac_screen_cutout(wall/1.69); //Cutout fdd slot translate([129, -5.2, 62.8]) rotate([90,0,0]) fdd_cutout(); } } } } module displaypcb(wall, scale) { translate([wall+.6,-1.6,60*scale]) rotate([90-5,180,180]) translate([0, -42, wall-2.05]) union() { cube([35,42, 0.8]); //main pcb translate([1, 6.8, 0]) cube([16, 24, 3.6+0.8]); //wroom block translate([1.6, 0.4, -1.2]) difference() { //screen cube([32.2, 36.75, 1.2]); translate([1.5, 2.73, -10+0.7]) cube([28.9, 19.5, 10]); } } } module mac_hull_solid(shrink) { rnd=4.5; //rounding of outer case //ir=0.8; //rounding of outmost screen bezel //a=-6.18; //angle of front r=(rnd