Files
lianshroud/fan_mount.scad
2024-04-03 19:44:22 -04:00

181 lines
4.5 KiB
OpenSCAD

/* */
include <BOSL/shapes.scad>
include <BOSL/transforms.scad>
include <inserts/inserts.scad>
/* [Mount Dimensions] */
CASE_HOLE_X = 5.6;
CASE_HOLE_Z = 11.00;
CASE_HOLE_Y = 1.4;
TAB_YOUT = 3.9;
TAB_THICK = 3;
TAB_Z = 9.6;
SCREEN_Y = 19.0; // Saggitta of mesh path
SCREEN_X = 131.6;
FAN_MOUNT_X = 128.6;
FAN_MOUNT_Z = 69.4;
/* [Render Options] */
render_show="none"; // [both, bottom, top, washer]
render_fs=.4;
render_fn=0;
render_fa=.4;
// Set Render Options
$fs= ($preview) ? $fs : render_fs;
$fn= ($preview) ? $fn : render_fn;
$fa= ($preview) ? $fa : render_fa;
module case_washer(align=V_CENTER, orient=ORIENT_Z) {
size=[CASE_HOLE_X+5, 3, CASE_HOLE_Z+5];
orient_and_align(size,align=align,orient=orient,orig_align=V_CENTER, orig_orient=ORIENT_Z)
difference() {
cuboid(size);
left(3) {
cyl(d=3.5, h=4, orient=ORIENT_Y);
cyl(d=7, h=4, align=V_BACK, orient=ORIENT_Y);
}
}
}
module case_hole(x=CASE_HOLE_X, y=CASE_HOLE_Y, z=CASE_HOLE_Z, align=V_FRONT)
{
cuboid([x,y,z], align=V_FRONT);
}
module snap(top=true)
{
cut_align= top ? V_BOTTOM : V_TOP;
zi = top ? 1 : -1;
down(zi*2.2)up(zi*(.2+CASE_HOLE_Z/2)) {
difference() {
union() {
cuboid([CASE_HOLE_X-.2, CASE_HOLE_Y+.3, 3], align=V_FRONT);
fwd(CASE_HOLE_Y+1+.2) {
cuboid([CASE_HOLE_X-.2, 2, 4], chamfer=1, edges=EDGES_X_FR);
}
}
up(zi*.6)cuboid([CASE_HOLE_X, 6+CASE_HOLE_Y, 4], align=cut_align);
}
}
%case_hole();
}
module snap_base()
{
difference() {
cuboid([CASE_HOLE_X-.2, CASE_HOLE_Y/4, CASE_HOLE_Z-1.2], align=V_FRONT);
zspread(n=5,l=CASE_HOLE_Z-4) fwd((CASE_HOLE_Y)/2)cyl(h=CASE_HOLE_X, d=1, orient=ORIENT_X);
}
}
function mesh_radius(s,l) = (s^2 + (l^2)/4) / (2 * s);
SCREEN_R = mesh_radius(s=SCREEN_Y, l=SCREEN_X);
echo ("MESHR: ", SCREEN_R);
function mesh_theta(l,r) = PI * 2*asin(l/(2*r)) / 180;
echo("Mesh_Theta", mesh_theta(SCREEN_X,SCREEN_R), "radians");
echo("mesh Width = ", SCREEN_R * mesh_theta(SCREEN_X-4, SCREEN_R));
module meshpath(s = SCREEN_Y, l= SCREEN_X, w=2, h=130) {
r = mesh_radius(s=s, l=l);
intersection() {
fwd(r-21) difference() {
cyl(r=r+w/2, h=h);
cyl(r=r-w/2, h=h+w/2);
}
back(1) cuboid([128.6,30,h], align=V_BACK);
}
}
module rail(left=true, h=265, align=V_BACK, orient=ORIENT_Z) {
lr = left ? 1 : -1;
size = [CASE_HOLE_X+2,9,h];
orient_and_align(size, orient=orient, align=align, orig_align=V_BACK)
difference() {
back(0)cuboid(size, chamfer=1.5, edges=EDGES_Z_BK, align=V_BACK);
back(2)left(lr*FAN_MOUNT_X/2) meshpath(h=h+2);
}
}
module endcap(orient=ORIENT_Z, align=V_BACK, s=SCREEN_Y, l=SCREEN_X, h=5) {
r = mesh_radius(s=s, l=l);
orient_and_align([99*2,25,h], orient=orient, align=align, orig_align=V_BACK)
difference() {
intersection() {
fwd(r-23)cyl(r=r+1, h=h);
cuboid([66*2,200,131], align=V_BACK);
}
back(2)up(2) meshpath(h=h, w=2.1);
//fwd(94-25)cyl(r=92, h=11);
}
}
//%meshpath(h=265-5);
module mesh_mount(h=265, align=V_FRONT,orient=ORIENT_Z,top=true, bottom=true) {
parts = (top && bottom)
? [-1,1]
: top ? [1] : [-1];
echo("parts: ", len(parts));
rh = len(parts) * h/2;
orient_and_align([2*128.6, 9, 265], orient=orient,align=align) union() {
difference() {
union() {
right(128.6/2) rail(left=true, h=rh, align=V_BACK);
left(128.6/2) rail(left=false, h=rh, align=V_BACK);
if (bottom) down(rh/2) endcap(align=V_BACK+V_TOP);
if (top) up(rh/2) endcap(align=V_BACK+V_BOTTOM, orient=ORIENT_ZNEG);
}
hoff = (len(parts) == 2) ? 0 : rh/2;
if (top) up(59.6/2-hoff)mount_holes(align=V_TOP);
if (bottom)down(59.6/2-hoff)mount_holes(align=V_BOTTOM);
}
brace_z = len(parts) * 10/2;
brace_off = (len(parts) == 2)
? 0
: top ? -(rh-brace_z)/2 : (rh-brace_z)/2;
up(brace_off) cuboid([125, 1, brace_z], align=V_BACK);
}
}
module mount_holes(align=V_TOP) {
orient_and_align(size=[FAN_MOUNT_X,0,FAN_MOUNT_Z+CASE_HOLE_Z], align=align)
zspread(l=FAN_MOUNT_Z) {
xspread(l=FAN_MOUNT_X) {
back(0) xrot(90) thread_insertM3(bl=10,bz=-5,$die=true);
%back(0) xrot(90) thread_insertM3(bl=10,bz=-5,$die=false);
}
}
}
module fdm_anchor(r=3, d=.4, h=.2) {
union() {
//back(d+r)
zrot(45) back(r) {
cyl(r=r, h=h, align=V_TOP);
fwd(r/2)cuboid([.5,r,h], align=V_FRONT+V_TOP);
}
}
}
module print_washer() {
back((CASE_HOLE_Z+5)/2)left((CASE_HOLE_X+5)/2) fdm_anchor();
fwd((CASE_HOLE_Z+5)/2)left((CASE_HOLE_X+5)/2) zrot(90) fdm_anchor();
back((CASE_HOLE_Z+5)/2)right((CASE_HOLE_X+5)/2) zrot(-90) fdm_anchor();
fwd((CASE_HOLE_Z+5)/2)right((CASE_HOLE_X+5)/2) zrot(180) fdm_anchor();
case_washer(orient=ORIENT_Y, align=V_TOP);
}
if (render_show == "both") mesh_mount(top=true);