CAD/insta-fun/insta-fun.scad
2024-02-24 13:16:32 +01:00

230 lines
5.4 KiB
OpenSCAD

$fn = 60;
tol = 0.1;
wall = 1;
f = wall*5;
insta360_s = [53.0, 23.6, 17.5];
lens_r = 17.1/2 + wall;
r = 5;
l = insta360_s.x+wall*2 + tol*2;
w = insta360_s.y+wall*2 + tol*3;
h = insta360_s.z + tol - 1;
m = 3;
nut = 5.5;
module rcubez(s, r) {
hull() {
for (x = [r, s.x - r]) {
for (y = [r, s.y - r]) {
translate([x, y, 0]) cylinder(s.z, r, r);
}
}
}
}
module toroid(h, r) {
translate([0, 0, h/2])
rotate_extrude(convexity = 5)
translate([r-h/2, 0]) circle(d=h);
}
module prism(l, w, h){
polyhedron(//pt 0 1 2 3 4 5
points=[[0,0,0], [l,0,0], [l,w,0], [0,w,0], [0,w,h], [l,w,h]],
faces=[[0,1,2,3],[5,4,3,2],[0,4,5,1],[0,3,4],[5,2,1]]
);
}
module button(r=r) {
toroid(f, r);
cylinder(f, r-f/2, r-f/2);
}
// Bottom rounded plate.
module plate(l=l, w=w, h=h) {
translate([w/2, 0, 0]) {
button(w/2);
translate([l-w, 0, 0]) button(w/2);
// Left and right arms.
translate([l-w, w/2-f/2, f/2])
rotate(90, [0, -1, 0])
cylinder(l-w, f/2, f/2);
translate([l-w, -w/2+f/2, f/2])
rotate(90, [0, -1, 0])
cylinder(l-w, f/2, f/2);
// Inner fill.
translate([0, -w/2+f/2, 0]) cube([l-w, w-f, h]);
translate([0, -w/2, f/2]) cube([l-w, w, h-f/2]);
// Height extensions.
translate([0, 0, f/2]) cylinder(h-f/2, w/2, w/2);
translate([l-w, 0, f/2]) cylinder(h-f/2, w/2, w/2);
}
}
module rails() {
translate([w/2, w/2 - wall/2, h])
rotate(90, [0, 1, 0])
cylinder(l-w, wall/2, wall/2);
translate([w/2, -w/2 + wall/2, h])
rotate(90, [0, 1, 0])
cylinder(l-w, wall/2, wall/2);
translate([w/2, 0, h-wall/2])
difference() {
toroid(h=wall, r=w/2);
translate([0, -2*w, 0]) cube([w*4, w*4, w]);
}
translate([l-w/2, 0, h-wall/2])
difference() {
toroid(h=wall, r=w/2);
mirror([1, 0, 0])
translate([0, -2*w, 0]) cube([w*4, w*4, w]);
}
}
module lens_hole() {
translate([wall + lens_r + w/2 - lens_r
- 1.5, // Patch.
0, -1]) {
// Lens.
cylinder(h=20, lens_r, lens_r);
// LED bar.
translate([lens_r + 2, 0, 0])
cylinder(h=20, wall*2, wall*2);
translate([lens_r-1, -wall*2, 0])
cube([2+1, wall*4, 4]);
}
}
module button_hole() {
r1 = w*0.3;
translate([l - wall - w/2, 0, -1]) {
// Hole.
cylinder(h=20, r1, r1);
}
}
module retainer() {
t = 1.3 + wall/2;
translate([w/2, w/2 - wall/2, h - t + wall/2])
rotate(90, [1, 0, 0])
prism(l-w, t, t);
}
module microphone_hole() {
translate([-5, 0, h/2 + wall])
rotate(90,[0, 1, 0]) cylinder(l*2, wall*2, wall*2);
}
mount_plate_s = [l+ 15, h, wall*1.5];
module mount_plate(add_z=0) {
rcubez([mount_plate_s.x, mount_plate_s.y, mount_plate_s.z+add_z], 2);
}
module mount_plate_fillet() {
translate([0, mount_plate_s.y, 0])
rotate(90, [0, 0, -1])
translate([0, 0, 0])
prism(mount_plate_s.y, w/2, w/2);
}
module mount_plate_locators(pad=0) {
for (x = [1, 2, 3]) {
translate([mount_plate_s.x*x/4, 0, 0])
rotate(90, [-1, 0, 0])
cylinder(mount_plate_s.y*0.7+pad, wall+pad, wall+pad);
}
}
module mount_plate_holes() {
for (x = [m*1.5, mount_plate_s.x-m*1.5]) {
translate([x, mount_plate_s.y/2, -1])
cylinder(h=20, (m+0.5)/2, (m+0.5)/2);
}
}
module safety_mount() {
s = [3, 5, 3];
translate([mount_plate_s.x-m*3.5, s.y, s.x]) {
mirror([1, 0, 0]) {
translate([-s.x*1.76, 0, -s.x])
rotate(90, [0, 0, -1]) prism(s.y, s.x*2-3, s.x*2-1);
rotate(90, [1, 0, 0]) cylinder(s.y, s.x, s.x);
translate([0, -s.y, 0])
cube([s.x*3, s.y, s.x]);
}
}
}
module mount_plate_for_bolts() {
difference() {
union() {
mount_plate();
// Fillets.
translate([m*3, 0, 0]) mount_plate_fillet();
translate([mount_plate_s.x-m*3, 0, 0])
mirror([1, 0, 0]) mount_plate_fillet();
translate([mount_plate_s.x/4, 0, 0])
cube([mount_plate_s.x/2, mount_plate_s.y, mount_plate_s.z*3]);
// Locators.
mount_plate_locators();
// Safety wire.
safety_mount();
}
mount_plate_holes();
// Safety wire hole.
translate([mount_plate_s.x-m*3.5, 30, 3])
rotate(90, [1, 0, 0]) cylinder(60, 1, 1);
}
}
module mount_plate_for_nuts() {
pad = 1.5;
difference() {
mount_plate(pad);
translate([0, 0, mount_plate_s.z+pad]) mount_plate_locators(tol*2);
mount_plate_holes();
for (x = [m*1.5, mount_plate_s.x-m*1.5]) {
translate([x, mount_plate_s.y/2, 0])
cube([nut+tol, nut*1.3+tol, wall*3], center=true);
}
}
}
module shroud_mount_plate() {
translate([(l - mount_plate_s.x)/2,
w/2, 0])
rotate(90, [1, 0, 0]) mount_plate_for_bolts();
}
module shroud() {
difference() {
union() {
plate(l, w); rails(); shroud_mount_plate();
}
translate([wall, 0, wall])
plate(l-wall*2, w-wall*2, h=20);
lens_hole();
button_hole();
microphone_hole();
}
retainer();
mirror([0, 1, 0]) retainer();
}
//shroud();
//mount_plate_for_bolts();
//translate([0, 0, -10])
mount_plate_for_nuts();