split the PinePhone case out of the generic case.scad
This commit is contained in:
8
Makefile
8
Makefile
@@ -26,10 +26,12 @@ SLIC3R_FLAGS=\
|
||||
--raft-layers $(PRINT_RAFT_LAYERS) \
|
||||
--fill-density $(PRINT_DENSITY)
|
||||
|
||||
all: build/case.stl build/case.gcode
|
||||
all: build/cases/pp.stl build/cases/pp.gcode
|
||||
|
||||
build/%.stl: src/%.scad src/*.scad
|
||||
mkdir -p build
|
||||
build/cases/pp.stl: src/pp/*.scad
|
||||
|
||||
build/%.stl: src/%.scad src/*.scad src/lib/*.scad
|
||||
mkdir -p $(shell dirname $@)
|
||||
openscad $< -o $@
|
||||
|
||||
%.gcode: %.stl
|
||||
|
@@ -1,6 +1,5 @@
|
||||
include <lib/defaults.scad>
|
||||
use <lib/primitives.scad>
|
||||
use <pp/exports.scad>
|
||||
|
||||
// thickness of case walls
|
||||
Thickness = 3.5;
|
||||
@@ -20,7 +19,7 @@ FrontOverhangBot = 7;
|
||||
module _PhoneBulkLayer(tol=tol)
|
||||
{
|
||||
minkowski() {
|
||||
PPBody();
|
||||
children(/*body*/);
|
||||
cube([20, 20, tol], center=true);
|
||||
}
|
||||
}
|
||||
@@ -32,7 +31,7 @@ module _DilatedBody(ButtonStyle) {
|
||||
sphere(r=Thickness);
|
||||
union() {
|
||||
children(body);
|
||||
if (ButtonStyle=="extrude") {
|
||||
if (ButtonStyle == "extrude") {
|
||||
children(buttons);
|
||||
};
|
||||
}
|
||||
@@ -40,9 +39,10 @@ module _DilatedBody(ButtonStyle) {
|
||||
}
|
||||
|
||||
module _PeripheralCutouts(ButtonStyle) {
|
||||
buttons = 0;
|
||||
ports = 1;
|
||||
camera = 2;
|
||||
body = 0;
|
||||
buttons = 1;
|
||||
ports = 2;
|
||||
camera = 3;
|
||||
union() {
|
||||
minkowski() {
|
||||
sphere(r=MarginCameraCut);
|
||||
@@ -50,7 +50,7 @@ module _PeripheralCutouts(ButtonStyle) {
|
||||
};
|
||||
// restrict these cutouts to just the phone bulk -- don't let them impact the back of the case
|
||||
intersection() {
|
||||
_PhoneBulkLayer();
|
||||
_PhoneBulkLayer() children(body);
|
||||
union() {
|
||||
if (ButtonStyle == "cut") {
|
||||
minkowski() {
|
||||
@@ -70,8 +70,8 @@ module _PeripheralCutouts(ButtonStyle) {
|
||||
module _FrontFace(tol=tol) {
|
||||
color("thistle")
|
||||
difference() {
|
||||
translate([0, 0, -Thickness]) children();
|
||||
_PhoneBulkLayer(tol=tol);
|
||||
translate([0, 0, -Thickness]) children(/*body*/);
|
||||
_PhoneBulkLayer(tol=tol) children(/*body*/);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -85,11 +85,11 @@ module _FrontKeep(tol=tol) {
|
||||
difference() {
|
||||
minkowski() {
|
||||
cylinder(r=2*tol, h=tol, center=true);
|
||||
_FrontFace() children();
|
||||
_FrontFace() children(/*body*/);
|
||||
};
|
||||
minkowski() {
|
||||
cylinder(r=tol, h=2*tol, center=true);
|
||||
_FrontFace() children();
|
||||
_FrontFace() children(/*body*/);
|
||||
};
|
||||
};
|
||||
// and expand it
|
||||
@@ -103,18 +103,17 @@ module _FrontKeep(tol=tol) {
|
||||
/// the returned cutout is strictly z <= 0,
|
||||
module _FrontCutout() {
|
||||
difference() {
|
||||
_FrontFace() children();
|
||||
_FrontKeep() children();
|
||||
_FrontFace() children(/*body*/);
|
||||
_FrontKeep() children(/*body*/);
|
||||
};
|
||||
}
|
||||
|
||||
module Case(ButtonStyle="extrude")
|
||||
module _Case(ButtonStyle)
|
||||
{
|
||||
body = 0;
|
||||
buttons = 1;
|
||||
ports = 2;
|
||||
camera = 3;
|
||||
color("DarkSlateGray")
|
||||
difference() {
|
||||
// start by dilating the phone
|
||||
_DilatedBody(ButtonStyle=ButtonStyle) {
|
||||
@@ -124,6 +123,7 @@ module Case(ButtonStyle="extrude")
|
||||
// then subtract away phone and cutouts
|
||||
union() {
|
||||
_PeripheralCutouts(ButtonStyle=ButtonStyle) {
|
||||
children(body);
|
||||
children(buttons);
|
||||
children(ports);
|
||||
children(camera);
|
||||
@@ -141,19 +141,26 @@ module Case(ButtonStyle="extrude")
|
||||
}
|
||||
}
|
||||
|
||||
// translate([PPBodyWidth + Thickness, Thickness, PPBodyHeight + Thickness])
|
||||
rotate(a=[0, 180, 0])
|
||||
union() {
|
||||
Case() {
|
||||
PPBody();
|
||||
PPButtons();
|
||||
PPPorts();
|
||||
PPCamera();
|
||||
/// create a case for the provided phone.
|
||||
///
|
||||
/// ```
|
||||
/// Case(ButtonStyle="extrude"|"cut") {
|
||||
/// PhoneBody();
|
||||
/// PhoneButtons();
|
||||
/// PhonePorts();
|
||||
/// PhoneCamera();
|
||||
/// };
|
||||
/// ```
|
||||
///
|
||||
/// replace "Phone" above with the specific model, e.g. `PP` like `PPBody()`
|
||||
module Case(ButtonStyle="extrude") {
|
||||
// translate([PPBodyWidth + Thickness, Thickness, PPBodyHeight + Thickness])
|
||||
rotate(a=[0, 180, 0])
|
||||
color("DarkSlateGray")
|
||||
_Case(ButtonStyle) {
|
||||
children(0);
|
||||
children(1);
|
||||
children(2);
|
||||
children(3);
|
||||
};
|
||||
|
||||
// debugging:
|
||||
// _FrontFace() PPBody();
|
||||
// _FrontKeep() PPBody();
|
||||
// _FrontCutout() PPBody();
|
||||
// PPBody();
|
||||
}
|
||||
|
9
src/cases/pp.scad
Normal file
9
src/cases/pp.scad
Normal file
@@ -0,0 +1,9 @@
|
||||
use <../case.scad>
|
||||
use <../pp/exports.scad>
|
||||
|
||||
Case() {
|
||||
PPBody();
|
||||
PPButtons();
|
||||
PPPorts();
|
||||
PPCamera();
|
||||
};
|
@@ -1,5 +1,5 @@
|
||||
$fs = 4; //< okay for faster rendering
|
||||
// $fs = 1; //< fine for exporting/printing; a little slow for rendering
|
||||
// $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.
|
||||
|
Reference in New Issue
Block a user