2024-02-02 21:39:55 +00:00
|
|
|
use <MCAD/boxes.scad>
|
|
|
|
|
2024-02-02 21:28:20 +00:00
|
|
|
/* [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;
|
|
|
|
|
2024-02-02 21:39:55 +00:00
|
|
|
fillet = 1;
|
|
|
|
|
2024-02-02 21:28:20 +00:00
|
|
|
/* [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;
|
|
|
|
|
2024-02-02 21:39:55 +00:00
|
|
|
$fs = 0.1;
|
|
|
|
|
|
|
|
// Polyfill for https://github.com/openscad/MCAD/pull/66
|
|
|
|
module roundedCube_(size, radius, sidesonly) {
|
|
|
|
translate(size/2) roundedBox(size, radius, sidesonly);
|
|
|
|
}
|
|
|
|
|
2024-02-02 21:28:20 +00:00
|
|
|
module long_piece() {
|
2024-02-02 21:39:55 +00:00
|
|
|
translate([-thickness, 0, 0]) roundedCube_([thickness, length, height], fillet, false);
|
2024-02-02 21:28:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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() {
|
2024-02-02 21:39:55 +00:00
|
|
|
translate([-thickness/2, 0, 0]) roundedCube_([thickness/2 + supports_length, cube_length, height], fillet, false);
|
2024-02-02 21:28:20 +00:00
|
|
|
// 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();
|