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) \
|
--raft-layers $(PRINT_RAFT_LAYERS) \
|
||||||
--fill-density $(PRINT_DENSITY)
|
--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
|
build/cases/pp.stl: src/pp/*.scad
|
||||||
mkdir -p build
|
|
||||||
|
build/%.stl: src/%.scad src/*.scad src/lib/*.scad
|
||||||
|
mkdir -p $(shell dirname $@)
|
||||||
openscad $< -o $@
|
openscad $< -o $@
|
||||||
|
|
||||||
%.gcode: %.stl
|
%.gcode: %.stl
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
include <lib/defaults.scad>
|
include <lib/defaults.scad>
|
||||||
use <lib/primitives.scad>
|
use <lib/primitives.scad>
|
||||||
use <pp/exports.scad>
|
|
||||||
|
|
||||||
// thickness of case walls
|
// thickness of case walls
|
||||||
Thickness = 3.5;
|
Thickness = 3.5;
|
||||||
@@ -20,7 +19,7 @@ FrontOverhangBot = 7;
|
|||||||
module _PhoneBulkLayer(tol=tol)
|
module _PhoneBulkLayer(tol=tol)
|
||||||
{
|
{
|
||||||
minkowski() {
|
minkowski() {
|
||||||
PPBody();
|
children(/*body*/);
|
||||||
cube([20, 20, tol], center=true);
|
cube([20, 20, tol], center=true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,9 +39,10 @@ module _DilatedBody(ButtonStyle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module _PeripheralCutouts(ButtonStyle) {
|
module _PeripheralCutouts(ButtonStyle) {
|
||||||
buttons = 0;
|
body = 0;
|
||||||
ports = 1;
|
buttons = 1;
|
||||||
camera = 2;
|
ports = 2;
|
||||||
|
camera = 3;
|
||||||
union() {
|
union() {
|
||||||
minkowski() {
|
minkowski() {
|
||||||
sphere(r=MarginCameraCut);
|
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
|
// restrict these cutouts to just the phone bulk -- don't let them impact the back of the case
|
||||||
intersection() {
|
intersection() {
|
||||||
_PhoneBulkLayer();
|
_PhoneBulkLayer() children(body);
|
||||||
union() {
|
union() {
|
||||||
if (ButtonStyle == "cut") {
|
if (ButtonStyle == "cut") {
|
||||||
minkowski() {
|
minkowski() {
|
||||||
@@ -70,8 +70,8 @@ module _PeripheralCutouts(ButtonStyle) {
|
|||||||
module _FrontFace(tol=tol) {
|
module _FrontFace(tol=tol) {
|
||||||
color("thistle")
|
color("thistle")
|
||||||
difference() {
|
difference() {
|
||||||
translate([0, 0, -Thickness]) children();
|
translate([0, 0, -Thickness]) children(/*body*/);
|
||||||
_PhoneBulkLayer(tol=tol);
|
_PhoneBulkLayer(tol=tol) children(/*body*/);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,11 +85,11 @@ module _FrontKeep(tol=tol) {
|
|||||||
difference() {
|
difference() {
|
||||||
minkowski() {
|
minkowski() {
|
||||||
cylinder(r=2*tol, h=tol, center=true);
|
cylinder(r=2*tol, h=tol, center=true);
|
||||||
_FrontFace() children();
|
_FrontFace() children(/*body*/);
|
||||||
};
|
};
|
||||||
minkowski() {
|
minkowski() {
|
||||||
cylinder(r=tol, h=2*tol, center=true);
|
cylinder(r=tol, h=2*tol, center=true);
|
||||||
_FrontFace() children();
|
_FrontFace() children(/*body*/);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
// and expand it
|
// and expand it
|
||||||
@@ -103,18 +103,17 @@ module _FrontKeep(tol=tol) {
|
|||||||
/// the returned cutout is strictly z <= 0,
|
/// the returned cutout is strictly z <= 0,
|
||||||
module _FrontCutout() {
|
module _FrontCutout() {
|
||||||
difference() {
|
difference() {
|
||||||
_FrontFace() children();
|
_FrontFace() children(/*body*/);
|
||||||
_FrontKeep() children();
|
_FrontKeep() children(/*body*/);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
module Case(ButtonStyle="extrude")
|
module _Case(ButtonStyle)
|
||||||
{
|
{
|
||||||
body = 0;
|
body = 0;
|
||||||
buttons = 1;
|
buttons = 1;
|
||||||
ports = 2;
|
ports = 2;
|
||||||
camera = 3;
|
camera = 3;
|
||||||
color("DarkSlateGray")
|
|
||||||
difference() {
|
difference() {
|
||||||
// start by dilating the phone
|
// start by dilating the phone
|
||||||
_DilatedBody(ButtonStyle=ButtonStyle) {
|
_DilatedBody(ButtonStyle=ButtonStyle) {
|
||||||
@@ -124,6 +123,7 @@ module Case(ButtonStyle="extrude")
|
|||||||
// then subtract away phone and cutouts
|
// then subtract away phone and cutouts
|
||||||
union() {
|
union() {
|
||||||
_PeripheralCutouts(ButtonStyle=ButtonStyle) {
|
_PeripheralCutouts(ButtonStyle=ButtonStyle) {
|
||||||
|
children(body);
|
||||||
children(buttons);
|
children(buttons);
|
||||||
children(ports);
|
children(ports);
|
||||||
children(camera);
|
children(camera);
|
||||||
@@ -141,19 +141,26 @@ module Case(ButtonStyle="extrude")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 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])
|
// translate([PPBodyWidth + Thickness, Thickness, PPBodyHeight + Thickness])
|
||||||
rotate(a=[0, 180, 0])
|
rotate(a=[0, 180, 0])
|
||||||
union() {
|
color("DarkSlateGray")
|
||||||
Case() {
|
_Case(ButtonStyle) {
|
||||||
PPBody();
|
children(0);
|
||||||
PPButtons();
|
children(1);
|
||||||
PPPorts();
|
children(2);
|
||||||
PPCamera();
|
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 = 4; //< okay for faster rendering
|
||||||
// $fs = 1; //< fine for exporting/printing; a little slow for 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,
|
// tolerance. lining up the extrusions and cuts with zero tolerance causes very thin walls,
|
||||||
// so i offset those to make the model actually contiguous.
|
// so i offset those to make the model actually contiguous.
|
||||||
|
Reference in New Issue
Block a user