re-model the phone
case.scad is dead: i'll recreate it later
This commit is contained in:
78
bits.scad
78
bits.scad
@@ -1,48 +1,60 @@
|
|||||||
module Volume()
|
include <dimensions.scad>
|
||||||
|
use <primitives.scad>
|
||||||
|
|
||||||
|
module Volume_(Depth)
|
||||||
{
|
{
|
||||||
hull() {
|
cube([Depth, VolumeLength, VolumeHeight], center=false);
|
||||||
translate([10,0,0])cylinder(d=5, h=5);
|
}
|
||||||
translate([-10,0,0])cylinder(d=5, h=5);
|
module Volume(Depth)
|
||||||
}
|
{
|
||||||
|
translate([BodyWidth, VolumeMinY, VolumeMinZ])Volume_(Depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
module Power()
|
module Power_(Depth)
|
||||||
{
|
{
|
||||||
hull() {
|
cube([Depth, PowerLength, PowerHeight], center=false);
|
||||||
translate([5,0,0])cylinder(d=5, h=5);
|
}
|
||||||
translate([-5,0,0])cylinder(d=5, h=5);
|
module Power(Depth)
|
||||||
}
|
{
|
||||||
|
translate([BodyWidth, PowerMinY, PowerMinZ])Power_(Depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
module Camera()
|
module Camera_(Depth)
|
||||||
{
|
{
|
||||||
hull() {
|
cube([CameraWidth, CameraLength, Depth], center=false);
|
||||||
translate([0,10,0])cylinder(d=10, h=5);
|
}
|
||||||
translate([0,-10,0])cylinder(d=10, h=5);
|
module Camera(Depth)
|
||||||
}
|
{
|
||||||
|
translate([CameraMinX, CameraMinY, -Depth])Camera_(Depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
module Speaker()
|
module Usb_(Depth)
|
||||||
{
|
{
|
||||||
hull() {
|
cube([UsbWidth, Depth, UsbHeight], center=false);
|
||||||
translate([0,5,0])cylinder(d=5, h=5);
|
}
|
||||||
translate([0,25,0])cylinder(d=5, h=5);
|
module Usb(Depth)
|
||||||
}
|
{
|
||||||
hull() {
|
translate([BodyWidth/2 - UsbWidth/2, BodyLength-Depth, UsbMinZ])Usb_(Depth);
|
||||||
translate([0,-5,0])cylinder(d=5, h=5);
|
|
||||||
translate([0,-25,0])cylinder(d=5, h=5);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module Usb()
|
module Aux_(Depth)
|
||||||
{
|
{
|
||||||
hull() {
|
translate([3.5/2, 0, 0])cylinderY(d=3.5, h=Depth);
|
||||||
translate([0,5,0])cylinder(d=5, h=5);
|
}
|
||||||
translate([0,-5,0])cylinder(d=5, h=5);
|
module Aux(Depth)
|
||||||
}
|
{
|
||||||
|
translate([AuxMinX, 0, AuxMinZ])Aux_(Depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
module Microphone()
|
// module Speaker()
|
||||||
{
|
// {
|
||||||
cylinder(d=3, h=5);
|
// 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);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
@@ -1,5 +1,40 @@
|
|||||||
Length=160.5;
|
// all measurements in mm
|
||||||
Width=76.6;
|
//
|
||||||
Height=9.2;
|
// 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;
|
||||||
|
67
phone.scad
67
phone.scad
@@ -1,26 +1,57 @@
|
|||||||
include <dimensions.scad>
|
include <dimensions.scad>
|
||||||
use <bits.scad>
|
use <bits.scad>
|
||||||
|
use <primitives.scad>
|
||||||
|
|
||||||
$fs = 1;
|
$fs = 1;
|
||||||
|
|
||||||
module phone (Pad=0, Bits=0)
|
Tol = 0.1;
|
||||||
{
|
|
||||||
minkowski() {
|
// simple box-shaped body; preserve for easier debugging
|
||||||
cube([Length-Height+0.2, Width-Height+0.2, 0.2], true);
|
module BodyBox() {
|
||||||
sphere(d=(Height-0.2)+Pad);
|
cube([BodyWidth, BodyLength, BodyHeight], center=false);
|
||||||
}
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//%cube([Length, Width, Height], true);
|
// return the kernel which can be convolved with the box body to produce the actual body
|
||||||
phone(Bits=1);
|
module BodyConvolve(Tol=Tol) {
|
||||||
%phone(4);
|
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
9
primitives.scad
Normal 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);
|
||||||
|
}
|
Reference in New Issue
Block a user