diff vs bare: +30/-73
// L-bracket with countersunk holes
$fn = 64;
// Parameters
width = 50; // X direction
- depth = 40; // Y direction (horizontal flange)
- height = 40; // Z direction (vertical flange)
+ depth = 40; // Y direction (horizontal flange depth)
+ height = 40; // Z direction (vertical flange height)
thickness = 3; // plate thickness
hole_dia = 4.5;
csk_dia = 8;
csk_depth = 2;
edge_offset = 10;
- // Hole positions along the length axis of each flange (from inner corner)
- // Each flange: 2 holes, edge_offset from each end of the 40mm dimension
- hole_pos1 = edge_offset;
- hole_pos2 = depth - edge_offset; // = 30 (also works for height since both 40)
+ // Holes are placed on the centerline of each face (x = width/2),
+ // 10mm from each edge along the length of the flange.
+ x_center = width / 2;
+ pos_a = edge_offset; // 10mm from inner-corner-side edge
+ pos_b = depth - edge_offset; // 10mm from far edge (=30mm)
- // X positions: symmetric on width, also edge_offset from sides
- x1 = edge_offset;
- x2 = width - edge_offset;
-
- module countersunk_hole_z() {
- // Hole through Z, countersink on top (+Z)
- union() {
- // through hole
- translate([0, 0, -1])
- cylinder(d = hole_dia, h = thickness + 2);
- // countersink from top surface
- translate([0, 0, thickness - csk_depth])
- cylinder(d = csk_dia, h = csk_depth + 1);
- }
- }
-
- module countersunk_hole_y() {
- // Hole through Y, countersink on -Y side (outer side of vertical flange)
- union() {
- translate([0, -1, 0])
- rotate([-90, 0, 0])
- cylinder(d = hole_dia, h = thickness + 2);
- // countersink on outer face (y = -thickness ... actually outer is y=0? )
- // Vertical flange occupies y in [-thickness, 0], outer is y = -thickness
- translate([0, -thickness, 0])
- rotate([-90, 0, 0])
- cylinder(d = csk_dia, h = csk_depth + 1, center = false);
- // Wait: rotate([-90,0,0]) makes cylinder go in +Y direction from origin
- // We want countersink starting at y=-thickness going in -Y direction (outward)
- // Better approach below
- }
- }
-
- // Cleaner version - rebuild
module l_bracket() {
difference() {
union() {
- // Horizontal flange: x in [0,width], y in [0,depth], z in [0,thickness]
- // Inner corner at origin, but inner corner means the inside of the L.
- // Horizontal flange extends in +Y, with top surface at z=0 (inner)
- // So horizontal flange: z in [-thickness, 0]
+ // Horizontal flange: inner (top) surface at z=0, extends in +Y
translate([0, 0, -thickness])
cube([width, depth, thickness]);
- // Vertical flange extends in +Z, inner face at y=0
- // So vertical flange: y in [-thickness, 0], z in [0, height]
- // But we need them to join at the corner properly
+ // Vertical flange: inner face at y=0, extends in +Z
+ // Includes the corner block (z from -thickness to 0) for clean joint
translate([0, -thickness, -thickness])
cube([width, thickness, height + thickness]);
}
- // Holes in horizontal flange (through Z)
- // Outer surface is at z = -thickness (bottom), countersink there
- for (x = [x1, x2]) {
- for (y = [hole_pos1, hole_pos2]) {
- translate([x, y, 0]) {
- // through hole
- translate([0, 0, -thickness - 1])
- cylinder(d = hole_dia, h = thickness + 2);
- // countersink from bottom (outer)
- translate([0, 0, -thickness - 0.01])
- cylinder(d = csk_dia, h = csk_depth + 0.01);
- }
+ // Holes in horizontal flange (through Z), countersink on bottom (outer, -Z)
+ for (y = [pos_a, pos_b]) {
+ translate([x_center, y, 0]) {
+ // through hole
+ translate([0, 0, -thickness - 1])
+ cylinder(d = hole_dia, h = thickness + 2);
+ // countersink on outer (bottom) face
+ translate([0, 0, -thickness - 0.01])
+ cylinder(d = csk_dia, h = csk_depth + 0.01);
}
}
- // Holes in vertical flange (through Y)
- // Outer surface is at y = -thickness, countersink there
- for (x = [x1, x2]) {
- for (z = [hole_pos1, hole_pos2]) {
- translate([x, 0, z]) {
- // through hole along -Y
- translate([0, 1, 0])
- rotate([90, 0, 0])
- cylinder(d = hole_dia, h = thickness + 2);
- // countersink on outer face (y = -thickness)
- translate([0, -thickness + csk_depth + 0.01, 0])
- rotate([90, 0, 0])
- cylinder(d = csk_dia, h = csk_depth + 0.01);
- }
+ // Holes in vertical flange (through Y), countersink on outer (-Y) face
+ for (z = [pos_a, pos_b]) {
+ translate([x_center, 0, z]) {
+ // through hole along Y
+ translate([0, 1, 0])
+ rotate([90, 0, 0])
+ cylinder(d = hole_dia, h = thickness + 2);
+ // countersink on outer (-Y) face
+ translate([0, -thickness + csk_depth + 0.01, 0])
+ rotate([90, 0, 0])
+ cylinder(d = csk_dia, h = csk_depth + 0.01);
}
}
}
}
l_bracket();
SCAD (63 lines)
// L-bracket with countersunk holes
$fn = 64;
// Parameters
width = 50; // X direction
depth = 40; // Y direction (horizontal flange depth)
height = 40; // Z direction (vertical flange height)
thickness = 3; // plate thickness
hole_dia = 4.5;
csk_dia = 8;
csk_depth = 2;
edge_offset = 10;
// Holes are placed on the centerline of each face (x = width/2),
// 10mm from each edge along the length of the flange.
x_center = width / 2;
pos_a = edge_offset; // 10mm from inner-corner-side edge
pos_b = depth - edge_offset; // 10mm from far edge (=30mm)
module l_bracket() {
difference() {
union() {
// Horizontal flange: inner (top) surface at z=0, extends in +Y
translate([0, 0, -thickness])
cube([width, depth, thickness]);
// Vertical flange: inner face at y=0, extends in +Z
// Includes the corner block (z from -thickness to 0) for clean joint
translate([0, -thickness, -thickness])
cube([width, thickness, height + thickness]);
}
// Holes in horizontal flange (through Z), countersink on bottom (outer, -Z)
for (y = [pos_a, pos_b]) {
translate([x_center, y, 0]) {
// through hole
translate([0, 0, -thickness - 1])
cylinder(d = hole_dia, h = thickness + 2);
// countersink on outer (bottom) face
translate([0, 0, -thickness - 0.01])
cylinder(d = csk_dia, h = csk_depth + 0.01);
}
}
// Holes in vertical flange (through Y), countersink on outer (-Y) face
for (z = [pos_a, pos_b]) {
translate([x_center, 0, z]) {
// through hole along Y
translate([0, 1, 0])
rotate([90, 0, 0])
cylinder(d = hole_dia, h = thickness + 2);
// countersink on outer (-Y) face
translate([0, -thickness + csk_depth + 0.01, 0])
rotate([90, 0, 0])
cylinder(d = csk_dia, h = csk_depth + 0.01);
}
}
}
}
l_bracket();