include <../../config.scad>; module door_hinge_half() { diameter_hole_bottom = SIZE_BOLT_HINGE; diameter_hole_top = 7; color("gray") difference() { // body translate([-R_HINGE[0] / 2, 0, 0]) cube([R_HINGE[0], R_HINGE[1] / 2, R_HINGE[2]], center = false); // bolt holes for (index_hole = [0 : 1 : 1]) { mirror([index_hole, 0, 0]) { // through hole translate([OFFSET_HINGE_HOLE_CENTRES_X / 2, OFFSET_HINGE_HOLE_CENTRES_Y / 2, 0]) cylinder(R_HINGE[2] / 2, diameter_hole_bottom / 2, diameter_hole_bottom / 2, center = false); // tapered hole translate([OFFSET_HINGE_HOLE_CENTRES_X / 2, OFFSET_HINGE_HOLE_CENTRES_Y / 2, R_HINGE[2] / 2]) cylinder(R_HINGE[2] / 2, diameter_hole_bottom / 2, diameter_hole_top / 2, center = false); } } } // Shopping } module door_hinge(angle_from_closed) { color("gray") union() { // hinge bearing axis translate([0, 0, R_HINGE[2]]) rotate([0, 90, 0]) cylinder(R_HINGE[0], R_HINGE[2] * 2, R_HINGE[2] * 2, center = true); // door flanges for (index_hinge_half = [0 : 1 : 1]) { // mirror([0, index_hinge_half, 0]) { rotate([index_hinge_half == 0 ? 0 : 180 - angle_from_closed, 0, 0]) rotate([0, 0, index_hinge_half == 0 ? 0 : 180]) // door_hinge_half(); import("./door_hinge_half.stl"); } } // Shopping echo(str("Door hinge: Stainless steel door hinge - x1")); } // test output $fn = 25; // door_hinge_half(); door_hinge(180);