diff --git a/main.scad b/main.scad index cc13774..1bd9ceb 100644 --- a/main.scad +++ b/main.scad @@ -15,18 +15,20 @@ XRAY_BOTTOM=3; // EXPORT: MODEL_HARNESS_LEFT=1; MODEL_HARNESS_RIGHT=2; -MODEL_HARNESS_BOTTOM_PIP=3; -MODEL_HARNESS_TOP=4; -MODEL_HARNESS_SLIDER_FRONT=5; -MODEL_HARNESS_SLIDER_BACK=6; -MODEL_HARNESS_BUTTONS=7; -export=0; // [0:7] +MODEL_HARNESS_BOTTOM=3; +MODEL_HARNESS_BOTTOM_PIP=4; +MODEL_HARNESS_TOP=5; +MODEL_HARNESS_SLIDER_FRONT=6; +MODEL_HARNESS_SLIDER_BACK=7; +MODEL_HARNESS_BUTTONS=8; +export=3; // [0:8] function is_not_export() = is_undef(export) || export == 0; function is_export() = !is_not_export(); function is_model_strict(m) = is_export() && export == m; function is_model(m) = is_not_export() || export == m; function get_phone_size() = [160, 76.7, 10]; +function use_slideout_backplane() = !is_model_strict(MODEL_HARNESS_BOTTOM_PIP); 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() { s=get_phone_size(); color("gray") @@ -132,24 +148,26 @@ module phone_harness() { } module shell_backplane(groove) { 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) { - teeth=backplane_teeth; - segment=backplane_rim_size.y/teeth; - tooth_size=[backplane_rim_size.x, segment/2, backplane_rim_size.z]; - joiner_base=5; - joiner_size=[joiner_base + (groove?backplane_pip_slideout:0), segment*1.5, backplane_rim_size.z]; - for (i = [0:teeth-1]) { - fwd(i*segment) fwd(tooth_size.y) { - 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); + + if (use_slideout_backplane()) { + down(hs.z/2 - shell_wall/3) up(backplane_rim_size.z/2) right(harness_divider.x) { + back(backplane_rim_size.y/2) { + teeth=backplane_teeth; + segment=backplane_rim_size.y/teeth; + tooth_size=[backplane_rim_size.x, segment/2, backplane_rim_size.z]; + joiner_base=5; + joiner_size=[joiner_base + (groove?backplane_pip_slideout:0), segment*1.5, backplane_rim_size.z]; + for (i = [0:teeth-1]) { + fwd(i*segment) fwd(tooth_size.y) { + 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 ==== @@ -227,20 +245,22 @@ module phone_harness() { module bottom_speaker_cutout() { s=[8, 49, 100]; left(ps.x/2 - 13) - difference() { - down(s.z/2 - ps.z/3) cubi(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); - } - } + down(s.z/2 - ps.z/3) + dotted_grill_cutout(s, vents_x=4, vents_y=8, cut_corners=true, mesh=1); + } + module bottom_vents_cutout() { + vents_x=10; + vents_y=6; + vents_area=[35, 50, 10]; + 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() { back_camera_cutout(); bottom_speaker_cutout(); + bottom_vents_cutout(); } // -- RIGHT -- @@ -376,6 +396,10 @@ module phone_harness() { if (is_model(MODEL_HARNESS_LEFT)) model_harness_left(); 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)) { model_harness_left(); right(backplane_pip_slideout) model_harness_right();