3d-prints/hanging_bracket/hanging_bracket.scad

74 lines
2 KiB
OpenSCAD

height = 95;
width = 16;
pillar_thickness = 5;
prong_thickness = 4;
prong_width = width;
prong_depth = 120;
prong_angle = 25;
screw_hole_diameter = 5.5;
screw_hole_count = 2;
lh_rh = false;
fuzz = 0.01;
function triheight() = tan(prong_angle) * width;
function thickness() = prong_thickness / cos(prong_angle);
module prong() {
translate([-prong_width/2,0,0]) cube([prong_width*2, prong_depth, thickness()]);
};
module screw_hole(pos) {
hole_pos = (prong_depth - pillar_thickness) * pos;
hole_pos_mod = lh_rh ? pillar_thickness : 0;
translate([-fuzz + prong_width/2, -fuzz + hole_pos_mod + hole_pos, -fuzz])
union() {
cylinder(h = thickness() * 2, d = screw_hole_diameter, $fn=32);
translate([0,0,thickness()*0.255]) cylinder(h = thickness() * 0.75, d1 = 0, d2 = screw_hole_diameter*2, $fn=32);
}
};
module prong_with_holes() {
difference() {
prong();
for (i = [1: screw_hole_count])
{
screw_hole(i/(screw_hole_count+1));
};
};
};
module pillar() {
translate([0,0,0])
union() {
rotate([-90,0,0]) linear_extrude(pillar_thickness) polygon([[0, 0], [width, 0], [width, triheight()]]);
cube([width, pillar_thickness, height+(fuzz*2)-triheight()]);
translate([0,0, height]) rotate([-90,0,0]) linear_extrude(pillar_thickness) polygon([[0, 0], [width, triheight()], [0, triheight()]]);
};
};
module assembly() {
difference() {
union() {
translate([0,0,-prong_thickness]) rotate([0, prong_angle, 0]) prong_with_holes();
if (lh_rh) {
pillar();
} else {
translate([0,prong_depth-pillar_thickness,0]) pillar();
}
translate([0,0,height+(prong_thickness*0.0)+(triheight()*0.0)]) rotate([0, prong_angle, 0]) prong();
};
translate([width,-prong_depth,-height]) cube([width*3, prong_depth*3, height*3]);
translate([width*-3,-prong_depth,-height]) cube([width*3, prong_depth*3, height*3]);
};
};
rotate([0,-90,0]) assembly();