re-model the phone

case.scad is dead: i'll recreate it later
This commit is contained in:
2023-12-21 07:11:57 +00:00
parent 3bf24c420c
commit ecc55805fb
4 changed files with 141 additions and 54 deletions

View File

@@ -1,48 +1,60 @@
module Volume()
include <dimensions.scad>
use <primitives.scad>
module Volume_(Depth)
{
hull() {
translate([10,0,0])cylinder(d=5, h=5);
translate([-10,0,0])cylinder(d=5, h=5);
}
cube([Depth, VolumeLength, VolumeHeight], center=false);
}
module Volume(Depth)
{
translate([BodyWidth, VolumeMinY, VolumeMinZ])Volume_(Depth);
}
module Power()
module Power_(Depth)
{
hull() {
translate([5,0,0])cylinder(d=5, h=5);
translate([-5,0,0])cylinder(d=5, h=5);
}
cube([Depth, PowerLength, PowerHeight], center=false);
}
module Power(Depth)
{
translate([BodyWidth, PowerMinY, PowerMinZ])Power_(Depth);
}
module Camera()
module Camera_(Depth)
{
hull() {
translate([0,10,0])cylinder(d=10, h=5);
translate([0,-10,0])cylinder(d=10, h=5);
}
cube([CameraWidth, CameraLength, Depth], center=false);
}
module Camera(Depth)
{
translate([CameraMinX, CameraMinY, -Depth])Camera_(Depth);
}
module Speaker()
module Usb_(Depth)
{
hull() {
translate([0,5,0])cylinder(d=5, h=5);
translate([0,25,0])cylinder(d=5, h=5);
}
hull() {
translate([0,-5,0])cylinder(d=5, h=5);
translate([0,-25,0])cylinder(d=5, h=5);
}
cube([UsbWidth, Depth, UsbHeight], center=false);
}
module Usb(Depth)
{
translate([BodyWidth/2 - UsbWidth/2, BodyLength-Depth, UsbMinZ])Usb_(Depth);
}
module Usb()
module Aux_(Depth)
{
hull() {
translate([0,5,0])cylinder(d=5, h=5);
translate([0,-5,0])cylinder(d=5, h=5);
}
translate([3.5/2, 0, 0])cylinderY(d=3.5, h=Depth);
}
module Aux(Depth)
{
translate([AuxMinX, 0, AuxMinZ])Aux_(Depth);
}
module Microphone()
{
cylinder(d=3, h=5);
}
// module Speaker()
// {
// hull() {
// translate([0,5,0])cylinder(d=5, h=5);
// translate([0,25,0])cylinder(d=5, h=5);
// }
// hull() {
// translate([0,-5,0])cylinder(d=5, h=5);
// translate([0,-25,0])cylinder(d=5, h=5);
// }
// }

View File

@@ -1,5 +1,40 @@
Length=160.5;
Width=76.6;
Height=9.2;
// all measurements in mm
//
// x = width
// y = length = the longest axis of the phone
// z = height = the shortest axis of the phone
//
// (0, 0, 0) = top-left of the front of the phone.
// i.e. the screen is defined to be at z=0.
// phone body
BodyLength=160.5;
BodyWidth=76.6;
BodyHeight=9.2;
BodyRadXY=9.6;
BodyRadFrontZ=1.8;
// offset from top of phone to top of volume button
VolumeMinY=26.0;
VolumeMinZ=3.5;
VolumeLength=19.8;
VolumeHeight=2.0;
// offset from top of phone to the top of power button
PowerMinY=53.0;
PowerMinZ=3.5;
PowerLength=10.0;
PowerHeight=2.0;
// offset from left edge of phone to left edge of 3.5mm audio jack
AuxMinX=23.0;
AuxMinZ=4.1;
UsbWidth=9.0;
UsbHeight=3.5;
UsbMinZ=5.1;
CameraMinY=4.0;
CameraMinX=41.6;
CameraWidth=22.0;
CameraLength=10.0;

View File

@@ -1,26 +1,57 @@
include <dimensions.scad>
use <bits.scad>
use <primitives.scad>
$fs = 1;
module phone (Pad=0, Bits=0)
{
minkowski() {
cube([Length-Height+0.2, Width-Height+0.2, 0.2], true);
sphere(d=(Height-0.2)+Pad);
}
if(Bits != 0) {
// add holes for buttons and other things
translate([-50,Width/2+4,0]) rotate([90,0,0]) Volume();
translate([-25,Width/2+4,0]) rotate([90,0,0]) Power();
translate([-70,-17,-Height/2-4]) Camera();
translate([70,0,-Height/2-4]) Speaker();
translate([Length/2,0,0]) rotate([0,90,0]) Usb();
translate([Length/2,20,0]) rotate([0,90,0]) Microphone();
}
Tol = 0.1;
// simple box-shaped body; preserve for easier debugging
module BodyBox() {
cube([BodyWidth, BodyLength, BodyHeight], center=false);
}
//%cube([Length, Width, Height], true);
phone(Bits=1);
%phone(4);
// return the kernel which can be convolved with the box body to produce the actual body
module BodyConvolve(Tol=Tol) {
minkowski() {
// cylinder rounds the four corners of the phone
cylinder(r=BodyRadXY-BodyRadFrontZ, h=Tol, center=true);
// sphere rounds the thickness of the phone
// in actuality this shouldn't be symmetric (the screen and back cover have different radii),
// but using a single radius is Good Enough
sphere(r=BodyRadFrontZ);
// cylinderY(r=BodyRadFrontZ, h=Tol, center=true);
// cylinderX(r=BodyRadFrontZ, h=Tol, center=true);
}
}
module Body()
{
translate([BodyRadXY, BodyRadXY, BodyRadFrontZ])
minkowski() {
cube([BodyWidth-2*BodyRadXY, BodyLength-2*BodyRadXY, BodyHeight-2*BodyRadFrontZ], center=false);
BodyConvolve();
}
}
module Phone(Box=false)
{
difference() {
union() {
if (Box) { BodyBox(); } else { Body(); }
Volume(2);
Power(2);
Camera(2);
}
union() {
translate([0, Tol, 0])Usb(2);
translate([0, -Tol, 0])Aux(2);
}
}
}
Phone();
// debugging:
// translate([0, 0, 20])Phone(Box=true);
// translate([0, 0, 80])BodyConvolve();

9
primitives.scad Normal file
View File

@@ -0,0 +1,9 @@
/// 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);
}
/// cylinder() but with the axis on the x axis instead of the z axis
module cylinderX(d=undef, r=undef, h=undef, center=false) {
rotate(a=[0,-90,0]) cylinder(d=d, r=r, h=h, center=center);
}