From 383bcd084e5f14813ddde7e980685d1f3eb46004 Mon Sep 17 00:00:00 2001 From: Dejvino Date: Mon, 11 Jan 2021 13:54:11 +0100 Subject: [PATCH] Add secondary strap. Add preview model simplification. --- main.scad | 46 +++++++++++++++++++++++++++------------------- strap.scad | 38 +++++++++++++++++++++++++++++++++++--- 2 files changed, 62 insertions(+), 22 deletions(-) diff --git a/main.scad b/main.scad index 3d88a6a..64d1639 100644 --- a/main.scad +++ b/main.scad @@ -23,16 +23,24 @@ function is_model(m) = is_not_export() || export == m; function get_phone_size() = [160, 76.7, 10]; +module cubi(s, fillet=0, edges=EDGES_ALL) { + if ($preview) { + cube(s, center=true); + } else { + cuboid(s, fillet=fillet, edges=edges); + } +} + module phone() { s=get_phone_size(); color("gray") - cuboid(s, fillet=5); + cubi(s, fillet=5); } module arm() { $fn=6; s=[210, 55, 50]; color("SaddleBrown") - down(s.z/2 + get_phone_size().z/2) cuboid(s, fillet=20); + down(s.z/2 + get_phone_size().z/2) cubi(s, fillet=20); } module phone_harness() { @@ -59,8 +67,8 @@ module phone_harness() { module shell() { $fn = $preview ? 6 : 30; difference() { - cuboid(hs, fillet=f); - cuboid(ps, fillet=f); + cubi(hs, fillet=f); + cubi(ps, fillet=f); } shell_rim(); shell_screwmounts(); @@ -71,10 +79,10 @@ module phone_harness() { s=rim_size; intersection() { difference() { - cuboid(s, fillet=rf, edges=EDGES_Z_ALL); - cuboid(ps, fillet=f, edges=EDGES_Z_ALL); + cubi(s, fillet=rf, edges=EDGES_Z_ALL); + cubi(ps, fillet=f, edges=EDGES_Z_ALL); } - cuboid(s, fillet=1); + cubi(s, fillet=1); } rail_extension=10; fwd(hs.y/2) xrot(90) harness_rail(slider_len_front+rail_extension); @@ -88,10 +96,10 @@ module phone_harness() { resi=[hs.x+2*offset, hs.y+2*offset, res.z+1]; up(0.0) difference() { intersection() { - cuboid(res, fillet=rf, edges=EDGES_Z_ALL); - cuboid(res, fillet=(groove?1:1.5), edges=EDGES_BOTTOM); + cubi(res, fillet=rf, edges=EDGES_Z_ALL); + cubi(res, fillet=(groove?1:1.5), edges=EDGES_BOTTOM); } - cuboid(resi, fillet=rf, edges=EDGES_Z_ALL); + cubi(resi, fillet=rf, edges=EDGES_Z_ALL); } } module foreach_screwmount() { @@ -115,7 +123,7 @@ module phone_harness() { } } 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); + down(hs.z/2 - shell_wall/6) up(backplane_rim_size.z/2) right(harness_divider.x) scale(groove ? 1.01 : 1) cubi(backplane_rim_size, fillet=5, edges=EDGES_Z_LF); } // ==== SHELL SLIDER AND RAIL ==== @@ -148,22 +156,22 @@ module phone_harness() { // -- TOP -- module screen_cutout() { s=[138, 69, 100]; - up(s.z/2) cuboid(s, fillet=3, edges=EDGES_Z_ALL); + up(s.z/2) cubi(s, fillet=3, edges=EDGES_Z_ALL); } top_offset=6.5; module top_speaker_cutout() { s=[3, 12, 100]; - right(ps.x/2 - top_offset) up(s.z/2 - ps.z/3) cuboid(s, fillet=1); + right(ps.x/2 - top_offset) up(s.z/2 - ps.z/3) cubi(s, fillet=1); } module front_camera_cutout() { $fn = $preview ? 6 : 30; d=5; 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.5) cylinder(d=s.x, h=s.z); } module leds_cutout() { s=[4, 14, 100]; - right(ps.x/2 - top_offset) up(s.z/2 - ps.z/3) back(23) cuboid(s, fillet=1); + right(ps.x/2 - top_offset) up(s.z/2 - ps.z/3) back(23) cubi(s, fillet=1); } module top_cutout() { screen_cutout(); @@ -175,13 +183,13 @@ module phone_harness() { // -- 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); + right(ps.x/2 - 7.5) fwd(ps.y/2 - 23) down(s.z/2 - ps.z/3) cubi(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); + down(s.z/2 - ps.z/3) cubi(s, fillet=1); bars=8; down(ps.z/2) for (i = [0:bars-1]) { @@ -211,7 +219,7 @@ module phone_harness() { // -- LEFT -- module usbc_cutout() { s=[100, 20, 6]; - left(ps.x/2) down(2) cuboid(s, fillet=1); + left(ps.x/2) down(2) cubi(s, fillet=1); } module left_cutout() { usbc_cutout(); @@ -220,7 +228,7 @@ module phone_harness() { // -- FRONT -- module buttons_cutout() { 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) cubi(s, fillet=1); } module front_cutout() { buttons_cutout(); diff --git a/strap.scad b/strap.scad index e05b9f9..f8cf005 100644 --- a/strap.scad +++ b/strap.scad @@ -13,6 +13,7 @@ use MODEL_STRAP_PLATFORM_BASE=10; MODEL_STRAP_PLATFORM_RIB=11; MODEL_STRAP_PLATFORM_RIB_BRACE=12; +MODEL_STRAP_SECONDARY=13; export=0; // [0:20] function is_not_export() = is_undef(export) || export == 0; function is_export() = !is_not_export(); @@ -25,20 +26,24 @@ module arm() { $fn=$preview ? 10 : 30; arm_size=[200, 55, 40]; color("gray") -down(arm_size.z/2) cuboid(arm_size, fillet=16, edges=EDGES_X_ALL); +down(arm_size.z/2) { + cuboid(arm_size, fillet=16, edges=EDGES_X_ALL); + left(arm_size.x*0.6) scale([1, 1, 0.8]) yrot(90) cylinder(d1=arm_size.y*1.4, d2=arm_size.y*0.95, h=arm_size.x/2); + } } module strap_platform() { base_size=[40, 70, 2]; - rib_thickness=2; + rib_thickness=5; rib_height=20; rib_pos=[base_size.x/2 - rib_thickness, 0, -1.3]; brace_size=[base_size.x, 3.6, 4.8]; brace_pos=[0, base_size.y/2 - 4, -1.3]; module platform_base() { + cutout_size=[(base_size.x-rib_thickness*2 - 2*(base_size.x/2-rib_pos.x)), (base_size.y - 5), 2*base_size.z]; difference() { down(base_size.z/2) cuboid(base_size, fillet=2, edges=EDGES_Z_ALL); - down(base_size.z/2) scale([0.75, 0.85, 2]) cuboid(base_size, fillet=2, edges=EDGES_Z_ALL); + down(base_size.z/2) cuboid(cutout_size, fillet=2, edges=EDGES_Z_ALL); model_rib_left(socket=true); model_rib_right(socket=true); } @@ -91,12 +96,39 @@ module strap_platform() { } } +module strap_secondary() { + size=[40, 15, 10]; + size_base=[size.x, size.y]; + size_top=[size.x * 0.9, size.y * 0.4]; + cutout_size=[size.x - 10, size.y*10, size.z - 4]; + module anchor() { + difference() { + xrot(180) rounded_prismoid(size1=size_base, size2=size_top, h=size.z, r=5); + down(size.z/2) cube(cutout_size, center=true); + } + } + anchor_pos=[60, 30, 0]; + module anchor_front() { + left(anchor_pos.x) fwd(anchor_pos.y) anchor(); + } + module anchor_back() { + left(anchor_pos.x) back(anchor_pos.y) anchor(); + } + + if (is_model(MODEL_STRAP_SECONDARY)) anchor_front(); + if (is_not_export()) anchor_back(); +} + module model_strap_platform() { strap_platform(); } +module model_strap_secondary() { + strap_secondary(); +} module model_arm() { if (is_not_export()) down(3) arm(); } model_strap_platform(); +model_strap_secondary(); model_arm(); \ No newline at end of file