use <threads-library-by-cuiso-v1.scad>

// Screw
translate([0,50,0]) difference(){
    union() {
        cylinder(d=40,h=3);
        translate ([0,0,9]) rotate([180,0,0]) thread_for_screw(diameter=20, length=6); 

}
        translate([0,0,-1]) cylinder(d=5.5,h=9);
}

// Socket
difference(){
   union() {
       cylinder(d=40, h =4);
       translate([0,0,1]) difference(){
       translate([0,0,3]) cylinder(d=19, h=4, d2=12);
       union(){
           translate([0,0,3]) cylinder(d=9, h=7);
           translate([-4.5,0,3]) rotate([0,0,0]) cube([9,9,9]);
           };
        }
    }

     translate([0,0,1]) union() {
         rotate([180,0,0]) translate([0,0,-9]) union() {
             cylinder(d=19, h=1);
             translate([0,0,1]) cylinder(d=10, h=1);
             translate([0,0,2]) cylinder(d=8.5, h=5.5);
             translate([0,0,7]) cylinder(d=11, h=1);
         }
         difference(){
             translate([-5.5,-6,3]) cube([11,25,2]);
             translate([-6.6,-7,5]) rotate([0,45,0]) cube([1.5,27,1.5]);
             translate([4.5,-7,5]) rotate([0,45,0]) cube([1.5,27,1.5]);
         }
     }
     translate ([0,0,0]) thread_for_nut(diameter=20, length=3.9); 
}

