$fn = 64; // --- Parameters --- rail_length = 600; // Total length of the rail in mm rail_diameter = 16; // Diameter of the hanging rail wall_clearance = 35; // Distance from wall to center of rail bracket_count = 5; // Number of wall mounting brackets bracket_width = 15; // Width of each bracket bracket_height = 50; // Height of the wall plate wall_plate_thickness = 6; // Thickness of the wall plate screw_hole_diameter = 4.5; // Diameter for mounting screws screw_head_diameter = 9; // Diameter for screw head countersink // Derived parameter for arm height to ensure manifold geometry inside the cylinder arm_height = rail_diameter * 0.6; module wall_rail() { union() { // Main cylindrical rail translate([0, wall_clearance, 0]) rotate([0, 90, 0]) cylinder(h=rail_length, d=rail_diameter); // Wall mounting brackets step = (rail_length - bracket_width) / (bracket_count - 1); for (i = [0 : bracket_count - 1]) { translate([i * step + bracket_width/2, 0, 0]) bracket(); } } } module bracket() { difference() { union() { // Wall mounting plate translate([-bracket_width/2, 0, -bracket_height/2]) cube([bracket_width, wall_plate_thickness, bracket_height]); // Tapered extension arm connecting plate to rail hull() { // Base at wall plate translate([-bracket_width/2, wall_plate_thickness - 0.1, -9]) cube([bracket_width, 0.1, 18]); // End at rail (penetrates slightly past center for manifold union) translate([-bracket_width/2, wall_clearance, -arm_height/2]) cube([bracket_width, 2, arm_height]); } } // Top screw hole translate([0, 0, 16]) screw_hole(); // Bottom screw hole translate([0, 0, -16]) screw_hole(); } } module screw_hole() { // Screw shaft hole translate([0, -1, 0]) rotate([-90, 0, 0]) cylinder(h=wall_plate_thickness + 2, d=screw_hole_diameter); // Screw head countersink translate([0, wall_plate_thickness - 2.5, 0]) rotate([-90, 0, 0]) cylinder(h=2.51, d1=screw_hole_diameter, d2=screw_head_diameter); } // Generate the object wall_rail();