
sg90_length = 22.2;
sg90_width = 11.8;
sg90_flange_pos = 15.9;
sg90_flange_thinkness = 2.5;
sg90_flange_length = 5;
sg90_flange_hole_pos = 2.7;
sg90_flange_hole_bore = 2;

module sg90(rot){
  translate([0,0,-sg90_flange_pos+7]) {
    color("steelblue") import("SG90_v7.stl");
    translate([5.9,16.3,32]) rotate([0,180,rot]) import("SG90_arm_v2.stl");
  }
}

module sg90_bracket_halve(){
  thinkness = 5;
  translate([0,0,-thinkness]) difference(){
    cube([sg90_width,sg90_flange_length,thinkness]);
    translate([sg90_width/2,sg90_flange_hole_pos,-1]) cylinder(d=sg90_flange_hole_bore,h=thinkness+2);
  }
}

module sg90_bracket(){
hull(){
translate([-2,-2,0]) cube([2,27.8,13]);
translate([-5,-2,8]) cube([5,27.8,5]);
}
translate([-2,-2,0]) cube([16,2,7]);
translate([-2,23.8,0]) cube([16,2,7]);
translate([-2,23.8,9.5]) cube([4,2,3.5]);
translate([-2,-2,9.5]) cube([4,2,3.5]);

difference(){
translate([13,-2,0]) cube([1.5,27.8,7]);
translate([17.8,11.9,4]) rotate([0,0,45]) cube([20,20,10],center=true);
}
//import("servo-halter-sg90-1.stl");
}
/*  translate([0,0,sg90_flange_pos]) {
    translate([0,-sg90_flange_length,0]) sg90_bracket_halve();
    translate([0,sg90_length,0]) sg90_bracket_halve();
  }*/


//sg90(90);
sg90_bracket();
