Merge branch 'rugged'

This commit is contained in:
Dejvino 2020-12-31 20:00:35 +01:00
commit edb9f88fd9
2 changed files with 67 additions and 25 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -12,7 +12,7 @@ use <BOSL/masks.scad>
MODEL_HARNESS_LEFT=1; MODEL_HARNESS_LEFT=1;
MODEL_HARNESS_RIGHT=2; MODEL_HARNESS_RIGHT=2;
MODEL_HARNESS_TOP=3; MODEL_HARNESS_TOP=3;
export=2; // [0:5] export=0; // [0:5]
function is_not_export() = is_undef(export) || export == 0; function is_not_export() = is_undef(export) || export == 0;
function is_export() = !is_not_export(); function is_export() = !is_not_export();
function is_model_strict(m) = is_export() && export == m; function is_model_strict(m) = is_export() && export == m;
@ -20,8 +20,13 @@ function is_model(m) = is_not_export() || export == m;
function get_phone_size() = [160, 76.7, 10]; function get_phone_size() = [160, 76.7, 10];
rim_edge_thickness=0.8; shell_wall=3;
rim_edge_tolerance=0.6; shell_rim_wall=3;
rim_edge_thickness=1.2;
rim_edge_tolerance=0.4;
expose_back_camera=false;
screwmount_screw=3;
harness_divider=[30, 0, 1.3];
module phone() { module phone() {
s=get_phone_size(); s=get_phone_size();
@ -38,7 +43,7 @@ module arm() {
module phone_harness() { module phone_harness() {
ops=get_phone_size(); ops=get_phone_size();
ps=[ops.x+0.2, ops.y+0.2, ops.z+0.2]; ps=[ops.x+0.2, ops.y+0.2, ops.z+0.2];
w=1; w=shell_wall;
f=2; f=2;
rf=5; rf=5;
hs=[ps.x+w*2, ps.y+w*2, ps.z+w*2]; hs=[ps.x+w*2, ps.y+w*2, ps.z+w*2];
@ -50,10 +55,11 @@ module phone_harness() {
cuboid(ps, fillet=f); cuboid(ps, fillet=f);
} }
shell_rim(); shell_rim();
shell_screwmounts();
} }
module shell_rim() { module shell_rim() {
$fn = $preview ? 6 : 30; $fn = $preview ? 6 : 30;
w=2; w=shell_rim_wall;
s=[hs.x+2*w, hs.y+2*w, 6]; s=[hs.x+2*w, hs.y+2*w, 6];
intersection() { intersection() {
difference() { difference() {
@ -67,64 +73,99 @@ module phone_harness() {
$fn = $preview ? 6 : 30; $fn = $preview ? 6 : 30;
w=thickness + (groove ? tolerance : 0); w=thickness + (groove ? tolerance : 0);
offset=(groove ? 0 : tolerance/2); offset=(groove ? 0 : tolerance/2);
res=[hs.x+2*(w+offset), hs.y+2*(w+offset), 4.5]; res=[hs.x+2*(w+offset), hs.y+2*(w+offset), 3];
resi=[hs.x+2*offset, hs.y+2*offset, res.z+1]; resi=[hs.x+2*offset, hs.y+2*offset, res.z+1];
up(0.5) difference() { up(0.0) difference() {
intersection() { intersection() {
cuboid(res, fillet=rf, edges=EDGES_Z_ALL); cuboid(res, fillet=rf, edges=EDGES_Z_ALL);
cuboid(res, fillet=(groove?1:2), edges=EDGES_BOTTOM); cuboid(res, fillet=(groove?1:1.5), edges=EDGES_BOTTOM);
} }
cuboid(resi, fillet=rf, edges=EDGES_Z_ALL); cuboid(resi, fillet=rf, edges=EDGES_Z_ALL);
} }
} }
module foreach_screwmount() {
for(x = [0:1]) for (y = [0:1]) {
translate([(-0.5+x)*ps.x, (-0.5+y)*ps.y, -hs.z/2])
children();
}
}
module shell_screwmounts() {
$fn = $preview ? 6 : 30;
r=3;
foreach_screwmount() {
cylinder(r=r, h=hs.z);
}
}
module shell_screwmounts_holes() {
$fn = $preview ? 6 : 30;
foreach_screwmount() {
up(w) cylinder(d2=screwmount_screw, d1=screwmount_screw*0.5, h=hs.z+1);
up(hs.z-1) cylinder(d=screwmount_screw+1.5, h=5);
}
}
module screen_cutout() { module screen_cutout() {
s=[138, 69, 10]; s=[138, 69, 100];
up(s.z/2) cuboid(s, fillet=3, edges=EDGES_Z_ALL); up(s.z/2) cuboid(s, fillet=3, edges=EDGES_Z_ALL);
} }
top_offset=6.5; top_offset=6.5;
module speaker_cutout() { module top_speaker_cutout() {
s=[3, 12, 10]; s=[3, 12, 100];
right(ps.x/2 - top_offset) up(ps.z/2) cuboid(s, fillet=1); right(ps.x/2 - top_offset) up(s.z/2 - ps.z/3) cuboid(s, fillet=1);
} }
module front_camera_cutout() { module front_camera_cutout() {
$fn = $preview ? 6 : 30; $fn = $preview ? 6 : 30;
d=5; d=5;
s=[d, d, 10]; s=[d, d, 100];
right(ps.x/2 - top_offset) fwd(11) cylinder(d=s.x, h=s.z); right(ps.x/2 - top_offset) fwd(11) cylinder(d=s.x, h=s.z);
} }
module leds_cutout() { module leds_cutout() {
s=[4, 14, 10]; s=[4, 14, 100];
right(ps.x/2 - top_offset) up(ps.z/2) back(23) cuboid(s, fillet=1); right(ps.x/2 - top_offset) up(s.z/2 - ps.z/3) back(23) cuboid(s, fillet=1);
} }
module top_cutout() { module top_cutout() {
screen_cutout(); screen_cutout();
speaker_cutout(); top_speaker_cutout();
front_camera_cutout(); front_camera_cutout();
leds_cutout(); leds_cutout();
} }
module back_camera_cutout() { module back_camera_cutout() {
s=[13, 25, 10]; s=[13, 25, expose_back_camera ? 100 : 11];
right(ps.x/2 - 8) fwd(ps.y/2 - 23) down(ps.z/2) cuboid(s, fillet=6, edges=EDGES_Z_ALL); right(ps.x/2 - 7.5) fwd(ps.y/2 - 23) down(s.z/2 - ps.z/3) cuboid(s, fillet=6, edges=EDGES_Z_ALL);
}
module bottom_speaker_cutout() {
s=[8, 49, 100];
left(ps.x/2 - 13)
difference() {
down(s.z/2 - ps.z/3) cuboid(s, fillet=1);
bars=8;
down(ps.z/2)
for (i = [0:bars-1]) {
bs=[s.x+2, 1, 2];
step=s.y/bars;
fwd(i*step - s.y/2 + step/2) down(w) cube(bs, center=true);
}
}
} }
module bottom_cutout() { module bottom_cutout() {
back_camera_cutout(); back_camera_cutout();
bottom_speaker_cutout();
} }
module headphones_cutout() { module headphones_cutout() {
$fn = $preview ? 10 : 30; $fn = $preview ? 10 : 30;
d=9; d=8.8;
p=[ps.x/2, ps.y/2-24, -1]; p=[ps.x/2, ps.y/2-24, -0.88];
h=10; h=100;
translate(p) yrot(90) down(h/2) cylinder(h=h, d=d); translate(p) yrot(90) down(10) cylinder(h=h, d=d);
} }
module right_cutout() { module right_cutout() {
headphones_cutout(); headphones_cutout();
} }
module usbc_cutout() { module usbc_cutout() {
s=[10, 20, 6]; s=[100, 20, 6];
left(ps.x/2) down(2) cuboid(s, fillet=1); left(ps.x/2) down(2) cuboid(s, fillet=1);
} }
module left_cutout() { module left_cutout() {
@ -132,7 +173,7 @@ module phone_harness() {
} }
module buttons_cutout() { module buttons_cutout() {
s=[42, 10, 5]; s=[42, 100, 5];
fwd(ps.y/2) right(ps.x/2 - 44.5) cuboid(s, fillet=1); fwd(ps.y/2) right(ps.x/2 - 44.5) cuboid(s, fillet=1);
} }
module front_cutout() { module front_cutout() {
@ -145,9 +186,10 @@ module phone_harness() {
left_cutout(); left_cutout();
right_cutout(); right_cutout();
front_cutout(); front_cutout();
shell_screwmounts_holes();
} }
divider=[30, 0, 2.3]; divider=harness_divider;
module model_harness_left() { module model_harness_left() {
intersection() { intersection() {
intersection() { intersection() {