module hinge() {
    rotate([0,90,0])
    cylinder(d=1, h=3, $fn=64, center=true);

    translate([-0.5,0,-1.5])
    rotate([90,0,0])
    cylinder(d=0.5, h=1, $fn=64, center=true);
    translate([0.5,0,-1.5])
    rotate([90,0,0])
    cylinder(d=0.5, h=1, $fn=64, center=true);

    translate([-0.5,0,1.5])
    rotate([90,0,0])
    cylinder(d=0.5, h=1, $fn=64, center=true);
    translate([0.5,0,1.5])
    rotate([90,0,0])
    cylinder(d=0.5, h=1, $fn=64, center=true);

    hull() {
        cube([3, 0.5, 0.5], center=true);

        translate([0,0.5,-2])
        rotate([90,0,0])
        cylinder(d=1, h=1, $fn=64, center=true);
        
        translate([0,0.5,2])
        rotate([90,0,0])
        cylinder(d=1, h=1, $fn=64, center=true);
    }
}




// hinges
translate([0,-8.5,0])
{
    translate([-9,0,0])
    hinge();
    translate([9,0,0])
    hinge();
    hinge();
}


difference() {
    union() {
        translate([0,0,-10])
        cube([30, 17, 1], center=true);

        translate([0,0,-5])
        cube([30, 15, 10], center=true);

        translate([0,0,1])
        cube([30, 17, 1], center=true);
        translate([0,0,-1])
        cube([30, 17, 1], center=true);

        translate([0,0,7.5])
        cube([30, 1, 1], center=true);

        rotate([0,90,0])
        {
            cylinder(d=15, h=30, $fn=64, center=true);
            
            
            intersection(){
                cylinder(d=17, h=3, $fn=64, center=true);
                
                translate([0,0,-25])
                cube([50,50,50]);
            }
            
            intersection()
            {
                cylinder(d=17, h=1, $fn=64, center=true);
                
                translate([-51,-30,-25])
                cube([50,50,50]);
            }

            
            translate([0,0,-15])
            {
                cylinder(d=17, h=2, $fn=64);
                translate([5,0,1])
                cube([10, 17, 2], center=true);
            }

            translate([0,0,13])
            {
                cylinder(d=17, h=2, $fn=64);
                translate([5,0,1])
                cube([10, 17, 2], center=true);
            }

        }
    }
    
    
    d=0.5;
    difference() {
        cube([35, 35, 0.6], center=true);
        cube([30-d, 17-d, 0.6], center=true);
    }
}