diff --git a/main.scad b/main.scad index f77b39b..3d88a6a 100644 --- a/main.scad +++ b/main.scad @@ -3,6 +3,7 @@ include use use use +use // DEBUG: //validation = 1; @@ -12,6 +13,8 @@ use MODEL_HARNESS_LEFT=1; MODEL_HARNESS_RIGHT=2; MODEL_HARNESS_TOP=3; +MODEL_HARNESS_SLIDER_FRONT=4; +MODEL_HARNESS_SLIDER_BACK=5; export=0; // [0:5] function is_not_export() = is_undef(export) || export == 0; function is_export() = !is_not_export(); @@ -20,14 +23,6 @@ function is_model(m) = is_not_export() || export == m; function get_phone_size() = [160, 76.7, 10]; -shell_wall=3; -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() { s=get_phone_size(); color("gray") @@ -43,10 +38,23 @@ module arm() { module phone_harness() { ops=get_phone_size(); ps=[ops.x+0.2, ops.y+0.2, ops.z+0.2]; + shell_wall=3; + shell_rim_wall=3; + rim_edge_thickness=1.2; + rim_edge_tolerance=0.4; + expose_back_camera=false; + screwmount_screw=3; + harness_divider=[16, 0, 1.3]; + harness_size=[ps.x+shell_wall*2, ps.y+shell_wall*2, ps.z+shell_wall*2]; + rim_size=[harness_size.x+2*shell_rim_wall, harness_size.y+2*shell_rim_wall, 6]; + w=shell_wall; f=2; rf=5; - hs=[ps.x+w*2, ps.y+w*2, ps.z+w*2]; + hs=harness_size; + backplane_rim_size=[30, ps.y*0.95, shell_wall/2]; + + // ==== SHELL ==== module shell() { $fn = $preview ? 6 : 30; @@ -60,7 +68,7 @@ module phone_harness() { module shell_rim() { $fn = $preview ? 6 : 30; w=shell_rim_wall; - s=[hs.x+2*w, hs.y+2*w, 6]; + s=rim_size; intersection() { difference() { cuboid(s, fillet=rf, edges=EDGES_Z_ALL); @@ -68,6 +76,9 @@ module phone_harness() { } cuboid(s, fillet=1); } + rail_extension=10; + fwd(hs.y/2) xrot(90) harness_rail(slider_len_front+rail_extension); + back(hs.y/2) xrot(-90) harness_rail(slider_len_back+rail_extension); } module shell_rim_edge(thickness, groove, tolerance=rim_edge_tolerance) { $fn = $preview ? 6 : 30; @@ -103,7 +114,38 @@ module phone_harness() { up(hs.z-1) cylinder(d=screwmount_screw+1.5, h=5); } } + module shell_backplane(groove) { + down(hs.z/2 - shell_wall/6) up(backplane_rim_size.z/2) right(harness_divider.x) scale(groove ? 1.01 : 1) cuboid(backplane_rim_size, fillet=5, edges=EDGES_Z_LF); + } + // ==== SHELL SLIDER AND RAIL ==== + + rail_angle=36; + rail_wall=1; + slider_slop=0.1; + slider_len_back=hs.x*0.3; + slider_len_front=hs.x*0.3; + module harness_slider(l) { + base=2; + ss=[l, shell_rim_wall, rim_size.z+rail_wall*2]; + up(ss.y + base) xrot(180) slider(l=ss.x, w=ss.z, h=ss.y, base=base, chamfer=0.9, wall=2, ang=rail_angle, slop=slider_slop, orient=ORIENT_X, align=V_UP); + } + module harness_rail(l) { + sw=2; + ss=[l, shell_rim_wall, rim_size.z+rail_wall*2]; + rail(l=ss.x, w=ss.z, h=ss.y, chamfer=0.5, ang=rail_angle, orient=ORIENT_X, align=V_UP); + } + + // ==== SHELL CUTOUTS ==== + module shell_cutouts() { + top_cutout(); + bottom_cutout(); + left_cutout(); + right_cutout(); + front_cutout(); + shell_screwmounts_holes(); + } + // -- TOP -- module screen_cutout() { s=[138, 69, 100]; up(s.z/2) cuboid(s, fillet=3, edges=EDGES_Z_ALL); @@ -130,6 +172,7 @@ module phone_harness() { leds_cutout(); } + // -- BOTTOM -- module back_camera_cutout() { s=[13, 25, expose_back_camera ? 100 : 11]; 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); @@ -153,6 +196,7 @@ module phone_harness() { bottom_speaker_cutout(); } + // -- RIGHT -- module headphones_cutout() { $fn = $preview ? 10 : 30; d=8.8; @@ -164,6 +208,7 @@ module phone_harness() { headphones_cutout(); } + // -- LEFT -- module usbc_cutout() { s=[100, 20, 6]; left(ps.x/2) down(2) cuboid(s, fillet=1); @@ -172,6 +217,7 @@ module phone_harness() { usbc_cutout(); } + // -- FRONT -- module buttons_cutout() { s=[42, 100, 5]; fwd(ps.y/2) right(ps.x/2 - 44.5) cuboid(s, fillet=1); @@ -180,14 +226,7 @@ module phone_harness() { buttons_cutout(); } - module shell_cutouts() { - top_cutout(); - bottom_cutout(); - left_cutout(); - right_cutout(); - front_cutout(); - shell_screwmounts_holes(); - } + // ==== MODEL ==== divider=harness_divider; module model_harness_left() { @@ -200,6 +239,7 @@ module phone_harness() { shell(); shell_rim_edge(rim_edge_thickness, groove=true, tolerance=rim_edge_tolerance); shell_cutouts(); + shell_backplane(groove=true); } } } @@ -215,6 +255,7 @@ module phone_harness() { shell_cutouts(); } } + shell_backplane(groove=false); } module model_harness_top() { intersection() { @@ -229,10 +270,21 @@ module phone_harness() { shell_cutouts(); } } + module model_harness_slider_front() { + difference() { + fwd(hs.y/2) xrot(90) harness_slider(slider_len_front); + front_cutout(); + } + } + module model_harness_slider_back() { + back(hs.y/2) xrot(-90) harness_slider(slider_len_back); + } if (is_model(MODEL_HARNESS_LEFT)) model_harness_left(); if (is_model(MODEL_HARNESS_RIGHT)) model_harness_right(); if (is_model(MODEL_HARNESS_TOP)) model_harness_top(); + if (is_model(MODEL_HARNESS_SLIDER_FRONT)) model_harness_slider_front(); + if (is_model(MODEL_HARNESS_SLIDER_BACK)) model_harness_slider_back(); } module model() {