// Print-in-Place Hinge with Alternating Knuckles // Modeled in the open (flat) position /* [Hinge Dimensions] */ // Total length of the hinge along the hinge axis hinge_length = 60.0; // [30:1:150] // Width of each leaf flap measured from the hinge pin centerline leaf_width = 20.0; // [15:1:50] // Thickness of each leaf leaf_thickness = 3.0; // [2:0.5:6] // Total number of alternating knuckles along the hinge knuckle_count = 5; // [3:2:11] // Outer diameter of the hinge knuckles knuckle_diameter = 8.0; // [6:0.5:14] /* [Pin and Tolerances] */ // Diameter of the central hinge pin pin_diameter = 4.0; // [2.5:0.5:8] // Print-in-place clearance gap between moving parts clearance = 0.4; // [0.2:0.05:0.8] /* [Screw Holes] */ // Through-hole diameter for mounting screws screw_hole_diameter = 3.5; // [2:0.5:6] // Top diameter of the 90-degree countersunk screw head screw_head_diameter = 7.0; // [4:0.5:12] // Corner radius on the outer corners of the leaves corner_radius = 2.5; // [0:0.5:8] /* [Colors] */ // Color of Leaf A (including pin and odd knuckles) leaf_a_color = "SteelBlue"; // Color of Leaf B (even knuckles) leaf_b_color = "DarkOrange"; /* [Quality] */ $fn = 60; // --- Derived Calculations --- pin_radius = pin_diameter / 2; knuckle_radius = knuckle_diameter / 2; center_z = knuckle_radius; // Knuckles and leaves sit flush at Z = 0 on print bed // Axial spacing for knuckles total_axial_gap = (knuckle_count - 1) * clearance; knuckle_length = (hinge_length - total_axial_gap) / knuckle_count; knuckle_pitch = knuckle_length + clearance; // Screw hole positions hole_x = (knuckle_radius + clearance + leaf_width) / 2; hole_y1 = hinge_length * 0.25; hole_y2 = hinge_length * 0.75; countersink_depth = (screw_head_diameter - screw_hole_diameter) / 2; // --- Main Assembly --- color(leaf_a_color) leaf_a(); color(leaf_b_color) leaf_b(); // --- Module Definitions --- // Leaf A: Contains knuckles 0, 2, 4 (indices 0, 2, 4) and the central pin module leaf_a() { difference() { union() { // Flat leaf plate leaf_plate_body(x_sign = 1); // Knuckles 0, 2, 4 with transition bridges to leaf plate for (i = [0 : 2 : knuckle_count - 1]) { knuckle_with_bridge(i * knuckle_pitch, knuckle_length, x_sign = 1); } // Continuous central hinge pin translate([0, 0, center_z]) rotate([-90, 0, 0]) cylinder(r = pin_radius, h = hinge_length); } // Screw holes translate([hole_x, hole_y1, 0]) countersunk_hole(); translate([hole_x, hole_y2, 0]) countersunk_hole(); } } // Leaf B: Contains knuckles 1, 3 (indices 1, 3) with bore for the central pin module leaf_b() { difference() { union() { // Flat leaf plate leaf_plate_body(x_sign = -1); // Knuckles 1, 3 with transition bridges to leaf plate for (i = [1 : 2 : knuckle_count - 1]) { knuckle_with_bridge(i * knuckle_pitch, knuckle_length, x_sign = -1); } } // Through-bore for the central pin (pin radius + radial clearance) translate([0, -1, center_z]) rotate([-90, 0, 0]) cylinder(r = pin_radius + clearance, h = hinge_length + 2); // Screw holes translate([-hole_x, hole_y1, 0]) countersunk_hole(); translate([-hole_x, hole_y2, 0]) countersunk_hole(); } } // Flat leaf plate with rounded outer corners module leaf_plate_body(x_sign = 1) { inner_x = knuckle_radius + clearance; outer_x = leaf_width; plate_w = outer_x - inner_x; linear_extrude(height = leaf_thickness) { if (x_sign > 0) { translate([inner_x, 0]) hull() { // Straight inner edge square([0.1, hinge_length]); // Rounded outer corners translate([plate_w - corner_radius, corner_radius]) circle(r = corner_radius, $fn = 32); translate([plate_w - corner_radius, hinge_length - corner_radius]) circle(r = corner_radius, $fn = 32); } } else { translate([-outer_x, 0]) hull() { // Rounded outer corners translate([corner_radius, corner_radius]) circle(r = corner_radius, $fn = 32); translate([corner_radius, hinge_length - corner_radius]) circle(r = corner_radius, $fn = 32); // Straight inner edge translate([plate_w - 0.1, 0]) square([0.1, hinge_length]); } } } } // Knuckle cylinder with smooth transition bridge to the leaf plate module knuckle_with_bridge(y_pos, len, x_sign = 1) { overlap = 0.2; // Overlap with leaf plate to ensure seamless union bridge_width = knuckle_radius + clearance + overlap; hull() { // Full knuckle cylinder translate([0, y_pos, center_z]) rotate([-90, 0, 0]) cylinder(r = knuckle_radius, h = len); // Lower bridge extending toward the leaf plate if (x_sign > 0) { translate([0, y_pos, 0]) cube([bridge_width, len, leaf_thickness]); } else { translate([-bridge_width, y_pos, 0]) cube([bridge_width, len, leaf_thickness]); } } } // Standard 90-degree countersunk screw hole module countersunk_hole() { // Cylindrical through-hole translate([0, 0, -1]) cylinder(d = screw_hole_diameter, h = leaf_thickness + 2, $fn = 32); // 90-degree countersink cone (top face is at Z = leaf_thickness) translate([0, 0, leaf_thickness - countersink_depth]) cylinder( d1 = screw_hole_diameter, d2 = screw_head_diameter, h = countersink_depth + 0.01, $fn = 32 ); // Clearance above the top surface for a clean boolean cut translate([0, 0, leaf_thickness]) cylinder(d = screw_head_diameter, h = 2, $fn = 32); }