// fake iphone 6 //Dimensions of phone height = 157; width = 77; thickness = 6.7; //Roundiness of edges (from front) xradius = 9.5; //Curve of side curve = 2.3; //thickness of curved section nocurve= thickness/2 - curve; step = 0.1; //resolution of curve //Screen screenwidth = 1080/401*25.4; // rumoured 1920x1080 screen at 401ppi converted to mm screenheight = 1920/401*25.4; // adjust to your preferred settings! screentopoffset = (height-screenheight)/2; // default to screen centred vertically //Knobs knobradius = 1; //radius of ends of side buttons -- also used for lightning connector onbuttonradius = 40; //radius of sphere that creates the on button (higher number = shallower) //Functions to calculate the inset and scale of the cubes used to create the body shape vertically function inset(input) = (input <= nocurve ? 0 : curve-sqrt((curve*curve)-pow(input-nocurve,2))); function scalex(input) = (height-2*inset(input))/height; function scaley(input) = (width-2*inset(input))/width; module outline() { minkowski() { square([height-2*xradius,width-2*xradius]); circle(r=xradius); } } module body() { translate([xradius,xradius,0]) for(i=[0:step:thickness/2]) { translate([inset(i),inset(i),-i]) linear_extrude(2*i) scale([scalex(i),scaley(i),1]) outline(); } } module knob(knoblength, thickness) { translate([knobradius,0,0]) linear_extrude(thickness) hull() { circle(knobradius,$fn=20); translate([knoblength-2*knobradius,0,0]) circle(knobradius,$fn=20); } } module bodywithknobs() { body(); translate([18.4,-0.5,0]) rotate([270,0,0]) knob(5,5); //top left button translate([31,-0.5,0]) rotate([270,0,0]) knob(10,5); //volume up/down translate([43.5,-0.5,0]) rotate([270,0,0]) knob(10,5); translate([31,width+0.5,0]) rotate([90,0,0]) knob(10,5); //top right button translate([55,width+0.5,0]) rotate([90,0,0]) knob(15.5,5); translate([height-(height-screentopoffset-screenheight)/2,width/2,0]) cylinder(r1=6,r2=6,h=thickness/2+0.5,$fn=40); //cylinder for touchid } difference() { bodywithknobs(); translate([screentopoffset,(width-screenwidth)/2,thickness/2-0.2]) cube([screenheight,screenwidth,1]); //screen (inset slightly) translate([height-(height-screentopoffset-screenheight)/2,width/2,onbuttonradius+(thickness/2)-0.4]) sphere(onbuttonradius,$fn=100); //home button translate([height+0.5,width/2+8.5/2,0]) rotate([270,180,90]) knob(8.5,5); //lightning connector translate([screentopoffset/2+3,width/2-6,thickness/2-0.9]) rotate([0,0,90]) knob(12,1); // speaker }