make the camera box rounded

This commit is contained in:
2023-12-21 22:57:00 +00:00
parent 931928bb80
commit 9586885b5b
3 changed files with 35 additions and 11 deletions

View File

@@ -19,13 +19,20 @@ module Power(Depth)
translate([BodyWidth, PowerMinY, PowerMinZ])Power_(Depth);
}
module Camera_(Depth)
module Camera_(Depth, Box=false, Tol=0.01)
{
cube([CameraWidth, CameraLength, Depth], center=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);
}
}
}
module Camera(Depth)
module Camera(Depth, Box=false)
{
translate([CameraMinX, CameraMinY, -Depth])Camera_(Depth);
translate([CameraMinX, CameraMinY, -Depth])Camera_(Depth, Box=Box);
}
module Usb_(Depth)
@@ -39,7 +46,7 @@ module Usb(Depth)
module Aux_(Depth)
{
translate([3.5/2, 0, 0])cylinderY(d=3.5, h=Depth);
cylinderY(d=3.5, h=Depth, center=false);
}
module Aux(Depth)
{

View File

@@ -43,7 +43,7 @@ module Phone(Box=false)
if (Box) { BodyBox(); } else { Body(); }
Volume(2);
Power(2);
Camera(2);
Camera(2, Box=Box);
}
union() {
translate([0, Tol, 0])Usb(2);

View File

@@ -1,9 +1,26 @@
/// cylinder() but with the axis on the y axis instead of the z axis
module cylinderY(d=undef, r=undef, h=undef, center=false) {
rotate(a=[-90,0,0]) cylinder(d=d, r=r, h=h, center=center);
function _toRad(r=undef, d=undef) = (r != undef) ? r : d/2;
/// cylinder() where `center=false` behaves like for `cube(center=false)`,
/// i.e. circle center is not at (0, 0) but (r, r)
module cylinderZ(d=undef, r=undef, h=undef, center=false) {
if (center) {
cylinder(d=d, r=r, h=h, center=center);
} else {
translate([_toRad(r=r, d=d), _toRad(r=r, d=d), 0]) cylinder(d=d, r=r, h=h, center=center);
}
}
/// cylinder() but with the axis on the x axis instead of the z axis
/// cylinder() but with the axis on the x axis instead of the z axis.
/// and where `center=false` behaves like for `cube(center=false)`,
/// i.e. circle center is not at (0, 0) but (r, r)
module cylinderX(d=undef, r=undef, h=undef, center=false) {
rotate(a=[0,-90,0]) cylinder(d=d, r=r, h=h, center=center);
rotate(a=[0,-90,0]) cylinderZ(d=d, r=r, h=h, center=center);
}
/// cylinder() but with the axis on the y axis instead of the z axis
/// and where `center=false` behaves like for `cube(center=false)`,
/// i.e. circle center is not at (0, 0) but (r, r)
module cylinderY(d=undef, r=undef, h=undef, center=false) {
rotate(a=[-90,0,0]) cylinderZ(d=d, r=r, h=h, center=center);
}