Add single-piece bottom model. Add dotted grill cutout for speaker and vents.

This commit is contained in:
Dejvino 2021-01-12 10:00:07 +01:00
parent 0295678c71
commit 4f94f1d14c

View File

@ -15,18 +15,20 @@ XRAY_BOTTOM=3;
// EXPORT: // EXPORT:
MODEL_HARNESS_LEFT=1; MODEL_HARNESS_LEFT=1;
MODEL_HARNESS_RIGHT=2; MODEL_HARNESS_RIGHT=2;
MODEL_HARNESS_BOTTOM_PIP=3; MODEL_HARNESS_BOTTOM=3;
MODEL_HARNESS_TOP=4; MODEL_HARNESS_BOTTOM_PIP=4;
MODEL_HARNESS_SLIDER_FRONT=5; MODEL_HARNESS_TOP=5;
MODEL_HARNESS_SLIDER_BACK=6; MODEL_HARNESS_SLIDER_FRONT=6;
MODEL_HARNESS_BUTTONS=7; MODEL_HARNESS_SLIDER_BACK=7;
export=0; // [0:7] MODEL_HARNESS_BUTTONS=8;
export=3; // [0:8]
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;
function is_model(m) = is_not_export() || export == m; 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];
function use_slideout_backplane() = !is_model_strict(MODEL_HARNESS_BOTTOM_PIP);
backplane_pip_slideout=10; backplane_pip_slideout=10;
@ -38,6 +40,20 @@ module cubi(s, fillet=0, edges=EDGES_ALL) {
} }
} }
module dotted_grill_cutout(vents_area, vents_x=10, vents_y=10, mesh=1.5, cut_corners=false) {
function is_corner(x, y, xm, ym) = (x == 0 || x == xm) && (y == 0 || y == ym);
vent_size=[vents_area.x/vents_x-mesh, vents_area.y/vents_y-mesh, vents_area.z];
translate([-vents_area.x/2 - vent_size.x/2, vents_area.y/2 - vent_size.y/2, 0])
for (x=[0:vents_x-1]) {
for (y=[0:vents_y-1]) {
if (!cut_corners || !is_corner(x, y, vents_x-1, vents_y-1)) {
right(x*(vent_size.x+mesh))
fwd(y*(vent_size.y+mesh))
cubi(vent_size, fillet=min(vent_size.x/2, vent_size.y/2));
}
}
}
}
module phone() { module phone() {
s=get_phone_size(); s=get_phone_size();
color("gray") color("gray")
@ -132,24 +148,26 @@ module phone_harness() {
} }
module shell_backplane(groove) { module shell_backplane(groove) {
module groove_scale() { scale([groove?1.05:1, groove?1.05:1, groove?1.2:1]) children(); } module groove_scale() { scale([groove?1.05:1, groove?1.05:1, groove?1.2:1]) children(); }
down(hs.z/2 - shell_wall/3) up(backplane_rim_size.z/2) right(harness_divider.x) {
back(backplane_rim_size.y/2) { if (use_slideout_backplane()) {
teeth=backplane_teeth; down(hs.z/2 - shell_wall/3) up(backplane_rim_size.z/2) right(harness_divider.x) {
segment=backplane_rim_size.y/teeth; back(backplane_rim_size.y/2) {
tooth_size=[backplane_rim_size.x, segment/2, backplane_rim_size.z]; teeth=backplane_teeth;
joiner_base=5; segment=backplane_rim_size.y/teeth;
joiner_size=[joiner_base + (groove?backplane_pip_slideout:0), segment*1.5, backplane_rim_size.z]; tooth_size=[backplane_rim_size.x, segment/2, backplane_rim_size.z];
for (i = [0:teeth-1]) { joiner_base=5;
fwd(i*segment) fwd(tooth_size.y) { joiner_size=[joiner_base + (groove?backplane_pip_slideout:0), segment*1.5, backplane_rim_size.z];
groove_scale() cubi(tooth_size, fillet=0.5, edges=EDGES_X_ALL); for (i = [0:teeth-1]) {
if (i%2 == 0) { fwd(i*segment) fwd(tooth_size.y) {
left(backplane_rim_size.x/2 + joiner_base/2) fwd(joiner_size.y/3) left(-joiner_size.x/2) groove_scale() cubi(joiner_size, fillet=2, edges=EDGES_Z_ALL); groove_scale() cubi(tooth_size, fillet=0.5, edges=EDGES_X_ALL);
if (i%2 == 0) {
left(backplane_rim_size.x/2 + joiner_base/2) fwd(joiner_size.y/3) left(-joiner_size.x/2) groove_scale() cubi(joiner_size, fillet=2, edges=EDGES_Z_ALL);
}
} }
} }
} }
} }
} }
} }
// ==== SHELL SLIDER AND RAIL ==== // ==== SHELL SLIDER AND RAIL ====
@ -227,20 +245,22 @@ module phone_harness() {
module bottom_speaker_cutout() { module bottom_speaker_cutout() {
s=[8, 49, 100]; s=[8, 49, 100];
left(ps.x/2 - 13) left(ps.x/2 - 13)
difference() { down(s.z/2 - ps.z/3)
down(s.z/2 - ps.z/3) cubi(s, fillet=1); dotted_grill_cutout(s, vents_x=4, vents_y=8, cut_corners=true, mesh=1);
bars=8; }
down(ps.z/2) module bottom_vents_cutout() {
for (i = [0:bars-1]) { vents_x=10;
bs=[s.x+2, 1, 2]; vents_y=6;
step=s.y/bars; vents_area=[35, 50, 10];
fwd(i*step - s.y/2 + step/2) down(w) cube(bs, center=true); vents_pos=[45, 0, -ps.z/2];
} mesh=1.5;
} translate(vents_pos)
dotted_grill_cutout(vents_area, vents_x=vents_x, vents_y=vents_y, mesh=mesh, cut_corners=true);
} }
module bottom_cutout() { module bottom_cutout() {
back_camera_cutout(); back_camera_cutout();
bottom_speaker_cutout(); bottom_speaker_cutout();
bottom_vents_cutout();
} }
// -- RIGHT -- // -- RIGHT --
@ -376,6 +396,10 @@ module phone_harness() {
if (is_model(MODEL_HARNESS_LEFT)) model_harness_left(); if (is_model(MODEL_HARNESS_LEFT)) model_harness_left();
if (is_model(MODEL_HARNESS_RIGHT)) model_harness_right(); if (is_model(MODEL_HARNESS_RIGHT)) model_harness_right();
if (is_model_strict(MODEL_HARNESS_BOTTOM)) {
model_harness_left();
model_harness_right();
}
if (is_model_strict(MODEL_HARNESS_BOTTOM_PIP)) { if (is_model_strict(MODEL_HARNESS_BOTTOM_PIP)) {
model_harness_left(); model_harness_left();
right(backplane_pip_slideout) model_harness_right(); right(backplane_pip_slideout) model_harness_right();