Compare commits

..

No commits in common. "d8329f5401b07d91d2d2b3a5d78748a0c1cebb5b" and "c259f393e3eb97732c27c8fa3bcff09c05dcceb0" have entirely different histories.

2 changed files with 30 additions and 200 deletions

View File

@ -7,18 +7,15 @@ use <BOSL/sliders.scad>
// DEBUG: // DEBUG:
//validation = 1; //validation = 1;
XRAY_POSITIVE=1; //xray = 1;
XRAY_BACKPLANE=2;
//xray = 2;
// 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_TOP=3;
MODEL_HARNESS_TOP=4; MODEL_HARNESS_SLIDER_FRONT=4;
MODEL_HARNESS_SLIDER_FRONT=5; MODEL_HARNESS_SLIDER_BACK=5;
MODEL_HARNESS_SLIDER_BACK=6; export=0; // [0:5]
export=3; // [0:6]
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;
@ -26,26 +23,16 @@ 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];
backplane_pip_slideout=10;
module cubi(s, fillet=0, edges=EDGES_ALL) {
if ($preview) {
cube(s, center=true);
} else {
cuboid(s, fillet=fillet, edges=edges);
}
}
module phone() { module phone() {
s=get_phone_size(); s=get_phone_size();
color("gray") color("gray")
cubi(s, fillet=5); cuboid(s, fillet=5);
} }
module arm() { module arm() {
$fn=6; $fn=6;
s=[210, 55, 50]; s=[210, 55, 50];
color("SaddleBrown") color("SaddleBrown")
down(s.z/2 + get_phone_size().z/2) cubi(s, fillet=20); down(s.z/2 + get_phone_size().z/2) cuboid(s, fillet=20);
} }
module phone_harness() { module phone_harness() {
@ -72,8 +59,8 @@ module phone_harness() {
module shell() { module shell() {
$fn = $preview ? 6 : 30; $fn = $preview ? 6 : 30;
difference() { difference() {
cubi(hs, fillet=f); cuboid(hs, fillet=f);
cubi(ps, fillet=f); cuboid(ps, fillet=f);
} }
shell_rim(); shell_rim();
shell_screwmounts(); shell_screwmounts();
@ -84,10 +71,10 @@ module phone_harness() {
s=rim_size; s=rim_size;
intersection() { intersection() {
difference() { difference() {
cubi(s, fillet=rf, edges=EDGES_Z_ALL); cuboid(s, fillet=rf, edges=EDGES_Z_ALL);
cubi(ps, fillet=f, edges=EDGES_Z_ALL); cuboid(ps, fillet=f, edges=EDGES_Z_ALL);
} }
cubi(s, fillet=1); cuboid(s, fillet=1);
} }
rail_extension=10; rail_extension=10;
fwd(hs.y/2) xrot(90) harness_rail(slider_len_front+rail_extension); fwd(hs.y/2) xrot(90) harness_rail(slider_len_front+rail_extension);
@ -101,10 +88,10 @@ module phone_harness() {
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.0) difference() { up(0.0) difference() {
intersection() { intersection() {
cubi(res, fillet=rf, edges=EDGES_Z_ALL); cuboid(res, fillet=rf, edges=EDGES_Z_ALL);
cubi(res, fillet=(groove?1:1.5), edges=EDGES_BOTTOM); cuboid(res, fillet=(groove?1:1.5), edges=EDGES_BOTTOM);
} }
cubi(resi, fillet=rf, edges=EDGES_Z_ALL); cuboid(resi, fillet=rf, edges=EDGES_Z_ALL);
} }
} }
module foreach_screwmount() { module foreach_screwmount() {
@ -128,21 +115,7 @@ module phone_harness() {
} }
} }
module shell_backplane(groove) { module shell_backplane(groove) {
down(hs.z/2 - shell_wall/6) up(backplane_rim_size.z/2) right(harness_divider.x) { 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);
back(backplane_rim_size.y/2) {
teeth=4;
segment=backplane_rim_size.y/teeth;
tooth_size=[backplane_rim_size.x, segment/2, backplane_rim_size.z];
for (i = [0:teeth-1]) {
fwd(i*segment) fwd(tooth_size.y) scale(groove ? 1.02 : 1) cubi(tooth_size, fillet=2, edges=EDGES_Z_LF);
}
}
left(backplane_pip_slideout + 11) if (is_model_strict(MODEL_HARNESS_BOTTOM_PIP)) {
joiner_size=[7 + (groove?backplane_pip_slideout:0), backplane_rim_size.y, backplane_rim_size.z];
scale(groove ? 1.02 : 1) left(-joiner_size.x/2) cubi(joiner_size, fillet=2, edges=EDGES_Z_LF);
}
}
} }
// ==== SHELL SLIDER AND RAIL ==== // ==== SHELL SLIDER AND RAIL ====
@ -175,22 +148,22 @@ module phone_harness() {
// -- TOP -- // -- TOP --
module screen_cutout() { module screen_cutout() {
s=[138, 69, 100]; s=[138, 69, 100];
up(s.z/2) cubi(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 top_speaker_cutout() { module top_speaker_cutout() {
s=[3, 12, 100]; s=[3, 12, 100];
right(ps.x/2 - top_offset) up(s.z/2 - ps.z/3) cubi(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, 100]; s=[d, d, 100];
right(ps.x/2 - top_offset) fwd(11.5) 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, 100]; s=[4, 14, 100];
right(ps.x/2 - top_offset) up(s.z/2 - ps.z/3) back(23) cubi(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();
@ -202,13 +175,13 @@ module phone_harness() {
// -- BOTTOM -- // -- BOTTOM --
module back_camera_cutout() { module back_camera_cutout() {
s=[13, 25, expose_back_camera ? 100 : 11]; 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) cubi(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() { module bottom_speaker_cutout() {
s=[8, 49, 100]; s=[8, 49, 100];
left(ps.x/2 - 13) left(ps.x/2 - 13)
difference() { difference() {
down(s.z/2 - ps.z/3) cubi(s, fillet=1); down(s.z/2 - ps.z/3) cuboid(s, fillet=1);
bars=8; bars=8;
down(ps.z/2) down(ps.z/2)
for (i = [0:bars-1]) { for (i = [0:bars-1]) {
@ -226,11 +199,10 @@ module phone_harness() {
// -- RIGHT -- // -- RIGHT --
module headphones_cutout() { module headphones_cutout() {
$fn = $preview ? 10 : 30; $fn = $preview ? 10 : 30;
d1=8.8; d=8.8;
d2=14;
p=[ps.x/2, ps.y/2-24, -0.88]; p=[ps.x/2, ps.y/2-24, -0.88];
h=30; h=100;
translate(p) yrot(90) down(10) cylinder(h=h, d1=d1, d2=d2); translate(p) yrot(90) down(10) cylinder(h=h, d=d);
} }
module right_cutout() { module right_cutout() {
headphones_cutout(); headphones_cutout();
@ -238,8 +210,8 @@ module phone_harness() {
// -- LEFT -- // -- LEFT --
module usbc_cutout() { module usbc_cutout() {
s=[20, 20, 7]; s=[100, 20, 6];
left(ps.x/2) down(2) cubi(s, fillet=1); left(ps.x/2) down(2) cuboid(s, fillet=1);
} }
module left_cutout() { module left_cutout() {
usbc_cutout(); usbc_cutout();
@ -248,7 +220,7 @@ module phone_harness() {
// -- FRONT -- // -- FRONT --
module buttons_cutout() { module buttons_cutout() {
s=[42, 100, 5]; s=[42, 100, 5];
fwd(ps.y/2) right(ps.x/2 - 44.5) cubi(s, fillet=1); fwd(ps.y/2) right(ps.x/2 - 44.5) cuboid(s, fillet=1);
} }
module front_cutout() { module front_cutout() {
buttons_cutout(); buttons_cutout();
@ -310,10 +282,6 @@ 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_PIP)) {
model_harness_left();
right(backplane_pip_slideout) model_harness_right();
}
if (is_model(MODEL_HARNESS_TOP)) model_harness_top(); 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_FRONT)) model_harness_slider_front();
if (is_model(MODEL_HARNESS_SLIDER_BACK)) model_harness_slider_back(); if (is_model(MODEL_HARNESS_SLIDER_BACK)) model_harness_slider_back();
@ -331,11 +299,7 @@ if (!is_undef(validation)) {
} else { } else {
intersection() { intersection() {
if (!is_undef(xray)) { if (!is_undef(xray)) {
if (xray == XRAY_POSITIVE) { span_cube([0,1000*xray], [0,1000*xray], [-1000,1000]);
span_cube([0,1000], [0,1000], [-1000,1000]);
} else if (xray == XRAY_BACKPLANE) {
span_cube([-1000,1000], [-1000,1000], [-1000,-7]);
}
} }
union() { union() {
if (is_not_export()) { if (is_not_export()) {

View File

@ -1,134 +0,0 @@
// dependency: https://github.com/revarbat/BOSL
include <BOSL/constants.scad>
use <BOSL/transforms.scad>
use <BOSL/shapes.scad>
use <BOSL/masks.scad>
use <BOSL/sliders.scad>
// DEBUG:
//validation = 1;
//xray = 1;
// EXPORT:
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();
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];
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);
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=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) cuboid(cutout_size, fillet=2, edges=EDGES_Z_ALL);
model_rib_left(socket=true);
model_rib_right(socket=true);
}
}
module platform_rib(socket=false) {
rib_size=[rib_thickness, base_size.y - 2, rib_height];
difference() {
union() {
difference() {
down(rib_size.z/2) scale(socket ? 1.01 : 1) sparse_strut(h=rib_size.z, l=rib_size.y, thick=rib_size.x, strut=1.2, maxang=40, max_bridge=4);
arm();
}
difference() {
intersection() {
down(rib_size.z/2) cube(rib_size, center=true);
scale(1.07) arm();
}
down(2) scale(1.0) arm();
}
}
fwd(brace_pos.y) platform_rib_brace(socket=true);
back(brace_pos.y) platform_rib_brace(socket=true);
}
}
module platform_rib_brace(socket=false) {
down(rib_height - 1.2 - brace_size.z/2) scale(socket ? 1.02 : 1) cuboid(brace_size, fillet=1, edges=EDGES_X_ALL);
}
module model_rib_left(socket=false) {
left(rib_pos.x) up(rib_pos.z) platform_rib(socket=socket);
}
module model_rib_right(socket=false) {
right(rib_pos.x) up(rib_pos.z) platform_rib(socket=socket);
}
module model_brace_front() {
fwd(brace_pos.y) up(brace_pos.z) platform_rib_brace();
}
module model_brace_back() {
back(brace_pos.y) up(brace_pos.z) platform_rib_brace();
}
if (is_model(MODEL_STRAP_PLATFORM_BASE)) platform_base();
if (is_model(MODEL_STRAP_PLATFORM_RIB)) model_rib_left();
if (is_model(MODEL_STRAP_PLATFORM_RIB_BRACE)) model_brace_front();
if (is_not_export()) {
model_rib_right();
model_brace_back();
}
}
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();