From 24465a833219929d1b8333090a7553ea81badb74 Mon Sep 17 00:00:00 2001 From: Stephen J Carpenter Date: Wed, 13 May 2026 16:30:25 -0400 Subject: [PATCH] Updated Plate/Mate conditionals Fixed all Plate conditions to set part on top of Z=0 Fized mate conditions to keep alignment even when plate=true --- bracket.scad | 102 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 63 insertions(+), 39 deletions(-) diff --git a/bracket.scad b/bracket.scad index fbe020c..3e30e0b 100644 --- a/bracket.scad +++ b/bracket.scad @@ -18,7 +18,7 @@ LegOff = 19; LegGap=4; /* [Render Options] */ -part=""; // [both, back, head_corner_rear, head_corner_front, foot_corner_front, foot_corner_rear, head_cross_front, foot_cross_front, foot_cross_rear ] +part=""; // [ none, head_corner_rear, head_corner_front, foot_corner_front, foot_corner_rear, head_cross_front, head_cross_rear, foot_cross_front, foot_cross_rear ] model = "none"; // ["none", "corner_leg", "center_leg"] plate = false; mate = false; @@ -45,39 +45,49 @@ module headpost(x=headpost_x, y=headpost_y, z=260, align=V_FRONT) { module screw_channel() { //back(19.2)cyl(d=6, h=10, orient=ORIENT_Y,align=V_FRONT); //back(9)cyl(d=3.5, h=100, orient=ORIENT_Y, align=V_FRONT); - fwd(80)rotate([-90,0,0])m4s_clear(bl=100); + fwd(80)rotate([-90,180,0])m4s_clear(bl=100, drop=false); } module head_rear() { + blockz=headcross_yz+2*10; difference() { - left(19/2+4)back(footboard_y) cuboid([platfoot_x+16+19,headpost_y+footboard_y,95], fillet=3, edges=EDGES_BACK+EDGES_Y_ALL, align=V_FRONT+V_TOP); - footboard(); + union() { + left(19/2+4)back(footboard_y) cuboid([ + platfoot_x+16+LegOff, + headpost_y+footboard_y, + blockz], fillet=3, edges=EDGES_BACK+EDGES_Y_ALL, align=V_FRONT+V_TOP); + fwd(10)up(blockz/2)right(40-4)rotate([90,0,-45])rotate_extrude(angle=360) left(18) circle(d=10); + + } + //%footboard(); headpost(y=2*headpost_y); - left(44)up(95/2)cuboid([50, 150,25]); // crossbar + left(44)up(blockz/2)cuboid([50, 150,25]); // crossbar // Screw Holes rx = 5 + headpost_x/2; - right(rx)up(95-10) screw_channel(); - right(rx)up(95/2) screw_channel(); - right(rx)up(10) screw_channel(); - left(50)up(95-10) screw_channel(); - left(50)up(10) screw_channel(); + right(rx)up(blockz-5) screw_channel(); + right(rx)up(blockz/2) screw_channel(); + right(rx)up(5) screw_channel(); + left(50)up(blockz-5) screw_channel(); + left(50)up(5) screw_channel(); } - fwd(10)up(95/2)right(40-4)rotate([90,0,-45])rotate_extrude(angle=360) left(18) circle(d=10); } module head_front() { - blockz=95; + blockz=headcross_yz + 2*10; difference() { - right(19/2-4)cuboid([platfoot_x+16+LegOff,platfoot_y+footboard_y,blockz], fillet=3, edges=EDGES_FRONT+EDGES_Y_ALL, align=V_FRONT+V_TOP); + right(19/2-4)cuboid([ + platfoot_x+16+LegOff, + platfoot_y+footboard_y, + blockz ], fillet=3, edges=EDGES_FRONT+EDGES_Y_ALL, align=V_FRONT+V_TOP); back(.01)platfoot(); // Screw Holes - rx= 5 + headpost_x/2; + rx= platfoot_y + (16+LegOff)/2; bz = -40; bl = 58 - bz; - up(blockz/2)zspread(n=3, l=blockz-20) - right(rx+LegOff) rotate([-90,0,0]) rotate([0,0,180]) m4s_clear(bl=bl, bz=bz, drop=true, sh=0); - left(30)up(blockz-10) rotate([-90,0,0]) rotate([0,0,180]) m4s_clear(bl=bl, bz=bz, drop=true, sh=0); - left(30)up(10) rotate([-90,0,0]) rotate([0,0,180]) m4s_clear(bl=bl, bz=bz, drop=true, sh=0); + up(blockz/2)zspread(n=3, l=blockz-10) + right(rx) rotate([-90,0,0]) rotate([0,0,180]) m4s_clear(bl=bl, bz=bz, drop=true, sh=0); + left(31)up(blockz-5) rotate([-90,0,0]) rotate([0,0,180]) m4s_clear(bl=bl, bz=bz, drop=true, sh=0); + left(31)up(5) rotate([-90,0,0]) rotate([0,0,180]) m4s_clear(bl=bl, bz=bz, drop=true, sh=0); } } @@ -120,7 +130,7 @@ module head_cross_rear() { difference() { cuboid([platmid_x+20, 25+10, 42], fillet=3,align=V_BACK); back(50/2)cuboid([platmid_x, 50 , 70], align=V_FRONT); - xspread(n=2, l=platmid_x+10) zspread(n=2, l=33) rotate([90,0,0]) m4s_clear(bl=66, bz=-34, drop=false, sh=0); + xspread(n=2, l=platmid_x+10) zspread(n=2, l=33) rotate([90,0,0]) m4s_clear(bl=66, bz=-34, drop=true, sh=0); } } @@ -160,42 +170,56 @@ module head_plat_mid(l=100, align=V_BACK) { if (part == "head_cross_front") { rot = (plate) ? 90 : 0; - rotate([rot,0,0]) - head_cross_front(); - if (mate) { %head_cross_rear(); } + zt = plate ? headcross_yz + 10 : 0; + up(zt) rotate([rot,0,0]) { + head_cross_front(); + if (mate) { %head_cross_rear(); } + } } else if (part == "foot_cross_front") { rot = (plate) ? 90 : 0; - rotate([rot,0,0]) - foot_cross_front(); - if (mate) { %foot_cross_rear(); } + zt = plate ? footcrossyz +10 : 0; + up(zt) rotate([rot,0,0]) { + foot_cross_front(); + if (mate) { %foot_cross_rear(); } + } } else if (part == "foot_cross_rear") { - rot = (plate) ? 90 : 0; - rotate([rot,0,0]) - foot_cross_rear(); - if (mate) { %foot_cross_front(); } -} else if (part == "head_cross_rear") { rot = (plate) ? -90 : 0; - rotate([rot,0,0]) - head_cross_rear(); - if (mate) { %head_cross_front(); } + zt = plate ? platfoot_y+10 : 0; + up(zt) rotate([rot,0,0]) { + foot_cross_rear(); + if (mate) { %foot_cross_front(); } + } +} else if (part == "head_cross_rear") { + rot = (plate) ? 0 : 0; + zt = plate ? headcross_yz/2 + 10 : 0; + up(zt) rotate([rot,0,0]) { + head_cross_rear(); + if (mate) { %head_cross_front(); } + } } else if (part == "head_corner_front") { tx = (plate) ? 0 : -19; ty = (plate) ? 0 : -headpost_y-4; translate([tx, ty, 0]) head_front(); + if (mate) right(19)back(38)%head_rear(); } else if (part == "head_corner_rear") { rot = plate ? -90 : 0; - xrot(rot) - head_rear(); + upoff = plate ? footboard_y : 0; + up(upoff) xrot(rot) { + head_rear(); + if (mate) fwd(38) left(19)%head_front(); + } } else if (part == "foot_corner_front") { - rot = plate ? -90 : 0; + rot = plate ? 0 : 0; xrot(rot) foot_front(); } else if (part == "foot_corner_rear") { rot = plate ? -90 : 0; - xrot(rot) - foot_rear(); - if (mate) { fwd(headpost_x) left(19) %foot_front(); } + zt = plate ? footboard_y : 0; + up(zt) xrot(rot) { + foot_rear(); + if (mate) { fwd(headpost_x) left(19) %foot_front(); } + } } else if (part == "both") { fwd(platfoot_y+LegGap+13) left(LegOff)head_front(); head_rear();