diff --git a/src/case.scad b/src/case.scad index b1d95bd..beaa646 100644 --- a/src/case.scad +++ b/src/case.scad @@ -1,8 +1,6 @@ include -include -use -use use +use // thickness of case walls Thickness = 3.5; @@ -22,7 +20,7 @@ FrontOverhangBot = 7; module _PhoneBulkLayer(tol=tol) { minkowski() { - PhoneBody(); + PPBody(); cube([20, 20, tol], center=true); } } @@ -30,7 +28,7 @@ module _PhoneBulkLayer(tol=tol) module _FrontFace(tol=tol) { color("thistle") difference() { - translate([0, 0, -Thickness]) PhoneBody(); + translate([0, 0, -Thickness]) PPBody(); _PhoneBulkLayer(tol=tol); }; } @@ -70,18 +68,27 @@ module _FrontCutout() { module Case(ButtonStyle="extrude") { + body = 0; + buttons = 1; + ports = 2; + camera = 3; color("DarkSlateGray") difference() { // start by dilating the phone minkowski() { sphere(r=Thickness); - Phone(volume=(ButtonStyle=="extrude"), power=(ButtonStyle=="extrude"), camera=false, usb=false, aux=false); + union() { + children(body); + if (ButtonStyle=="extrude") { + children(buttons); + }; + } } // then subtract away phone and cutouts union() { minkowski() { sphere(r=MarginCameraCut); - Camera(); + children(camera); }; // restrict these cutouts to just the phone bulk -- don't let them impact the back of the case intersection() { @@ -90,30 +97,21 @@ module Case(ButtonStyle="extrude") if (ButtonStyle == "cut") { minkowski() { sphere(r=MarginButtonsCut); - union() { - Volume(); - Power(); - }; - } - } + children(buttons); + }; + }; minkowski() { sphere(r=MarginPortsCut); - union() { - Usb(); - Aux(); - }; + children(ports); }; }; }; // subtract the phone - Phone(usb=false, aux=false); + children(body); // subtract the buttons (we want to give them a buffer) minkowski() { cylinderX(r=MarginButtonsSeat, h=MarginButtonsSeat/2, center=true); - union() { - Volume(); - Power(); - }; + children(buttons); }; // subtract the touchscreen area translate([0, 0, tol]) _FrontCutout(); @@ -121,10 +119,15 @@ module Case(ButtonStyle="extrude") } } -translate([BodyWidth + Thickness, Thickness, BodyHeight + Thickness]) +// translate([PPBodyWidth + Thickness, Thickness, PPBodyHeight + Thickness]) rotate(a=[0, 180, 0]) union() { - Case(); + Case() { + PPBody(); + PPButtons(); + PPPorts(); + PPCamera(); + }; // debugging: // _FrontFace(); diff --git a/src/defaults.scad b/src/defaults.scad index 486dd5f..b19ee07 100644 --- a/src/defaults.scad +++ b/src/defaults.scad @@ -1,4 +1,5 @@ -$fs = 1; +$fs = 4; //< okay for faster rendering +// $fs = 1; //< fine for exporting/printing; a little slow for rendering // tolerance. lining up the extrusions and cuts with zero tolerance causes very thin walls, // so i offset those to make the model actually contiguous. diff --git a/src/bits.scad b/src/pp/bits.scad similarity index 96% rename from src/bits.scad rename to src/pp/bits.scad index f436991..96bbe5b 100644 --- a/src/bits.scad +++ b/src/pp/bits.scad @@ -1,6 +1,7 @@ -include +include <../defaults.scad> +use <../primitives.scad> + include -use module Volume_(Depth, Box=false) { diff --git a/src/dimensions.scad b/src/pp/dimensions.scad similarity index 100% rename from src/dimensions.scad rename to src/pp/dimensions.scad diff --git a/src/pp/exports.scad b/src/pp/exports.scad new file mode 100644 index 0000000..2ad4919 --- /dev/null +++ b/src/pp/exports.scad @@ -0,0 +1,26 @@ +//! re-export the public-facing details for the PinePhone. +//! i.e. the body, buttons, ports, camera. +use +use + +module PPButtons(volume=true, power=true) { + union() { + if (volume) Volume(); + if (power) Power(); + }; +} + +module PPPorts(usb=true, aux=true) { + union() { + if (usb) Usb(); + if (aux) Aux(); + }; +} + +module PPCamera() { + Camera(); +} + +module PPBody() { + Body(); +} diff --git a/src/phone.scad b/src/pp/phone.scad similarity index 93% rename from src/phone.scad rename to src/pp/phone.scad index 56dba25..0de5ff2 100644 --- a/src/phone.scad +++ b/src/pp/phone.scad @@ -1,7 +1,8 @@ -include +include <../defaults.scad> +use <../primitives.scad> + include use -use // return the kernel which can be convolved with the box body to produce the actual body @@ -18,7 +19,7 @@ module _BodyConvolve(tol=tol) { } } -module PhoneBody(Box=false) +module Body(Box=false) { if (Box) { cube([BodyWidth, BodyLength, BodyHeight], center=false); @@ -35,7 +36,7 @@ module Phone(Box=false, volume=true, power=true, camera=true, usb=true, aux=true { difference() { union() { - PhoneBody(Box=Box); + Body(Box=Box); if (volume) { Volume(Box=Box); } if (power) { Power(Box=Box); } if (camera) { Camera(Box=Box); }