/* [Keychain] */ // overall height height = 10; // length, increase if phone falls backwards length = 60; // thickness of the long piece thickness = 4.3; // diameter of the hole for the key ring hole_diameter = 4; /* [Phone] */ // angle between the phone and the horizontal, 90=vertical angle = 65; // the thickness of the phone, if this value is too small, it won't fit between the supports phone_thickness = 11.3; /* [Supports] */ // the length the supports extend from the long piece supports_length = 6.6; // the thickness of the first support, in front of the phone support1_thickness = 7; // the thickness of the second support, behind the phone support2_thickness = 4.5; module long_piece() { translate([-thickness, 0, 0]) cube([thickness, length, height]); } module phone() { translate([0, 0, height]) rotate([angle, 0, 0]) translate([0, -10, -phone_thickness - support1_thickness]) cube([40, 80, phone_thickness]); } big_num = 50; module supports() { cube_length_transverse = support1_thickness + phone_thickness + support2_thickness; cube_length = cube_length_transverse / sin(angle); difference() { cube([supports_length, cube_length, height]); // cut out phone slot phone(); // cut out back of support2 translate([0, 0, height]) rotate([angle, 0, 0]) translate([0, -10, -big_num - phone_thickness - support1_thickness - support2_thickness]) cube([big_num, big_num, big_num]); } } long_piece(); supports(); %phone();