//------------------------------------------------------- //iStack v1 by Stoney //------------------------------------------------------- use <./MCAD/boxes.scad>; //for MAC opencad (or windows?) //use ; // for windows openscad front = 1; //set to not 0 to model this part rear = 1; // set to not 0 to model this part dock = 1; // set to not 0 to cut dock assembled = 0; //set to not 0 to assemble the two parts iphone4_edge_radius = 1; iphone4_thickness = 9.5; iphone4_width = 59; dock_width = 28; // width of slot for dock plug dock_thick = 6; // slot for dock connector clearance = 1; // extra gap added to phone width and thickness walls = 2; // walls everywhere screw_depth = 4; //countersunk depth ipad_depth = 12; // depth of space between front and rear brackets lip = 2; // lip around front of phone holder //Front Bracket FBX = iphone4_width+clearance+walls*2; FBY = 60; FBZ = iphone4_thickness+clearance+walls*2; //Rear Bracket RBX = FBX; RBY = FBY; RBZ = walls+screw_depth; //Bracket Pins BY = 6; //thickness of pins BZ = ipad_depth + RBZ + FBZ; // base bracket pin length BX = (FBX-dock_width-6)/2; //base bracket pin width BB = ipad_depth + RBZ; //base of rear bracket //Phone slot PSX = iphone4_width+clearance; PSY = RBY; PSZ = iphone4_thickness+clearance; PL = (RBX-BX)/2-walls; // pin location module holes() { for (i=[ -RBY/4, RBY/4]) { translate([0,i,screw_depth/2]) { cylinder(h=10, r=2.5, center=true); cylinder(h=screw_depth, r=6, center=true); } } } module RearBracket() { union() { difference() { roundedBox([RBX,RBY,RBZ], 2, false); // rear frame holes(); } translate([PL,-(RBY-BY)/2,(BZ-RBZ)/2]) roundedBox([BX,BY,BZ], 2, false); // bracket pin translate([-PL,-(RBY-BY)/2,(BZ-RBZ)/2]) roundedBox([BX,BY,BZ], 2, false); // bracket pin difference() { translate([0,-(RBY-BY)/2,(BB-RBZ)/2]) roundedBox([RBX,BY,BB], 2, false); // bracket base if (dock) translate([0,-100,10]) roundedBox([dock_width,200,dock_thick+20], dock_thick/2, false); // dock hole } } } module FrontBracket() { union() { difference() { union() { roundedBox([FBX,FBY,FBZ], 2, false); // front holder if (dock) translate([0,0,-FBZ/2+iphone4_edge_radius]) cube([FBX,FBY,iphone4_edge_radius*2], true); //squared off to stick better } translate([0,BY+walls*2,0]) { roundedBox([PSX,PSY,PSZ], iphone4_edge_radius, false); translate([0,lip,PSZ/2]) roundedBox([PSX-2*lip,PSY,PSZ], 2, false); // cutout if (dock) translate([-dock_width/2,-50,-25]) cube([dock_width,100,50], false); // dock slot } } } } if (front) { difference() { translate ([0,-walls,(RBZ+FBZ)/2+ipad_depth]) FrontBracket(); RearBracket(); } } if (rear) { if (assembled == 0) translate ([FBX+5,0,BB]) // places brackets next to each other on bed RearBracket(); if (assembled == 1) RearBracket(); }