$fn = 64; // --- Parameters --- rail_length = 800; // Total length of the rail rail_width = 30; // Total width of the rail rail_height = 15; // Total height/thickness of the rail slot_top_width = 8.5; // Width of the top opening (fits M8 bolt shaft or M4 screw head) slot_top_depth = 6; // Depth of the top opening slot_base_width = 18; // Width of the inside slot (fits standard M8 bolt head/nut) slot_base_depth = 5; // Depth of the inside slot hole_spacing = 100; // Distance between mounting holes hole_diameter = 4.5; // Mounting hole size (M4 clearance) module t_slot_rail() { difference() { // Main solid body cube([rail_length, rail_width, rail_height]); // Top narrow slot translate([-1, (rail_width - slot_top_width) / 2, rail_height - slot_top_depth + 0.1]) cube([rail_length + 2, slot_top_width, slot_top_depth]); // Bottom wide slot (T-section) translate([-1, (rail_width - slot_base_width) / 2, rail_height - slot_top_depth - slot_base_depth + 0.1]) cube([rail_length + 2, slot_base_width, slot_base_depth]); // Wall mounting holes (centered in the slot) for (x = [hole_spacing/2 : hole_spacing : rail_length]) { translate([x, rail_width / 2, -1]) cylinder(h = rail_height + 2, d = hole_diameter); } } } // Center the model for easier viewing in the slicer translate([-rail_length/2, -rail_width/2, 0]) t_slot_rail();