$fn = 64; // --- Parameters --- rail_length = 300; rail_height = 10; base_width = 20; top_width = 32; hole_spacing = 50; hole_diameter = 4.5; countersink_diameter = 9.5; countersink_depth = 3.5; // --- Main Model --- difference() { // Dovetail rail body translate([0, rail_length / 2, 0]) rotate([90, 0, 0]) linear_extrude(height = rail_length) polygon(points = [ [-base_width / 2, 0], [base_width / 2, 0], [top_width / 2, rail_height], [-top_width / 2, rail_height] ]); // Mounting holes num_holes = floor(rail_length / hole_spacing); start_y = -((num_holes - 1) * hole_spacing) / 2; for (i = [0 : num_holes - 1]) { translate([0, start_y + (i * hole_spacing), 0]) { // Through hole translate([0, 0, -1]) cylinder(h = rail_height + 2, d = hole_diameter); // Countersink cone translate([0, 0, rail_height - countersink_depth]) cylinder(h = countersink_depth, d1 = hole_diameter, d2 = countersink_diameter); // Top clearance to ensure clean manifold cut translate([0, 0, rail_height - 0.01]) cylinder(h = 1, d = countersink_diameter); } } }