make the volume/power buttons and USB port pills
This commit is contained in:
41
bits.scad
41
bits.scad
@@ -1,47 +1,56 @@
|
|||||||
include <dimensions.scad>
|
include <dimensions.scad>
|
||||||
use <primitives.scad>
|
use <primitives.scad>
|
||||||
|
|
||||||
module Volume_(Depth)
|
module Volume_(Depth, Box=false)
|
||||||
{
|
{
|
||||||
|
if (Box) {
|
||||||
cube([Depth, VolumeLength, VolumeHeight], center=false);
|
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)
|
||||||
{
|
{
|
||||||
|
if (Box) {
|
||||||
cube([Depth, PowerLength, PowerHeight], center=false);
|
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) {
|
if (Box) {
|
||||||
cube([CameraWidth, CameraLength, Depth], center=false);
|
cube([CameraWidth, CameraLength, Depth], center=false);
|
||||||
} else {
|
} else {
|
||||||
minkowski() {
|
pillZ(CameraWidth, CameraLength, Depth, center=false);
|
||||||
cube([CameraWidth-CameraLength+Tol, Tol, Depth-Tol], center=false);
|
|
||||||
cylinderZ(d=CameraLength-Tol, h=Tol, center=false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module Camera(Depth, Box=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)
|
||||||
{
|
{
|
||||||
|
if (Box) {
|
||||||
cube([UsbWidth, Depth, UsbHeight], center=false);
|
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)
|
module Aux_(Depth)
|
||||||
@@ -50,7 +59,7 @@ module Aux_(Depth)
|
|||||||
}
|
}
|
||||||
module Aux(Depth)
|
module Aux(Depth)
|
||||||
{
|
{
|
||||||
translate([AuxMinX, 0, AuxMinZ])Aux_(Depth);
|
translate([AuxMinX, 0, AuxMinZ]) Aux_(Depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
// module Speaker()
|
// module Speaker()
|
||||||
|
@@ -41,12 +41,12 @@ module Phone(Box=false)
|
|||||||
difference() {
|
difference() {
|
||||||
union() {
|
union() {
|
||||||
if (Box) { BodyBox(); } else { Body(); }
|
if (Box) { BodyBox(); } else { Body(); }
|
||||||
Volume(2);
|
Volume(2, Box=Box);
|
||||||
Power(2);
|
Power(2, Box=Box);
|
||||||
Camera(2, Box=Box);
|
Camera(2, Box=Box);
|
||||||
}
|
}
|
||||||
union() {
|
union() {
|
||||||
translate([0, Tol, 0])Usb(2);
|
translate([0, Tol, 0])Usb(2, Box=Box);
|
||||||
translate([0, -Tol, 0])Aux(2);
|
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;
|
function _toRad(r=undef, d=undef) = (r != undef) ? r : d/2;
|
||||||
|
|
||||||
module _translateIf(cond, amount) {
|
module _translateIf(cond, amount) {
|
||||||
|
Reference in New Issue
Block a user