make the volume/power buttons and USB port pills
This commit is contained in:
47
bits.scad
47
bits.scad
@@ -1,47 +1,56 @@
|
||||
include <dimensions.scad>
|
||||
use <primitives.scad>
|
||||
|
||||
module Volume_(Depth)
|
||||
module Volume_(Depth, Box=false)
|
||||
{
|
||||
cube([Depth, VolumeLength, VolumeHeight], center=false);
|
||||
if (Box) {
|
||||
cube([Depth, VolumeLength, VolumeHeight], center=false);
|
||||
} else {
|
||||
pillX(Depth, VolumeLength, VolumeHeight, center=false);
|
||||
}
|
||||
}
|
||||
module Volume(Depth)
|
||||
module Volume(Depth, Box=false)
|
||||
{
|
||||
translate([BodyWidth, VolumeMinY, VolumeMinZ])Volume_(Depth);
|
||||
translate([BodyWidth, VolumeMinY, VolumeMinZ]) Volume_(Depth, Box=Box);
|
||||
}
|
||||
|
||||
module Power_(Depth)
|
||||
module Power_(Depth, Box=false)
|
||||
{
|
||||
cube([Depth, PowerLength, PowerHeight], center=false);
|
||||
if (Box) {
|
||||
cube([Depth, PowerLength, PowerHeight], center=false);
|
||||
} else {
|
||||
pillX(Depth, PowerLength, PowerHeight, center=false);
|
||||
}
|
||||
}
|
||||
module Power(Depth)
|
||||
module Power(Depth, Box=false)
|
||||
{
|
||||
translate([BodyWidth, PowerMinY, PowerMinZ])Power_(Depth);
|
||||
translate([BodyWidth, PowerMinY, PowerMinZ]) Power_(Depth, Box=Box);
|
||||
}
|
||||
|
||||
module Camera_(Depth, Box=false, Tol=0.01)
|
||||
module Camera_(Depth, Box=false)
|
||||
{
|
||||
if (Box) {
|
||||
cube([CameraWidth, CameraLength, Depth], center=false);
|
||||
} else {
|
||||
minkowski() {
|
||||
cube([CameraWidth-CameraLength+Tol, Tol, Depth-Tol], center=false);
|
||||
cylinderZ(d=CameraLength-Tol, h=Tol, center=false);
|
||||
}
|
||||
pillZ(CameraWidth, CameraLength, Depth, center=false);
|
||||
}
|
||||
}
|
||||
module Camera(Depth, Box=false)
|
||||
{
|
||||
translate([CameraMinX, CameraMinY, BodyHeight])Camera_(Depth, Box=Box);
|
||||
translate([CameraMinX, CameraMinY, BodyHeight]) Camera_(Depth, Box=Box);
|
||||
}
|
||||
|
||||
module Usb_(Depth)
|
||||
module Usb_(Depth, Box=false)
|
||||
{
|
||||
cube([UsbWidth, Depth, UsbHeight], center=false);
|
||||
if (Box) {
|
||||
cube([UsbWidth, Depth, UsbHeight], center=false);
|
||||
} else {
|
||||
pillY(UsbWidth, Depth, UsbHeight, center=false);
|
||||
}
|
||||
}
|
||||
module Usb(Depth)
|
||||
module Usb(Depth, Box=false)
|
||||
{
|
||||
translate([BodyWidth/2 - UsbWidth/2, BodyLength-Depth, UsbMinZ])Usb_(Depth);
|
||||
translate([BodyWidth/2 - UsbWidth/2, BodyLength-Depth, UsbMinZ]) Usb_(Depth, Box=Box);
|
||||
}
|
||||
|
||||
module Aux_(Depth)
|
||||
@@ -50,7 +59,7 @@ module Aux_(Depth)
|
||||
}
|
||||
module Aux(Depth)
|
||||
{
|
||||
translate([AuxMinX, 0, AuxMinZ])Aux_(Depth);
|
||||
translate([AuxMinX, 0, AuxMinZ]) Aux_(Depth);
|
||||
}
|
||||
|
||||
// module Speaker()
|
||||
|
@@ -41,12 +41,12 @@ module Phone(Box=false)
|
||||
difference() {
|
||||
union() {
|
||||
if (Box) { BodyBox(); } else { Body(); }
|
||||
Volume(2);
|
||||
Power(2);
|
||||
Volume(2, Box=Box);
|
||||
Power(2, Box=Box);
|
||||
Camera(2, Box=Box);
|
||||
}
|
||||
union() {
|
||||
translate([0, Tol, 0])Usb(2);
|
||||
translate([0, Tol, 0])Usb(2, Box=Box);
|
||||
translate([0, -Tol, 0])Aux(2);
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,33 @@ module cylinderZ(d=undef, r=undef, h=undef, center=false) {
|
||||
}
|
||||
}
|
||||
|
||||
// a 2d-cylinder extruded along the x-axis
|
||||
module pillX(dimX, dimY, dimZ, tol=0.01, center=false) {
|
||||
diam = min(dimY, dimZ) - tol;
|
||||
minkowski() {
|
||||
cube([dimX/2, dimY-diam, dimZ-diam], center=center);
|
||||
cylinderX(d=diam, h=dimX/2, center=center);
|
||||
}
|
||||
}
|
||||
|
||||
// a 2d-cylinder extruded along the x-axis
|
||||
module pillY(dimX, dimY, dimZ, tol=0.01, center=false) {
|
||||
diam = min(dimX, dimZ) - tol;
|
||||
minkowski() {
|
||||
cube([dimX-diam, dimY/2, dimZ-diam], center=center);
|
||||
cylinderY(d=diam, h=dimY/2, center=center);
|
||||
}
|
||||
}
|
||||
|
||||
// a 2d-cylinder extruded along the z-axis
|
||||
module pillZ(dimX, dimY, dimZ, tol=0.01, center=false) {
|
||||
diam = min(dimX, dimY) - tol;
|
||||
minkowski() {
|
||||
cube([dimX-diam, dimY-diam, dimZ/2], center=center);
|
||||
cylinderZ(d=diam, h=dimZ/2, center=center);
|
||||
}
|
||||
}
|
||||
|
||||
function _toRad(r=undef, d=undef) = (r != undef) ? r : d/2;
|
||||
|
||||
module _translateIf(cond, amount) {
|
||||
|
Reference in New Issue
Block a user