// 62.5 x 100, r 7.5
$fn=50;

module frame(width, length, radius, height){
    x_offset = (width-radius)/2;
    y_offset = (length-radius)/2;
    z_offset = radius; 
hull(){
    translate ([x_offset,y_offset,0]) cylinder(r=radius, h=height);
    translate ([-x_offset,y_offset,0]) cylinder(r=radius, h=height);
    translate ([x_offset,-y_offset,0]) cylinder(r=radius, h=height);
    translate ([-x_offset,-y_offset,0]) cylinder(r=radius, h=height);  

     
    translate ([x_offset,y_offset,z_offset]) sphere(r=radius);
    translate ([-x_offset,y_offset,z_offset]) sphere(r=radius);
    translate ([x_offset,-y_offset,z_offset]) sphere(r=radius);
    translate ([-x_offset,-y_offset,z_offset]) sphere(r=radius);   
    }
}

module loch(height){
    translate([0,0,0-3.4])  cylinder (h=height, d=4.4);
   translate([0,0,height-3.4]) cylinder (h=3.5, d1=4.4, d2=11);
}


//
// beweglicher Arm

difference(){
union(){
    translate([-breite/2,100+120+11,dicke]) rotate([0,90,0]) cylinder(r=dicke, h=breite);
    
    
translate([-breite/2,11,0]) cube([breite,120 +100,10]);
 translate([0,0,2])    minkowski(){
    cylinder(d=30, h=4);
        sphere(2);
    }
  }  
    // kabelkanal
translate([-4,-8,2]) cube([8,120 +120,7]);
translate([-11/2,-15/2,0.8]) cube([11,15,8]);
translate([-5,215,2]) cube([10,20,40]);
//  Seitenscheiben
scheibendicke = (breite - innerebreite)/2 +.1;
  
translate([-breite/2,100+120+11,dicke]) rotate([0,90,0]) cylinder(r=dicke+.1, h=scheibendicke);
translate([breite/2-scheibendicke,100+120+11,dicke]) rotate([0,90,0]) cylinder(r=dicke+.1, h=scheibendicke);
#translate([-breite/2,100+120+11,dicke]) rotate([0,90,0]) cylinder(d=achsendurchmesser, h=breite);
}


// Halter nach oben
dicke= 5.7+7.5;
breite = 20;
innerebreite = 17;
achsendurchmesser = 8;
#cube([62.5, 100,30], center=true);
difference(){
union(){
frame(62.5, 100, 6.6, 4);
translate([0,0,-3.2])frame(58.5, 96, 3.5, 3.2);


    
translate([-breite/2,45,0]) cube([breite,120, dicke]);
translate([-breite/2,45+120-dicke,dicke]) rotate([0,90,0]) cylinder(r=dicke, h=breite);
}
translate([-innerebreite/2,45+120-dicke,dicke]) rotate([0,90,0]) cylinder(r=dicke+0.5, h=innerebreite);
// die Achse
translate([-breite/2,45+120-dicke,dicke]) rotate([0,90,0]) cylinder(d=achsendurchmesser+0.1, h=breite);
// oberes und unteres Befestigungsloch
//x:11,8 y:6.5, d=4.4

#translate([-62.5/2,45,0]) loch(dicke);
}
