From b4a8f9c1daff167397181c0ef77197a37d7af2b4 Mon Sep 17 00:00:00 2001 From: Colin Date: Sat, 23 Dec 2023 00:10:17 +0000 Subject: [PATCH] shift the front portions of the case "into" the phone, for a tighter fit --- src/case.scad | 89 +++++++++++++++++++++++++++++++++++++++-------- src/cases/pp.scad | 2 +- 2 files changed, 75 insertions(+), 16 deletions(-) diff --git a/src/case.scad b/src/case.scad index a92fae6..d232048 100644 --- a/src/case.scad +++ b/src/case.scad @@ -14,6 +14,8 @@ MarginButtonsSeat = 1.5; FrontOverhangX = 4; FrontOverhangTop = 5; FrontOverhangBot = 7; +// shift the overhang into the screen, to account that the case has some flex +FrontSquashZ = 1.2; // gives a 1cm margin around the whole body of the phone, but only in the xy plane. module _PhoneBulkLayer(tol=tol) @@ -24,6 +26,16 @@ module _PhoneBulkLayer(tol=tol) } } +/// gives as 1cm margin around the whole body of the phone, +/// on all axis EXCEPT the -z axis +module _PhoneBulkAndBack() +{ + minkowski() { + children(/*body*/); + translate([0, 0, 5+tol]) cube([20, 20, 10], center=true); + } +} + module _DilatedBody(ButtonStyle) { body = 0; buttons = 1; @@ -38,6 +50,18 @@ module _DilatedBody(ButtonStyle) { } } +module _DilatedBodyExceptFront(ButtonStyle) { + body = 0; + buttons = 1; + intersection() { + _DilatedBody() { + children(body); + children(buttons); + }; + _PhoneBulkAndBack() children(body); + } +} + module _PeripheralCutouts(ButtonStyle) { body = 0; buttons = 1; @@ -108,6 +132,31 @@ module _FrontCutout() { }; } +module _CaseExceptFeatures(ButtonStyle) +{ + body = 0; + buttons = 1; + union() { + difference() { + // start by dilating the phone + _DilatedBodyExceptFront(ButtonStyle=ButtonStyle) { + children(body); + children(buttons); + }; + // subtract the phone + children(body); + } + // add in the front part of the case + intersection() { + _FrontKeep() translate([0, 0, FrontSquashZ]) children(body); + _DilatedBody() { + children(body); + children(buttons); + }; + }; + }; +} + module _Case(ButtonStyle) { body = 0; @@ -115,28 +164,23 @@ module _Case(ButtonStyle) ports = 2; camera = 3; difference() { - // start by dilating the phone - _DilatedBody(ButtonStyle=ButtonStyle) { + _CaseExceptFeatures(ButtonStyle=ButtonStyle) { children(body); children(buttons); }; - // then subtract away phone and cutouts union() { + // then the cutouts _PeripheralCutouts(ButtonStyle=ButtonStyle) { children(body); children(buttons); children(ports); children(camera); }; - // subtract the phone - children(body); - // subtract the buttons (we want to give them a buffer) + // subtract the buttons (we want to give them a buffer even if ButtonStyle=extrude) minkowski() { cylinderX(r=MarginButtonsSeat, h=MarginButtonsSeat/2, center=true); children(buttons); }; - // subtract the touchscreen area - translate([0, 0, tol]) _FrontCutout() children(body); } } } @@ -153,14 +197,29 @@ module _Case(ButtonStyle) /// ``` /// /// replace "Phone" above with the specific model, e.g. `PP` like `PPBody()` -module Case(ButtonStyle="extrude") { +module Case(ButtonStyle="extrude", RenderPhone=false) { + body = 0; + buttons = 1; + ports = 2; + camera = 3; // translate([PPBodyWidth + Thickness, Thickness, PPBodyHeight + Thickness]) rotate(a=[0, 180, 0]) - color("DarkSlateGray") - _Case(ButtonStyle) { - children(0); - children(1); - children(2); - children(3); + union() { + color("DarkSlateGray") _Case(ButtonStyle) { + children(body); + children(buttons); + children(ports); + children(camera); + }; + if (RenderPhone) { + difference() { + union() { + children(body); + children(buttons); + children(camera); + }; + children(ports); + }; + }; }; } diff --git a/src/cases/pp.scad b/src/cases/pp.scad index acafc50..7102a9c 100644 --- a/src/cases/pp.scad +++ b/src/cases/pp.scad @@ -1,7 +1,7 @@ use <../case.scad> use <../pp/exports.scad> -Case() { +Case(RenderPhone=false) { PPBody(); PPButtons(); PPPorts();