Moved Threads out Signed-off-by: Stephen J Carpenter <sjc@carpanet.net>
591 lines
22 KiB
OpenSCAD
591 lines
22 KiB
OpenSCAD
/* */
|
|
|
|
include <BOSL/constants.scad>
|
|
include <BOSL/shapes.scad>
|
|
include <BOSL/transforms.scad>
|
|
include <BOSL/joiners.scad>
|
|
include <./pc4m10.scad>
|
|
include <inserts/inserts.scad>
|
|
include <fdmouse.scad>
|
|
|
|
/* [Part] */
|
|
|
|
PART = ""; // [ all_corners, corner_top_rear, corner_top_front_l, corner_top_front_r, corner_bottom, edge_back_bottom_a, edge_back_bottom_b, edge_back_bottom_c, edge_back_bottom_d, edge_front_bottom, edge_side_top, edge_side_front, edge_side_foot_left, edge_side_foot_right, edge_top_front, edge_top_back, edge_test, full_box, joiner_top, joiner_bottom, joiner_slop, profile, side_edge, rbfoot, hinge, new_joiner, rear_mount, grid_mount, handle ]
|
|
|
|
/* [Profile Dimensions] */
|
|
|
|
PROFILE_SIZE = 34;
|
|
|
|
BOX_X = 530;
|
|
BOX_Y = 210;
|
|
BOX_Z = 210;
|
|
|
|
WIN_LIP = 10;
|
|
WIN_TRIM = 5;
|
|
WIN_THICK = 3;
|
|
|
|
FLOOR_LIP = 10;
|
|
FLOOR_THICK = 5;
|
|
|
|
//JOINER_H = 26;
|
|
//JOINER_W = 10;
|
|
JOINER_H = 14;
|
|
JOINER_W = 10;
|
|
JOINER_SLOP = .1;
|
|
|
|
RB_MOUNT_INSET=17;
|
|
RB_MOUNT_WIDTH=9;
|
|
RB_MOUNT_LEN=136;
|
|
RB_MOUNT_OUT_H=19;
|
|
RB_MOUNT_IN_H=6.15;
|
|
|
|
/* [Print Options] */
|
|
Print_Ears = false;
|
|
|
|
/* [Render Options] */
|
|
render_fs=.4;
|
|
render_fn=undef;
|
|
render_fa=.4;
|
|
|
|
// Set Render Options
|
|
$fs= ($preview) ? $fs : render_fs;
|
|
$fn= ($preview) ? $fn : render_fn;
|
|
$fa= ($preview) ? $fa : render_fa;
|
|
|
|
/***
|
|
|
|
sides:
|
|
V_TOP, [0,0,1] : Top Middle Brace
|
|
V_ALLPOS, [1,1,1] POS Corner
|
|
V_TOPLEFT, [-1,0,1] : Left Top Edge
|
|
|
|
***/
|
|
|
|
//profile();
|
|
module profile(ps=PROFILE_SIZE, wl=WIN_LIP, wt=WIN_THICK, wtr=WIN_TRIM, fl=FLOOR_LIP, ft=FLOOR_THICK, hc=false, flx=false, fly=false, wx=true, wy=true) {
|
|
conv = (wx && wy && flx)
|
|
? 3
|
|
: ((wx && wy) || (wy && flx))
|
|
? 2
|
|
: (wx || wy || flx)
|
|
? 1
|
|
: 0;
|
|
gon=concat(
|
|
[[0,ps-wl-wtr]], // Trim Start
|
|
// Y Window
|
|
wy ? hc ? [[0,ps-wl-wt],[wt,ps-wl],[wt,ps]]
|
|
: [[0,ps-wl],[wt,ps-wl],[wt,ps]]
|
|
: [[0,ps]],
|
|
[[2*wt,ps]], // End of Y.
|
|
// Inner Cut to X
|
|
flx ? [[ps-fl,2*wt+fl],[ps-fl,2*wt+fl-ft],[ps,2*wt+fl-ft]]
|
|
: [[ps,2*wt]],
|
|
// X Window
|
|
wx ? [[ps,wt],[ps-wl,wt],[ps-wl,0]]
|
|
: [[ps,0]],
|
|
[[ps-wl-wtr,0]]
|
|
);
|
|
polygon(points = gon, convexity=conv);
|
|
}
|
|
|
|
module rb_foot(fw=RB_MOUNT_WIDTH, rl=RB_MOUNT_LEN+5, rh=RB_MOUNT_OUT_H, li=false, fl=10) {
|
|
difference() {
|
|
union() {
|
|
translate([-(fl+rl/2),0]) {
|
|
linear_extrude(height=fw-1) {
|
|
offset(r=1)offset(delta=-1)union() {
|
|
square([rl+2*fl, rh]);
|
|
square([fl+2, rh+fl+6]);
|
|
translate([0,rh+fl-2,0]) square([15, 8]);
|
|
translate([rl+fl,0]) {
|
|
square([fl, rh+fl+6]);
|
|
polygon([[-3,0+rh], [0,0+rh], [0,3+rh] ]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//up(fl/2) xspread(l=fl+rl, n=2) cuboid([fl,rh+fl+6,2*fw], fillet=2, align=V_BACK);
|
|
//up(fl/2)left(rl/2)back(1.5+rh+fl+6-fl/2)cuboid([15,7,2*fw], fillet=2);
|
|
}
|
|
left(rl/2 - 3) down(.01)back(fw+rh-4.5) hull() {
|
|
cyl(r=4.5, h=fw, align=V_TOP);
|
|
right(20)cyl(r=4.5, h=fw, align=V_TOP);
|
|
}
|
|
if (li == true) {
|
|
up(4) right(fl+rl/2) back(rh + 6) xrot(180)yrot(90)m3s_clear(bl=12,bz=-12, sh=0, drop=true, $die=true);
|
|
}
|
|
up(fw/2-.5)xspread(l=2+rl+rh/2, n=2) #back(23)cuboid([3,20,3]);
|
|
}
|
|
back=5;
|
|
bmax = back + (fw-1);
|
|
|
|
fwd(bmax)up(fw-1)
|
|
yrot(90)linear_extrude(height=rl, center=true) polygon([[0,bmax-fw+1],[0,bmax],[fw-1,bmax]]);
|
|
|
|
back(8)xrot(90)fwd(bmax)up(fw-1)
|
|
yrot(90)linear_extrude(height=rl, center=true) polygon([[0,bmax-fw+1],[0,bmax],[fw-1,bmax]]);
|
|
|
|
}
|
|
|
|
module hinge_mount(bz=WIN_THICK, inv=false, bl=10) {
|
|
zspread(l=40) {
|
|
zrot(-90)xrot(90)right(5) {
|
|
up(3+2) cyl(d1=7, d2=9,h=7, align=V_TOP);
|
|
//thread_insertM3(bl=bl,bz=-(bl-3), $die=true);
|
|
m3s_clear(bl=bl,bz=-(bl-3), sh=inv ? .23 : 0, $die=true);
|
|
//%thread_insertM3(bl=10,bz=-7);
|
|
}
|
|
}
|
|
zrot(-90)xrot(90)left(5) {
|
|
up(3+2) cyl(d1=7, d2=9,h=7, align=V_TOP);
|
|
//thread_insertM3(bl=bl,bz=-(bl-3), $die=true);
|
|
m3s_clear(bl=bl,bz=-(bl-3), sh=inv ? .23 : 0, $die=true);
|
|
//%thread_insertM3(bl=10,bz=-7);
|
|
}
|
|
}
|
|
|
|
module hinge(theta=90, mx=1.8, my=5, mz=20, show=true) {
|
|
x=7;
|
|
py=20;
|
|
d = .4 / sqrt(2);
|
|
difference() {
|
|
left(x/2)cuboid([x,20+2*d,50], fillet=2, edges=EDGES_X_ALL);
|
|
zspread(n=2, l=(-1+py+mz/2)) back(5)left(x-.4-mx/2) cuboid([mx, my, mz+2]);
|
|
hinge_mount($die=true);
|
|
}
|
|
left(5+d)back(py/2 + 5+2*d)zrot(theta){
|
|
zrot(-theta)zspread(n=4, l=37.4 ) {
|
|
cyl(d=9, h=6, chamfer=.8);
|
|
right(5.3)fwd(9/4)cuboid([x,2*d+1+9/2,6], align=V_LEFT, chamfer=1, edges=EDGES_Y_RT+EDGE_BK_RT);
|
|
}
|
|
cyl(r=2, h=42);
|
|
zspread(n=3, l=25 ) {difference() {
|
|
union() {
|
|
cyl(d=9, h=6, chamfer=.8);
|
|
right(5+d)back(9/4)cuboid([x,2+9/2,6], align=V_LEFT, chamfer=1, edges=EDGES_Y_RT+EDGE_FR_RT);
|
|
}
|
|
cyl(r=2.2, h=6.2);
|
|
}
|
|
}
|
|
difference() {
|
|
left((x)/2-(5+d))back(15+5)cuboid([x,30+2*d,50], fillet=2, edges=EDGES_X_ALL);
|
|
right(5)back(20+6)zrot(180) {
|
|
hinge_mount(bl=9, $die=true);
|
|
if (show) %hinge_mount(bl=9,$die=false);
|
|
}
|
|
zspread(n=2, l=(-1+py+mz/2)) back(10)right(.4-mx/2) cuboid([mx, my, mz+2]);
|
|
}
|
|
}
|
|
}
|
|
|
|
module rearMount(md=141.333, theta=90, show=true) {
|
|
x=7;
|
|
py=30;
|
|
d = .4 / sqrt(2);
|
|
zspread(n=2, l=md) difference() {
|
|
left(x/2)cuboid([x,20+2*d,50], fillet=2, edges=EDGES_X_ALL+EDGES_Y_RT+EDGES_Z_RT);
|
|
left(x)xflip()hinge_mount($die=true);
|
|
}
|
|
left(5+d)back(13+py/2 + 5+2*d)zrot(theta) {
|
|
zrot(-theta)zspread(n=2, l=md+25+25/2 )
|
|
hull() {
|
|
right(5.3)fwd(5+py/2)cuboid([x,2*d+1+9/2+20,25/2], fillet=2, align=V_LEFT, edges=EDGES_Y_RT);
|
|
right(2*4.5+2*d) cyl(fillet=2, r=6, h=25/2);
|
|
right(4.75/2+2*d)cyl(fillet=2, r=4.75, h=25/2);
|
|
}
|
|
fwd(2*4.5+2*d) {
|
|
cyl(r=4.75, fillet=2, h=md+50);
|
|
}
|
|
}
|
|
}
|
|
|
|
module handle(d=15, l=110) {
|
|
w=1.2;
|
|
up((d+10)/2) {
|
|
cyl(d=d, h=l+1, orient=ORIENT_X);
|
|
xspread(n=2, l=l) difference() {
|
|
hull() {
|
|
cyl(d=d+10, h=8, orient=ORIENT_X, fillet=1);
|
|
down((d+10-6)/2)fwd(10)cyl(d=6, h=8, orient=ORIENT_X, fillet=1);
|
|
}
|
|
down((d+10)/2)xrot(180)m3s_clear(bl=12, bz=-12);
|
|
}
|
|
}
|
|
}
|
|
|
|
module box_edge(ps=PROFILE_SIZE, l=10, orient=ORIENT_Z, jh = JOINER_H,jw = JOINER_W, slop=JOINER_SLOP, jb=5, jup = false, jdown=false, flx=false, ft=FLOOR_THICK, wl=WIN_LIP, ioff=0, wx=true, wt=WIN_THICK, wtr = WIN_TRIM, hm=false, hc=false, ht=0, hs=false, tubepass=false, tn = 2, ix=true, iy=true, rbfoot=false, rbleft=false, cm=false, gm=false, my=false, align=V_CENTER) {
|
|
jzoff = l/2-jw/2;
|
|
inner_off = ps/2 + wt;
|
|
jdiff = (ps-wt)/2 - jh;
|
|
joiner_off = inner_off - (jh+jdiff/2)/sqrt(2)/2;//- (ps-.14)/(2*sqrt(2)) + jw/2; //- (jw)/sqrt(2);
|
|
psoff = ps/2 - wl - wt;
|
|
face_off = ((ps+psoff)/4);
|
|
orient_and_align([ps,ps,l], orient=orient, align=align, orig_orient=ORIENT_Z) left(ps/2) fwd(ps/2) {
|
|
difference() {
|
|
linear_extrude(height=l, center=true)
|
|
profile(flx=flx, hc=hc, fly=true, wx=wx, wy=true);
|
|
|
|
if (jup) up(l/2)back(joiner_off)right(joiner_off)zrot(-45)new_joiner_clear(orient=ORIENT_Y, align=V_CENTER, cl="green");
|
|
if (jdown) down(l/2)back(joiner_off)right(joiner_off)zrot(-45)yrot(180)new_joiner_clear(orient=ORIENT_Y, align=V_CENTER, cl="brown");
|
|
if (tubepass) {
|
|
if (tn > 1) {
|
|
zspread(l=l/2, n=tn) zrot(-45)back(face_off*sqrt(2)-.01)pc4M10_clear(orient=ORIENT_Y,align=V_BACK);
|
|
} else {
|
|
zrot(-45)back(face_off*sqrt(2)-.01)pc4M10_clear(orient=ORIENT_Y,align=V_BACK);
|
|
}
|
|
}
|
|
if (hm) right(face_off)back(face_off)zrot(45) color("gold") hinge_mount(inv=true);
|
|
if (iy) up(ioff) back(ps-wl/2)right(wt)yrot(-90) thread_insertM3(bl=5+wt, bz=-5, $die=true);
|
|
if (my) up(ioff) back(ps-wl/2)right(wt)yrot(-90) {
|
|
back(5)down(2.4)cuboid([20.2,12,1.8], align=V_BOTTOM);
|
|
up(.01)cuboid([22,6,2.11], align=V_BOTTOM);
|
|
}
|
|
if (ix && flx )
|
|
up(ioff) right(ps-wl/2)back(ps/2-ft-1)xrot(-90) thread_insertM3(bl=ft+6, bz=-6, $die=true);
|
|
if (ix && wx)
|
|
up(ioff) right(ps-wl/2)back(wt)xrot(90) thread_insertM3(bl=5+wt, bz=-5, $die=true);
|
|
if (cm) zspread(n=2, l=20) right(inner_off)back(inner_off)zrot(-45)xrot(-90){
|
|
thread_insertM3(bl=6, bz=-4, $die=true);
|
|
//%thread_insertM3(bl=6, bz=-4, $die=false);
|
|
}
|
|
if (gm) zspread(n=2, l=42) right(inner_off)back(inner_off)zrot(-45)xrot(-90){
|
|
thread_insertM3(bl=6, bz=-4, $die=true);
|
|
//%thread_insertM3(bl=6, bz=-4, $die=false);
|
|
}
|
|
}
|
|
if (hm && hs) zrot(45) right(face_off*sqrt(2)) %hinge(theta=ht);
|
|
if (tubepass) {
|
|
if (tn > 1) {
|
|
zspread(l=l/2, n=tn) right(0)zrot(-45)back(face_off*sqrt(2))pc4M10(orient=ORIENT_Y,align=V_BACK);
|
|
} else {
|
|
right(0)zrot(-45)back(face_off*sqrt(2)) {
|
|
pc4M10(orient=ORIENT_Y,align=V_BACK);
|
|
difference() {
|
|
cyl(h=2.28, r=1.7, orient=ORIENT_Y, align=V_BACK);
|
|
cyl(h=2.28, r=1.4, orient=ORIENT_Y, align=V_BACK);
|
|
}
|
|
difference() {
|
|
cyl(h=2.28, r=3.3, orient=ORIENT_Y, align=V_BACK);
|
|
cyl(h=2.28, r=3, orient=ORIENT_Y, align=V_BACK);
|
|
}
|
|
cyl(r=3.4, h=.2, orient=ORIENT_Y, align=V_BACK);
|
|
}
|
|
}
|
|
}
|
|
difference() {
|
|
union() {
|
|
if (jup) up(l/2)back(joiner_off)right(joiner_off)zrot(-45)new_joiner(slop=slop, orient=ORIENT_Y, align=V_CENTER);
|
|
if (jdown) down(l/2)back(joiner_off)right(joiner_off)zrot(-45)yrot(180)new_joiner(slop=slop, orient=ORIENT_Y, align=V_CENTER);
|
|
}
|
|
back(wl+6)right(ps-wl/2-.01)cuboid([wl,wl,l+10]);
|
|
}
|
|
if (rbfoot) right(ps/2+psoff-2)zrot(180) {
|
|
if (rbleft) { yrot(90) rb_foot(); } else { yrot(-90) zflip() rb_foot(); }
|
|
}
|
|
}
|
|
}
|
|
|
|
module box_corner(ps = PROFILE_SIZE, l=0, zfl = true, zw = false, iz=false, top=false, cl=false, cr=false, wl=WIN_LIP, wt=WIN_THICK, align=V_CENTER, orient=ORIENT_Z) {
|
|
psoff = ps/2 - wl - wt;
|
|
coff = ps + psoff;
|
|
sz = 3*ps/2 + psoff;
|
|
orient_and_align([sz,sz,sz], orient=orient, align=align) {
|
|
intersection() {
|
|
// Cap
|
|
fwd(ps)right(psoff)down(psoff)right(ps/2)box_edge(l=PROFILE_SIZE, orient=ORIENT_Y, align=V_BACK+V_LEFT, flx=zfl, wx=zw);
|
|
right(ps)fwd(psoff)down(psoff)fwd(ps/2)box_edge(l=PROFILE_SIZE, orient=ORIENT_X, align=V_BACK+V_LEFT, flx=zfl, wx=zw);
|
|
down(ps/2+WIN_TRIM)fwd(psoff)right(psoff)box_edge(l=PROFILE_SIZE, orient=ORIENT_Z_90, align=V_TOP, flx=false, wx=true);
|
|
}
|
|
fwd(1)right(psoff)down(psoff)right(ps/2)box_edge(l=ps+1, hc=cr ? true : false, orient=ORIENT_Y, jup=true, align=V_BACK+V_LEFT, flx=zfl, wx=zw, ix=false, iy=false);
|
|
right(1)fwd(psoff)down(psoff)fwd(ps/2)box_edge(l=ps+1, hc=cl ? true : false, orient=ORIENT_X, jdown=true, align=V_BACK+V_LEFT, flx=zfl, wx=zw, ix=false, iy=false);
|
|
down(1)fwd(psoff)right(psoff)box_edge(l=ps+1, orient=top ? ORIENT_ZNEG : ORIENT_Z_90, align=V_TOP, jup=true, jdown=true, flx=false, wx=true, ix=false, iy=false);
|
|
}
|
|
}
|
|
|
|
module beam_joiner(jw=JOINER_W, jh=JOINER_H, fl=false, slop=JOINER_SLOP) {
|
|
difference() {
|
|
union() {
|
|
boxjoiner(slop=slop, jh=jh, jw=jw,l=5,align=V_FRONT, orient=ORIENT_X);
|
|
zrot(180)boxjoiner(slop=slop, jh=jh, jw=jw,l=5,align=V_FRONT, orient=ORIENT_X);
|
|
}
|
|
if (fl)
|
|
left(jh/2)down(3)yrot(45)cuboid([jw,2*jh,4]);
|
|
}
|
|
|
|
}
|
|
|
|
module box_all_corners(ex=0) {
|
|
// top
|
|
up(ex) fwd(ex) left(ex) box_corner(cl=true, zfl=false, zw=true, align=V_UP+V_FRONT+V_LEFT, orient=ORIENT_ZNEG);
|
|
up(ex) back(ex) left(ex) box_corner(zfl=false, zw=true, align=V_UP+V_BACK+V_LEFT, orient=ORIENT_ZNEG_90);
|
|
up(ex) back(ex) right(ex) box_corner(zfl=false, zw=true, align=V_UP+V_BACK+V_RIGHT, orient=ORIENT_ZNEG_180);
|
|
up(ex) fwd(ex) right(ex) box_corner(cr=true, zfl=false, zw=true, align=V_UP+V_FRONT+V_RIGHT, orient=ORIENT_ZNEG_270);
|
|
// bottom
|
|
down(ex) fwd(ex) right(ex) box_corner(align=V_DOWN+V_FRONT+V_RIGHT, orient=ORIENT_Z);
|
|
down(ex) back(ex) right(ex) box_corner(align=V_DOWN+V_BACK+V_RIGHT, orient=ORIENT_Z_90);
|
|
down(ex) back(ex) left(ex) box_corner(align=V_DOWN+V_BACK+V_LEFT, orient=ORIENT_Z_180);
|
|
down(ex) fwd(ex) left(ex) box_corner(align=V_DOWN+V_FRONT+V_LEFT, orient=ORIENT_Z_270);
|
|
}
|
|
|
|
module boxjoiner(slop=JOINER_SLOP, align=V_FRONT, jh=JOINER_H, jw=JOINER_W, l=4, orient=ORIENT_Z) {
|
|
orient_and_align([jw,0,jh], orig_align=V_FRONT, align=align, orient=orient)
|
|
joiner(slop=slop, h=jh, w=jw, l=l, screwsize=$preview ? undef : undef);
|
|
}
|
|
|
|
module boxjoiner_clear(inset=0, slop=JOINER_SLOP, jh=JOINER_H, jw=JOINER_W, align=V_FRONT, orient=ORIENT_Z, cl=undef) {
|
|
color(cl)
|
|
orient_and_align([jw,inset,jh],orient=orient, align=align) fwd() {
|
|
cuboid([jw,inset,jh], align=V_BACK);
|
|
joiner_clear(h=jh, w=jw);
|
|
}
|
|
}
|
|
|
|
module new_joiner(spacing=0, slop=JOINER_SLOP, align=V_FRONT, jh=JOINER_H, jw=JOINER_W, l=4, orient=ORIENT_Z, cl=undef) {
|
|
spread = jw + spacing;
|
|
color(cl)
|
|
orient_and_align([2*jw+spacing,0,jh], orig_align=V_FRONT, align=align, orient=orient) {
|
|
left(spread/2) half_joiner(slop=slop, h=jh, w=jw, l=l, screwsize=$preview ? undef : 2);
|
|
right(spread/2) half_joiner2(h=jh, w=jw, l=l, screwsize=$preview ? undef : 2);
|
|
}
|
|
}
|
|
module new_joiner2(spacing=0, slop=JOINER_SLOP, align=V_FRONT, jh=JOINER_H, jw=JOINER_W, l=4, orient=ORIENT_Z, cl=undef) {
|
|
spread = jw + spacing;
|
|
color(cl)
|
|
orient_and_align([2*jw+spacing,0,jh], orig_align=V_FRONT, align=align, orient=orient) {
|
|
left(spread/2) half_joiner2(slop=slop, h=jh, w=jw, l=l, screwsize=$preview ? undef : undef);
|
|
//right(spread/2) half_joiner2(h=jh, w=jw, l=l, screwsize=$preview ? undef : undef);
|
|
}
|
|
}
|
|
module new_joiner_clear(spacing=0, slop=JOINER_SLOP, align=V_FRONT, jh=JOINER_H, jw=JOINER_W, l=4, orient=ORIENT_Z, cl=undef) {
|
|
spread= jw+spacing;
|
|
color(cl)
|
|
orient_and_align([2*jw+spacing,0,jh], orig_align=V_FRONT, align=align, orient=orient) {
|
|
left(spread/2) half_joiner_clear(h=jh, w=jw);
|
|
right(spread/2) half_joiner_clear(h=jh, w=jw);
|
|
cyl(d=2, h=50, orient=ORIENT_X);
|
|
}
|
|
}
|
|
|
|
wt=WIN_TRIM;
|
|
wl=WIN_LIP;
|
|
ps = PROFILE_SIZE;
|
|
psoff = ps/2 - wl - wt;
|
|
coff = ps + psoff;
|
|
eoff=2 + coff;
|
|
sz = 3*ps/2;
|
|
lx = BOX_X - 2* sz - 2*psoff;
|
|
ly = BOX_Y - sz;
|
|
lz = BOX_Z - sz;
|
|
ioff = 4*lx/50;
|
|
// edge ears
|
|
ear_sy = 2*(coff/2-2*psoff);
|
|
ear_sx = lx/5;
|
|
|
|
echo(str("Edge Len X: ", lx, " (3 x ", lx/3, ")"));
|
|
echo(str("Edge Len Y: ", ly, " (1 x ", ly, ")"));
|
|
echo(str("Edge Len Z: ", lz, " (1 x ", lz, ")"));
|
|
|
|
echo(str("Window Size: ", lx + 2* (ps-WIN_THICK-1), "mm x ", ly + 2*(ps-WIN_THICK-1), "mm"));
|
|
|
|
if (PART == "profile") {
|
|
profile(flx=true);
|
|
}
|
|
if (PART == "all_corners")
|
|
box_all_corners(ex=30);
|
|
if (PART == "corner_top_rear") box_corner(zw=true, zfl=false, top=true);
|
|
if (PART == "corner_top_front_l") box_corner(cl=true, zw=true, zfl=false, top=true);
|
|
if (PART == "corner_top_front_r") box_corner(cr=true, zw=true, zfl=false, top=true);
|
|
if (PART == "corner_bottom") box_corner(zw=false, zfl=true);
|
|
if (PART == "edge_front_bottom") {
|
|
if (Print_Ears) {
|
|
left(coff/2-2*psoff) back(lx/3/2)zrot(315)ear(thick=.2, dis=-2);
|
|
right(coff/2-2*psoff) back(lx/3/2)zrot(225)ear(thick=.2, dis=-2);
|
|
left(coff/2-2*psoff) fwd(lx/3/2)zrot(45)ear(thick=.2, dis=-2);
|
|
right(coff/2-2*psoff) fwd(lx/3/2)zrot(135)ear(thick=.2, dis=-2);
|
|
}
|
|
difference() {
|
|
up((wt+wl)/sqrt(2))xrot(90) zrot(45)
|
|
box_edge(l=lx/3, jup=true, jdown=true, flx=true, wx=false, my=true, iy=false, tubepass=false, orient=ORIENT_Z);
|
|
yspread(n=5, l=22) up(2+.6) {
|
|
cuboid([20+1.2,5.2,2], chamfer=.6, edges=EDGES_Y_BOT , align=V_BOTTOM);
|
|
up(.6+.8)right(20)cuboid([50,5.2,2], chamfer=.6, edges=EDGES_Y_BOT, align=V_BOTTOM);
|
|
}
|
|
linear_extrude(height=.6) scale(.1) import("magnet.svg", center=true);
|
|
}
|
|
color("orange")linear_extrude(height=.6) scale(.1) import("magnet.svg", center=true);
|
|
}
|
|
if (PART == "edge_back_bottom_a") {
|
|
if (Print_Ears) {
|
|
xspread(n=2, l=ear_sx) yspread(n=2, l=ear_sy) ear(thick=.2, dis=-2);
|
|
}
|
|
up((wt+wl)/sqrt(2))
|
|
xrot(45) {
|
|
box_edge(l=lx/5, jup=true, jdown=true, ioff=ioff, flx=true, wx=false, tubepass=true, tn=1, orient=ORIENT_X);
|
|
}
|
|
}
|
|
if (PART == "edge_back_bottom_b") {
|
|
if (Print_Ears) {
|
|
xspread(n=2, l=ear_sx) yspread(n=2, l=ear_sy) ear(thick=.2, dis=-2);
|
|
}
|
|
up((wt+wl)/sqrt(2)) xrot(45) box_edge(l=lx/5, jup=true, jdown=true, ix=false, iy=false, flx=true, wx=false, tubepass=true, tn=1, orient=ORIENT_X);
|
|
}
|
|
if (PART == "edge_back_bottom_c") {
|
|
if (Print_Ears) {
|
|
xspread(n=2, l=ear_sx) yspread(n=2, l=ear_sy) ear(thick=.2, dis=-2);
|
|
}
|
|
up((wt+wl)/sqrt(2)) xrot(45) box_edge(l=lx/5, jup=true, jdown=true, ix=true, iy=true, flx=true, wx=false, tubepass=true, tn=1, orient=ORIENT_X);
|
|
}
|
|
if (PART == "edge_back_bottom_d") {
|
|
if (Print_Ears) {
|
|
xspread(n=2, l=ear_sx) yspread(n=2, l=ear_sy) ear(thick=.2, dis=-2);
|
|
}
|
|
up((wt+wl)/sqrt(2)) xrot(45) box_edge(l=lx/5, jup=true, jdown=true, ix=true, iy=true, ioff=-ioff, flx=true, wx=false, tubepass=true, tn=1, orient=ORIENT_X);
|
|
}
|
|
if (PART == "edge_side_foot_left") {
|
|
box_edge(l=ly, rbfoot=true, rbleft=true, flx=true, wx=false, jup=true, jdown=true, gm=true, orient=ORIENT_Y);
|
|
}
|
|
if (PART == "edge_side_foot_right") {
|
|
box_edge(l=ly, rbfoot=true, flx=true, wx=false, jup=true, jdown=true, gm=true, orient=ORIENT_Y);
|
|
}
|
|
if (PART == "edge_side_top") {
|
|
if (Print_Ears) {
|
|
left(coff/2-2*psoff) back(ly/2)zrot(315)ear(thick=.2, dis=-2);
|
|
right(coff/2-2*psoff) back(ly/2)zrot(225)ear(thick=.2, dis=-2);
|
|
left(coff/2-2*psoff) fwd(ly/2)zrot(45)ear(thick=.2, dis=-2);
|
|
right(coff/2-2*psoff) fwd(ly/2)zrot(135)ear(thick=.2, dis=-2);
|
|
}
|
|
up((wt+wl)/sqrt(2))yrot(45)box_edge(l=ly, rbfoot=false, flx=false, wx=true, jup=true, jdown=true, cm=false, orient=ORIENT_Y);
|
|
}
|
|
if (PART == "edge_side_front") {
|
|
if (Print_Ears) {
|
|
left(coff/2-2*psoff) back(ly/2)zrot(315)ear(thick=.2, dis=-2);
|
|
right(coff/2-2*psoff) back(ly/2)zrot(225)ear(thick=.2, dis=-2);
|
|
left(coff/2-2*psoff) fwd(ly/2)zrot(45)ear(thick=.2, dis=-2);
|
|
right(coff/2-2*psoff) fwd(ly/2)zrot(135)ear(thick=.2, dis=-2);
|
|
}
|
|
up((wt+wl)/sqrt(2))yrot(45)box_edge(l=ly, rbfoot=false, flx=false, wx=true, iy=false, my=true, jup=true, jdown=true, cm=false, orient=ORIENT_Y);
|
|
}
|
|
if (PART == "edge_top_front") {
|
|
//r = $t *90 - 45;
|
|
r=-45;
|
|
if (Print_Ears) {
|
|
left(coff/2-2*psoff) back(lx/3/2)zrot(315)ear(thick=.2, dis=-2);
|
|
right(coff/2-2*psoff) back(lx/3/2)zrot(225)ear(thick=.2, dis=-2);
|
|
left(coff/2-2*psoff) fwd(lx/3/2)zrot(45)ear(thick=.2, dis=-2);
|
|
right(coff/2-2*psoff) fwd(lx/3/2)zrot(135)ear(thick=.2, dis=-2);
|
|
}
|
|
up((wt+wl)/sqrt(2)) yrot(45+90)zrot(90)box_edge(l=lx/3, rbfoot=false, hm=true, hc=true, ht=r, hs=true, flx=false, iy=false, wx=true, jup=true, jdown=true, cm=false, orient=ORIENT_XNEG_180);
|
|
face_off = ((ps+psoff)/4);
|
|
//xrot(45)yrot(-90)right(face_off+7/2)zrot(180)hinge();
|
|
}
|
|
if (PART == "edge_top_back") {
|
|
if (Print_Ears) {
|
|
left(coff/2-2*psoff) back(lx/3/2)zrot(315)ear(thick=.2, dis=-2);
|
|
right(coff/2-2*psoff) back(lx/3/2)zrot(225)ear(thick=.2, dis=-2);
|
|
left(coff/2-2*psoff) fwd(lx/3/2)zrot(45)ear(thick=.2, dis=-2);
|
|
right(coff/2-2*psoff) fwd(lx/3/2)zrot(135)ear(thick=.2, dis=-2);
|
|
}
|
|
up((wt+wl)/sqrt(2)) yrot(45+90)zrot(90)box_edge(l=lx/3, rbfoot=false, hm=true, flx=false, iy=true, wx=true, jup=true, jdown=true, cm=false, orient=ORIENT_XNEG_180);
|
|
}
|
|
if (PART == "full_box") {
|
|
up(lz/2+ps) {
|
|
// Top Corners:
|
|
right(ps+lx/2) fwd(ps+ly/2) box_corner(orient=ORIENT_ZNEG_270, zfl=false, cr=true);
|
|
right(ps+lx/2) back(ps+ly/2) box_corner(orient=ORIENT_ZNEG_180);
|
|
|
|
left(ps+lx/2) back(ps+ly/2) box_corner(orient=ORIENT_ZNEG_90);
|
|
left(ps+lx/2) fwd(ps+ly/2) box_corner(orient=ORIENT_ZNEG, cl=true);
|
|
}
|
|
up(lz/2+eoff) { // Top Edges
|
|
fwd(eoff + ly/2) xspread(n=3, lx/3) box_edge(l=lx/3, hm=true, hc=true, hs=true, jup=true, jdown=true, iy=false, flx=true, wx=false, orient=ORIENT_XNEG_180);
|
|
back(eoff + ly/2) {
|
|
xspread(n=3, lx/3)box_edge(l=lx/3, jup=true, jdown=true, hm=true, hc=false, flx=true, wx=false, tubepass=false, orient=ORIENT_X_180);
|
|
}
|
|
right(eoff + lx/2) box_edge(l=ly, jup=true, jdown=true, flx=true, wx=false, orient=ORIENT_YNEG_180);
|
|
left(eoff + lx/2) zrot(180)box_edge(l=ly, jup=true, jdown=true, flx=true, wx=false, orient=ORIENT_YNEG_180);
|
|
}
|
|
{ // vertical
|
|
left(eoff+lx/2)fwd(eoff+ly/2)
|
|
box_edge(l=lz,jup=true, ix=false, jdown=true);
|
|
right(eoff+lx/2)fwd(eoff+ly/2)
|
|
box_edge(l=lz,jup=true, iy=false, jdown=true, orient=ORIENT_Z_90);
|
|
right(eoff+lx/2)back(eoff+ly/2)
|
|
box_edge(l=lz,jup=true, jdown=true, orient=ORIENT_Z_180);
|
|
left(eoff+lx/2)back(eoff+ly/2)
|
|
box_edge(l=lz,jup=true, jdown=true, orient=ORIENT_Z_270);
|
|
}
|
|
down(lz/2+eoff) {
|
|
fwd(eoff + ly/2) xspread(n=3, lx/3) box_edge(l=lx/3, iy=false, jup=true, jdown=true, flx=true, wx=false, orient=ORIENT_X);
|
|
back(eoff + ly/2) zrot(180) { // rear
|
|
box_edge(l=lx/5, jup=true, jdown=true, flx=true, wx=false, tubepass=true, tn=1, orient=ORIENT_X);
|
|
xspread(n=2, 2*lx/5)box_edge(l=lx/5, jup=true, jdown=true, flx=true, wx=false, tubepass=true, tn=1, ix=false, iy=false, orient=ORIENT_X);
|
|
left(4*lx/10)box_edge(l=lx/5, jup=true, jdown=true, flx=true, wx=false, tubepass=true, tn=1, ioff=ioff, orient=ORIENT_X);
|
|
right(4*lx/10)box_edge(l=lx/5, jup=true, jdown=true, flx=true, wx=false, tubepass=true, tn=1, ioff=-ioff, orient=ORIENT_X);
|
|
}
|
|
right(eoff + lx/2) box_edge(l=ly, jup=true, jdown=true, flx=true, wx=false, rbfoot=true, rbleft=false, orient=ORIENT_Y);
|
|
left(eoff + lx/2) zrot(180)box_edge(l=ly, jup=true, jdown=true, flx=true, wx=false, rbfoot=true, rbleft=true, orient=ORIENT_Y);
|
|
}
|
|
down(lz/2+ps) {
|
|
// Bottom Corners:
|
|
right(ps+lx/2) fwd(ps+ly/2)box_corner();
|
|
right(ps+lx/2) back(ps+ly/2)box_corner(orient=ORIENT_Z_90);
|
|
left(ps+lx/2) back(ps+ly/2)box_corner(orient=ORIENT_Z_180);
|
|
left(ps+lx/2) fwd(ps+ly/2)box_corner(orient=ORIENT_Z_270);
|
|
}
|
|
|
|
down(10)xspread(n=5, l=70*5) %cyl(d=200, l=70, orient=ORIENT_X);
|
|
}
|
|
if (PART == "joiner_top") beam_joiner(fl=false);
|
|
if (PART == "joiner_bottom") {
|
|
back(JOINER_W) right(JOINER_H/2) zrot(225)ear();
|
|
back(JOINER_W) left(JOINER_H/2 - 5) zrot(315)ear();
|
|
fwd(JOINER_W) right(JOINER_H/2) zrot(135)ear();
|
|
fwd(JOINER_W) left(JOINER_H/2-5) zrot(45)ear();
|
|
up(5) beam_joiner(fl=true);
|
|
}
|
|
|
|
if (PART == "joiner_slop") {
|
|
%beam_joiner(fl=false, slop=.2);
|
|
beam_joiner(fl=false, slop=.3);
|
|
}
|
|
if (PART == "rbfoot") rb_foot();
|
|
|
|
if (PART == "edge_test")
|
|
yrot(45)
|
|
//box_edge(l=35, tubepass=true, jup=true, jdown=true, tn=1, flx=true, wx = false, orient=ORIENT_Y);
|
|
box_edge(l=18, tubepass=false, jup=true, jdown=true, tn=1, flx=false, wx = true, ix = false , my=false, iy = false, orient=ORIENT_Y);
|
|
|
|
if (PART == "hinge") {
|
|
r = $t *90;
|
|
// r = 135; // max
|
|
yrot(90)hinge(theta=r);
|
|
}
|
|
|
|
if (PART == "rear_mount") {
|
|
up(7) yrot(-90) rearMount();
|
|
}
|
|
|
|
if (PART == "handle") {
|
|
handle();
|
|
}
|
|
|
|
if (PART == "new_joiner") {
|
|
new_joiner();
|
|
//#new_joiner_clear();
|
|
//boxjoiner();
|
|
}
|
|
|
|
if (PART == "grid_mount") {
|
|
difference() {
|
|
union() {
|
|
fwd(19.799/2-1)cuboid([48,3+19.799,4], fillet=1, align=V_TOP);
|
|
up(1)fwd(3.4+19.799)xrot(-45) cuboid([10+84,6,25], fillet=1, align=V_TOP+V_BACK);
|
|
}
|
|
|
|
cuboid([200,200,10], align=V_BOTTOM);
|
|
xspread(n=2, l=42) cyl(d=3.3, h=50);
|
|
xrot(45)back(5)up(17.2)xspread(n=2, l=84)m3s_clear(bl=10,bz=-9, sh=0, drop=false, $die=true);
|
|
|
|
}
|
|
}
|