include <BOSL2/std.scad>
include <BOSL2/screws.scad>
d1 = 110;
d2 = 80;
dystans = 100 + d1/2 + d2/2;
grubosc = 20;
t = 8;

tab_t = 15;
tab_d = 12;

slit=2;

$fn=36;

difference() {
  union() {
  // d1
    translate([dystans/2,0,0]) union() {
      translate([0,0,grubosc/2]) cyl(d=d1+2*t, h=grubosc, rounding=2);
      translate([0,0,grubosc/2])
        cuboid([tab_t, d1+2*t+tab_d*2, grubosc], rounding=2);
    }
    // d2
    translate([-dystans/2,0,0]) union() {
      translate([0,0,grubosc/2]) cyl(d=d2+2*t, h=grubosc, rounding=2);
      translate([0,0,grubosc/2])
        cuboid([tab_t, d2+2*t+tab_d*2, grubosc], rounding=2);
    }
    // połączenie
    translate([0,0,grubosc/2])
      cuboid([dystans, grubosc,grubosc], rounding=2);
  }
  translate([0,0,-0.1]) union() {
    // d1
    translate([dystans/2,0,0]) union() {
      translate([0,0,grubosc/2 + 0.1]) cyl(d=d1, h=grubosc+0.2, rounding=-2);
      cube([slit,d1*2,grubosc*3], center=true);
      for(i=[d1/2+t+tab_d/2, -(d1/2+t+tab_d/2)]) {
        translate([-tab_t/3,i,grubosc/2]) rotate([180,90,0]) union() {
          nut_trap_inline(spec="M5", l=100);
          screw_hole(spec="M5", l=100);
        }
      }
    }
    // d2
    translate([-dystans/2,0,0]) union() {
      translate([0,0,grubosc/2 + 0.1]) cyl(d=d2, h=grubosc+0.2, rounding=-2);
      cube([slit,d2*2,grubosc*3], center=true);
      for(i=[d2/2+t+tab_d/2, -(d2/2+t+tab_d/2)]) {
        translate([tab_t/3,i,grubosc/2]) rotate([0,90,0]) union() {
          nut_trap_inline(spec="M5", l=100);
          screw_hole(spec="M5", l=100);
        }
      }
    }
  }
}
