// Parametric Print-in-Place Hinge // Modeled in the flat / open position for FDM printing /* [Hinge Dimensions] */ hinge_length = 60; // [30:5:150] num_knuckles = 5; // [3:2:9] leaf_width = 20; // [10:1:50] leaf_thickness = 3.0; // [1.5:0.5:6.0] knuckle_diameter = 8.0; // [5.0:0.5:14.0] corner_radius = 3.0; // [0:0.5:8] /* [Print-in-Place Tolerances] */ pin_diameter = 4.0; // [2.0:0.5:8.0] clearance = 0.4; // [0.2:0.05:0.8] axial_clearance = 0.4; // [0.2:0.05:0.8] /* [Fasteners / Mounting Holes] */ screw_hole_diameter = 3.5; // [2.0:0.1:6.0] countersink_diameter = 7.0; // [4.0:0.1:12.0] screw_edge_offset = 15; // [8:1:30] /* [Colors] */ leaf_a_color = "#3A7CA5"; // [Color] leaf_b_color = "#E07A5F"; // [Color] /* [Quality] */ $fn = 64; // Derived dimensions knuckle_radius = knuckle_diameter / 2; pin_radius = pin_diameter / 2; knuckle_pitch = hinge_length / num_knuckles; screw_x_pos = knuckle_radius + leaf_width / 2; // Main assembly module print_in_place_hinge() { color(leaf_a_color) leaf_a(); color(leaf_b_color) leaf_b(); } // Helper: 2D rounded rectangle for leaf flap module leaf_plate_2d(w, l, r) { hull() { translate([0, 0]) square([w - r, l]); translate([w - r, r]) circle(r = r); translate([w - r, l - r]) circle(r = r); } } // Leaf A (Left Side, containing knuckles 0, 2, 4 and center pin) module leaf_a() { difference() { union() { // Leaf plate extending left (-X) translate([-knuckle_radius, 0, 0]) mirror([1, 0, 0]) linear_extrude(height = leaf_thickness) leaf_plate_2d(leaf_width, hinge_length, corner_radius); // Knuckles for Leaf A (even indices) + bridge to leaf for (i = [0 : 2 : num_knuckles - 1]) { y0 = (i == 0) ? 0 : (i * knuckle_pitch + axial_clearance / 2); y1 = (i == num_knuckles - 1) ? hinge_length : ((i + 1) * knuckle_pitch - axial_clearance / 2); k_len = y1 - y0; translate([0, y0, knuckle_radius]) { // Solid knuckle cylinder rotate([-90, 0, 0]) cylinder(r = knuckle_radius, h = k_len); } // Bridge from leaf plate to knuckle cylinder translate([-knuckle_radius, y0, 0]) cube([knuckle_radius, k_len, knuckle_radius]); } // Continuous hinge pin attached to Leaf A translate([0, 0, knuckle_radius]) rotate([-90, 0, 0]) cylinder(r = pin_radius, h = hinge_length); } // Cutouts on Leaf A side for Leaf B knuckles for (i = [1 : 2 : num_knuckles - 1]) { y_start = i * knuckle_pitch - axial_clearance / 2; k_len = knuckle_pitch + axial_clearance; translate([-(knuckle_radius + clearance), y_start, -0.5]) cube([knuckle_radius + clearance + 0.1, k_len, knuckle_diameter + 1]); } // Countersunk screw holes on Leaf A countersink_hole(-screw_x_pos, screw_edge_offset); countersink_hole(-screw_x_pos, hinge_length - screw_edge_offset); } } // Leaf B (Right Side, containing knuckles 1, 3 with internal pin bore) module leaf_b() { difference() { union() { // Leaf plate extending right (+X) translate([knuckle_radius, 0, 0]) linear_extrude(height = leaf_thickness) leaf_plate_2d(leaf_width, hinge_length, corner_radius); // Knuckles for Leaf B (odd indices) + bridge to leaf for (i = [1 : 2 : num_knuckles - 1]) { y0 = i * knuckle_pitch + axial_clearance / 2; y1 = (i + 1) * knuckle_pitch - axial_clearance / 2; k_len = y1 - y0; translate([0, y0, knuckle_radius]) { // Knuckle outer cylinder rotate([-90, 0, 0]) cylinder(r = knuckle_radius, h = k_len); } // Bridge from leaf plate to knuckle cylinder translate([0, y0, 0]) cube([knuckle_radius, k_len, knuckle_radius]); } } // Bore for hinge pin with radial clearance translate([0, -1, knuckle_radius]) rotate([-90, 0, 0]) cylinder(r = pin_radius + clearance, h = hinge_length + 2); // Cutouts on Leaf B side for Leaf A knuckles for (i = [0 : 2 : num_knuckles - 1]) { y0 = (i == 0) ? -0.1 : (i * knuckle_pitch - axial_clearance / 2); y1 = (i == num_knuckles - 1) ? (hinge_length + 0.1) : ((i + 1) * knuckle_pitch + axial_clearance / 2); k_len = y1 - y0; translate([-0.1, y0, -0.5]) cube([knuckle_radius + clearance + 0.1, k_len, knuckle_diameter + 1]); } // Countersunk screw holes on Leaf B countersink_hole(screw_x_pos, screw_edge_offset); countersink_hole(screw_x_pos, hinge_length - screw_edge_offset); } } // Countersunk hole module (90 degree standard countersink) module countersink_hole(x, y) { cs_depth = (countersink_diameter - screw_hole_diameter) / 2; translate([x, y, -1]) { // Through hole cylinder(d = screw_hole_diameter, h = leaf_thickness + 2); // Countersink cone translate([0, 0, leaf_thickness + 1 - cs_depth]) cylinder(d1 = screw_hole_diameter, d2 = countersink_diameter, h = cs_depth + 0.01); // Upper clearance opening translate([0, 0, leaf_thickness + 1]) cylinder(d = countersink_diameter, h = 2); } } print_in_place_hinge();