$fn=90;
use <threads.scad>;
include <sum.scad>;

Debug=false;
Schnitt=false;

/* [Hidden] */

Inch=25.4;
Delta=0.01;

intersection() {
  L=[0.5,1.5,2.5,4,1];
  union() {
    difference() {
      // aussen
      union() {
        cylinder(d1=10, d2=11, h=L[0]);
        translate([0,0,sump(L,0)]) cylinder(d=11, h=sump(L,3));
      }
      // innen
      translate([0,0,sump(L,1)]) metric_thread(diameter=0.305*Inch+0.15, pitch=Inch/32, length=sumt(L)+2*Delta, test=Debug);
      translate([0,0,sump(L,3)+Delta-L[4]/2]) cylinder(d1=7, d2=9, h=L[4]); // Fase
      for(i=[0:360/3:359]) rotate([0,0,i]) union() {
        translate([2,0,-1]) cylinder(d=1.5, h=sump(L,2));
        rotate([0,90,0]) translate([0,0,2]) cylinder(d=1.5, h=6);
      }
    }
    cylinder(d=2, h=sump(L,2));
    *for(i=[0:360/32:359]) rotate([0,0,i]) translate([11/2,0,1]) union() {
      cylinder(d1=0, d2=1, h=0.5, $fn=4);
      translate([0,0,0.5]) cylinder(d=1, h=(sumt(L)-3), $fn=4);
      translate([0,0,sumt(L)-3+0.5]) cylinder(d1=1, d2=0, h=0.5, $fn=4);
    }
  }
  translate([0,(Schnitt)?50:0,0]) cube(100, center=true);
}
