Refactor Cleanup

Code Cleanup
This commit is contained in:
sjc
2026-05-13 23:23:45 -04:00
parent fcf77c5af0
commit 0a8137dac0

View File

@@ -47,8 +47,6 @@ module headpost(x=headpost_x, y=headpost_y, z=260, align=V_FRONT) {
} }
module screw_channel() { 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,180,0])m4s_clear(bl=100, drop=false); fwd(80)rotate([-90,180,0])m4s_clear(bl=100, drop=false);
} }
@@ -56,7 +54,7 @@ module head_rear() {
blockz=headcross_yz+2*10; blockz=headcross_yz+2*10;
difference() { difference() {
union() { union() {
left(19/2+4)back(footboard_y) cuboid([ left(LegOff/2+4)back(footboard_y) cuboid([
platfoot_x+16+LegOff, platfoot_x+16+LegOff,
headpost_y+footboard_y, headpost_y+footboard_y,
blockz], fillet=3, edges=EDGES_BACK+EDGES_Y_ALL, align=V_FRONT+V_TOP); blockz], fillet=3, edges=EDGES_BACK+EDGES_Y_ALL, align=V_FRONT+V_TOP);
@@ -79,26 +77,28 @@ module head_rear() {
module head_front() { module head_front() {
blockz=headcross_yz + 2*10; blockz=headcross_yz + 2*10;
difference() { difference() {
right(19/2-4)cuboid([ right(LegOff/2-4)cuboid([
platfoot_x+16+LegOff, platfoot_x+16+LegOff,
platfoot_y+footboard_y, platfoot_y+footboard_y,
blockz ], fillet=3, edges=EDGES_FRONT+EDGES_Y_ALL, align=V_FRONT+V_TOP); blockz ], fillet=3,
back(.01)platfoot(); edges=EDGES_FRONT+EDGES_Y_ALL, align=V_FRONT+V_TOP);
// Screw Holes back(.01) platfoot();
// Screw HolesXTFei 14 Inch Heavy Duty Platform Bed Frame
rx= platfoot_y + (16+LegOff)/2; rx= platfoot_y + (16+LegOff)/2;
bz = -40; bz = -40;
bl = 58 - bz; bl = 58 - bz;
up(blockz/2)zspread(n=3, l=blockz-10) up(blockz/2) {
right(rx) rotate([-90,0,0]) rotate([0,0,180]) m4s_clear(bl=bl, bz=bz, drop=true, sh=0); zspread(n=3, l=blockz-10) right(rx) rotate([-90,180,0]) 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); zspread(n=2, l=blockz-10) left(50-LegOff) rotate([-90,180,0]) 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); }
} }
} }
module corner_gasket(yd=cornergasket) { module corner_gasket(yd=cornergasket) {
blockz=headcross_yz+2*10; blockz=headcross_yz+2*10;
difference() { difference() {
left(19/2+4) cuboid([ left(LegOff/2+4) cuboid([
platfoot_x+16+LegOff, platfoot_x+16+LegOff,
5, 5,
blockz], fillet=2 blockz], fillet=2
@@ -112,7 +112,7 @@ module corner_gasket(yd=cornergasket) {
module foot_front() { module foot_front() {
blockz= footcrossyz + 2*10; // 95; blockz= footcrossyz + 2*10; // 95;
difference() { 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(LegOff/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(); back(.01)platfoot();
// Screw Holes // Screw Holes
rx= 5 + headpost_x/2; rx= 5 + headpost_x/2;
@@ -128,7 +128,7 @@ module foot_rear() {
z = footcrossyz + 2*10; z = footcrossyz + 2*10;
difference() { difference() {
union() { union() {
left(19/2+4)back(footboard_y) cuboid([platfoot_x+16+19,headpost_y+footboard_y, z], fillet=3, edges=EDGES_BACK+EDGES_Y_ALL, align=V_FRONT+V_TOP); left(LegOff/2+4)back(footboard_y) cuboid([platfoot_x+16+LegOff,headpost_y+footboard_y, z], fillet=3, edges=EDGES_BACK+EDGES_Y_ALL, align=V_FRONT+V_TOP);
fwd(10)up(z/2)right(40-4)rotate([90,0,-45])rotate_extrude(angle=360) left(18) circle(d=10); fwd(10)up(z/2)right(40-4)rotate([90,0,-45])rotate_extrude(angle=360) left(18) circle(d=10);
} }
footboard(); footboard();
@@ -225,17 +225,17 @@ if (part == "head_cross_front") {
if (mate) { %head_cross_front(); } if (mate) { %head_cross_front(); }
} }
} else if (part == "head_corner_front") { } else if (part == "head_corner_front") {
tx = (plate) ? 0 : -19; tx = (plate) ? 0 : -LegOff;
ty = (plate) ? 0 : -headpost_y-4; ty = (plate) ? 0 : -headpost_y-4;
translate([tx, ty, 0]) translate([tx, ty, 0])
head_front(); head_front();
if (mate) right(19)back(38)%head_rear(); if (mate) right(LegOff)back(38)%head_rear();
} else if (part == "head_corner_rear") { } else if (part == "head_corner_rear") {
rot = plate ? -90 : 0; rot = plate ? -90 : 0;
upoff = plate ? footboard_y : 0; upoff = plate ? footboard_y : 0;
up(upoff) xrot(rot) { up(upoff) xrot(rot) {
head_rear(); head_rear();
if (mate) fwd(38) left(19)%head_front(); if (mate) fwd(38) left(LegOff)%head_front();
} }
} else if (part == "foot_corner_front") { } else if (part == "foot_corner_front") {
rot = plate ? 0 : 0; rot = plate ? 0 : 0;
@@ -246,7 +246,7 @@ if (part == "head_cross_front") {
zt = plate ? footboard_y : 0; zt = plate ? footboard_y : 0;
up(zt) xrot(rot) { up(zt) xrot(rot) {
foot_rear(); foot_rear();
if (mate) { fwd(headpost_x) left(19) %foot_front(); } if (mate) { fwd(headpost_x) left(LegOff) %foot_front(); }
} }
} else if (part == "both") { } else if (part == "both") {
fwd(platfoot_y+LegGap+13) left(LegOff)head_front(); fwd(platfoot_y+LegGap+13) left(LegOff)head_front();
@@ -260,7 +260,7 @@ if (part == "head_cross_front") {
rot = plate ? 90 : 0; rot = plate ? 90 : 0;
xrot(rot) { xrot(rot) {
corner_gasket(); corner_gasket();
if (mate) { down(blockz/2)fwd(headpost_x) left(19) %head_front(); } if (mate) { down(blockz/2)fwd(headpost_x) left(LegOff) %head_front(); }
} }
} }
@@ -272,15 +272,4 @@ if (model == "corner_leg") {
%head_cross_bar(); %head_cross_bar();
%head_plat_mid(); %head_plat_mid();
} }
//left(19)fwd(headpost_y+4)
//head_front();
//head_rear();
//left(19)fwd(headpost_y+4)head_front();
//back(2) rotate([-90,0,0])
//back(20)head_rear();
//%platfoot();
//%cuboid([150, 25,25], align=V_BACK); // crossbar