add an option to extrude the vol/pow buttons instead of cut them

This commit is contained in:
2023-12-22 08:40:26 +00:00
parent 1a07e23f36
commit 886ea00ba6
2 changed files with 42 additions and 26 deletions

View File

@@ -5,16 +5,18 @@ use <phone.scad>
use <primitives.scad>
// thickness of case walls
Thickness = 2;
Thickness = 3.5;
// how large of cuts (radial) to make around each component
MarginCamera = 2;
MarginButtons = 2.5;
MarginPorts = 5.5;
MarginCameraCut = 2;
MarginButtonsCut = 2.8;
MarginPortsCut = 5.5;
MarginButtonsSeat = 1.5;
// how far into the xy plane to extend the part of the case which covers the front of the phone.
// the top of the phone contains stuff we don't want to cover (camera); the bottom has more margin
FrontOverhangX = 3;
FrontOverhangTop = 3;
FrontOverhangBot = 6;
FrontOverhangX = 4;
FrontOverhangTop = 5;
FrontOverhangBot = 7;
// gives a 1cm margin around the whole body of the phone, but only in the xy plane.
module _PhoneBulkLayer(tol=tol)
@@ -66,33 +68,36 @@ module _FrontCutout() {
};
}
module Case()
module Case(ButtonStyle="extrude")
{
color("DarkSlateGray")
difference() {
// start by dilating the phone
minkowski() {
sphere(r=Thickness);
// Phone(volume=false, power=false, camera=false);
PhoneBody();
Phone(volume=(ButtonStyle=="extrude"), power=(ButtonStyle=="extrude"), camera=false, usb=false, aux=false);
}
// then subtract away phone and cutouts
union() {
minkowski() {
sphere(r=MarginCamera);
sphere(r=MarginCameraCut);
Camera();
};
// restrict these cutouts to just the phone bulk -- don't let them impact the back of the case
intersection() {
_PhoneBulkLayer();
union() {
minkowski() {
sphere(r=MarginButtons);
union() {
Volume();
Power();
};
if (ButtonStyle == "cut") {
minkowski() {
sphere(r=MarginButtonsCut);
union() {
Volume();
Power();
};
}
}
minkowski() {
sphere(r=MarginPorts);
sphere(r=MarginPortsCut);
union() {
Usb();
Aux();
@@ -100,19 +105,30 @@ module Case()
};
};
};
// subtract the phone
Phone(usb=false, aux=false);
// subtract the buttons (we want to give them a buffer)
minkowski() {
cylinderX(r=MarginButtonsSeat, h=MarginButtonsSeat/2, center=true);
union() {
Volume();
Power();
};
};
// subtract the touchscreen area
translate([0, 0, tol]) _FrontCutout();
// _FrontCutout();
}
}
}
translate([BodyWidth + Thickness, Thickness, BodyHeight + Thickness])
rotate(a=[0, 180, 0])
union() {
Case();
// debugging:
// _FrontFace();
// _FrontKeep();
// _FrontCutout();
// Phone();
// debugging:
// _FrontFace();
// _FrontKeep();
// _FrontCutout();
// Phone();
}

View File

@@ -8,11 +8,11 @@
// i.e. the screen is defined to be at z=0.
// phone body
BodyLength=160.5;
BodyLength=160;
BodyWidth=76.6;
BodyHeight=9.2;
BodyRadXY=9.6;
BodyRadFrontZ=1.8;
BodyRadFrontZ=2.2;
// offset from top of phone to top of volume button
VolumeMinY=26.0;