shift the front portions of the case "into" the phone, for a tighter fit

This commit is contained in:
2023-12-23 00:10:17 +00:00
parent 9a1b87a800
commit b4a8f9c1da
2 changed files with 75 additions and 16 deletions

View File

@@ -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);
};
};
};
}

View File

@@ -1,7 +1,7 @@
use <../case.scad>
use <../pp/exports.scad>
Case() {
Case(RenderPhone=false) {
PPBody();
PPButtons();
PPPorts();