rs=2; rc1=2; rc2=rc1; a=30; border=4; wedgehalflength=sqrt(3)*a/14/2; wedgefactor=sin(22.5); // determines the angle of the wedges $fa=0.5; // default minimum facet angle is now 0.5 $fs=0.5; // default minimum facet size is now 0.5 mm module cutout45(p) { polyhedron( points = [ [ 0, 0, -wedgehalflength ], [ 0, 0, wedgehalflength ], [ rc1, rc1*p, wedgehalflength ], [ rc1, -rc1*p, wedgehalflength ], [ rc1, rc1*p, -wedgehalflength ], [ rc1, -rc1*p, -wedgehalflength ] ], faces = [ [ 1, 3, 5, 0 ], [ 3, 2, 4, 5 ], [ 2, 1, 0, 4 ], [ 4, 0, 5 ], [ 1, 2, 3 ] ], convexity = 10 ); } module cutout45_smaller(p) { polyhedron( points = [ [ 0, 0, -wedgehalflength*0.7 ], [ 0, 0, wedgehalflength*0.7 ], [ rc1, rc1*p, wedgehalflength*0.7 ], [ rc1, -rc1*p, wedgehalflength*0.7 ], [ rc1, rc1*p, -wedgehalflength*0.7 ], [ rc1, -rc1*p, -wedgehalflength*0.7 ] ], faces = [ [ 1, 3, 5, 0 ], [ 3, 2, 4, 5 ], [ 2, 1, 0, 4 ], [ 4, 0, 5 ], [ 1, 2, 3 ] ], convexity = 10 ); } module cutout() { //cube([2*rc1,190, 2*rc1], center=true); rotate ([90,0,0]) cylinder(r=rc1,h=190,center=true); } module allownone() { translate([0, -3*wedgehalflength, 0]) rotate ([90,90,0]) cutout45_smaller(wedgefactor); translate([0, -7*wedgehalflength, 0]) rotate ([90,90,0]) cutout45_smaller(wedgefactor); translate([0, -11*wedgehalflength, 0]) rotate ([90,90,0]) cutout45_smaller(wedgefactor); } module allow20() { translate([0, -3*wedgehalflength, 0]) rotate ([90,90,0]) cutout45_smaller(wedgefactor); translate([0, -7*wedgehalflength, 0]) rotate ([90,90,0]) cutout45_smaller(wedgefactor); // translate([0, -11*wedgehalflength, 0]) rotate ([90,90,0]) cutout45_smaller(wedgefactor); } module allow01() { // translate([0, -3*wedgehalflength, 0]) rotate ([90,90,0]) cutout45_smaller(wedgefactor); translate([0, -7*wedgehalflength, 0]) rotate ([90,90,0]) cutout45_smaller(wedgefactor); translate([0, -11*wedgehalflength, 0]) rotate ([90,90,0]) cutout45_smaller(wedgefactor); } // blokkades begin- en eindpositie translate ([0, 0, -10]) rotate ([0, 0, -120]) translate ([-1.5*a, -2*1/2*sqrt(3)*a,0]) rotate ([90,90,90]) cutout45_smaller(wedgefactor); translate ([0, 0, -10]) rotate ([0, 0, -120]) translate ([-0.5*a, -2*1/2*sqrt(3)*a,0]) rotate ([90,90,90]) cutout45_smaller(wedgefactor); translate ([0, 0, -10]) rotate ([0, 0, 0]) translate([a, 0, 0]) rotate([0,0,-60]) allownone(); translate ([0, 0, -10]) rotate ([0, 0, 0]) translate([2*a, 0, 0]) rotate([0,0,-60]) allownone(); translate ([0, 0, -10]) rotate ([0, 0, 0]) translate([a, 0, 0]) allow01(); translate ([0, 0, -10]) rotate ([0, 0, 0]) translate ([-1/2*a,-1/2*sqrt(3)*a, 0]) rotate ([0, 0, 240]) allownone(); translate ([0, 0, -10]) rotate ([0, 0, 0]) translate ([-1/2*a,-1/2*sqrt(3)*a, 0]) rotate ([0, 0, 180]) allownone(); translate ([0, 0, -10]) rotate ([0, 0, 0]) translate ([-a,-1/2*sqrt(3)*2*a, 0]) rotate ([0, 0, 180]) allow20(); translate ([0, 0, -10]) rotate ([0, 0, 0]) translate ([-1/2*a, 1/2*sqrt(3)*a, 0]) rotate ([0, 0, 60]) allownone(); translate ([0, 0, -10]) rotate ([0, 0, 0]) translate ([-1/2*a, 1/2*sqrt(3)*a, 0]) rotate ([0, 0, 120]) allownone(); translate ([0, 0, -10]) rotate ([0, 0, 0]) translate ([-a, 1/2*sqrt(3)*2*a, 0]) rotate ([0, 0, 60]) allownone(); translate ([0, 0, -10]) difference() { polyhedron( points = [ [ -2*a - border*1/2, -1/2*sqrt(3)*a*2 - border, -2*rc1 ], [ -2*a - border*1/2, -1/2*sqrt(3)*a*2 -border, 0 ], [ 2*a + border*1/2, -1/2*sqrt(3)*a*2 - border, -2*rc1 ], [ 2*a + border*1/2, -1/2*sqrt(3)*a*2 -border, 0 ], [ 5/2*a + 1/2*sqrt(3)*border, -1/2*sqrt(3)*a, -2*rc1 ], [ 5/2*a + 1/2*sqrt(3)*border, -1/2*sqrt(3)*a, 0 ], [ 1/2*a+border*1/2, 3*1/2*sqrt(3)*a + border, -2*rc1 ], [ 1/2*a+border*1/2, 3*1/2*sqrt(3)*a + border, 0 ], [ -1/2*a-border*1/2, 3*1/2*sqrt(3)*a + border, -2*rc1 ], [ -1/2*a-border*1/2, 3*1/2*sqrt(3)*a + border, 0 ], [ -5/2*a - 1/2*sqrt(3)*border,-1/2*sqrt(3)*a, -2*rc1 ], [ -5/2*a - 1/2*sqrt(3)*border, -1/2*sqrt(3)*a, 0 ] ], faces = [ [ 0, 2, 4, 6, 8, 10 ], [ 11, 9, 7, 5, 3, 1 ], [ 0, 1, 3, 2 ], [ 2, 3, 5, 4 ], [ 4, 5, 7, 6 ], [ 6, 7, 9, 8 ], [ 8, 9, 11, 10 ], [ 10, 11, 1, 0 ] ], convexity = 10 ); cutout(); translate ([-.5*a, 0, 0]) cutout(); translate ([-1*a, 0, 0]) cutout(); translate ([-1.5*a, 0, 0]) cutout(); translate ([-2*a, 0, 0]) cutout(); translate ([-2.5*a, 0, 0]) cutout(); translate ([.5*a, 0, 0]) cutout(); translate ([1*a, 0, 0]) cutout(); translate ([1.5*a, 0, 0]) cutout(); translate ([2*a, 0, 0]) cutout(); translate ([2.5*a, 0, 0]) cutout(); rotate ([0, 0, 60]) { cutout(); translate ([-.5*a, 0, 0]) cutout(); translate ([-1*a, 0, 0]) cutout(); translate ([-1.5*a, 0, 0]) cutout(); translate ([-2*a, 0, 0]) cutout(); translate ([-2.5*a, 0, 0]) cutout(); translate ([.5*a, 0, 0]) cutout(); translate ([1*a, 0, 0]) cutout(); translate ([1.5*a, 0, 0]) cutout(); translate ([2*a, 0, 0]) cutout(); translate ([2.5*a, 0, 0]) cutout(); } rotate ([0, 0, 120]) { cutout(); translate ([-.5*a, 0, 0]) cutout(); translate ([-1*a, 0, 0]) cutout(); translate ([-1.5*a, 0, 0]) cutout(); translate ([-2*a, 0, 0]) cutout(); translate ([-2.5*a, 0, 0]) cutout(); translate ([.5*a, 0, 0]) cutout(); translate ([1*a, 0, 0]) cutout(); translate ([1.5*a, 0, 0]) cutout(); translate ([2*a, 0, 0]) cutout(); translate ([2.5*a, 0, 0]) cutout(); } rotate ([0, 0, 30]) { cutout(); translate ([1/2*sqrt(3)*a, 0, 0]) cutout(); translate ([2/2*sqrt(3)*a, 0, 0]) cutout(); translate ([3/2*sqrt(3)*a, 0, 0]) cutout(); translate ([-1/2*sqrt(3)*a, 0, 0]) cutout(); translate ([-2/2*sqrt(3)*a, 0, 0]) cutout(); translate ([-3/2*sqrt(3)*a, 0, 0]) cutout(); } rotate ([0, 0, 90]) { cutout(); translate ([1/2*sqrt(3)*a, 0, 0]) cutout(); translate ([2/2*sqrt(3)*a, 0, 0]) cutout(); translate ([3/2*sqrt(3)*a, 0, 0]) cutout(); translate ([-1/2*sqrt(3)*a, 0, 0]) cutout(); translate ([-2/2*sqrt(3)*a, 0, 0]) cutout(); translate ([-3/2*sqrt(3)*a, 0, 0]) cutout(); } rotate ([0, 0, 150]) { cutout(); translate ([1/2*sqrt(3)*a, 0, 0]) cutout(); translate ([2/2*sqrt(3)*a, 0, 0]) cutout(); translate ([3/2*sqrt(3)*a, 0, 0]) cutout(); translate ([-1/2*sqrt(3)*a, 0, 0]) cutout(); translate ([-2/2*sqrt(3)*a, 0, 0]) cutout(); translate ([-3/2*sqrt(3)*a, 0, 0]) cutout(); } } for (angle = [0 : 120 : 240]) { rotate ([0, 0, angle]) { translate (-a/6*sqrt(3)*[1,0,0]) { // bottom rotate ([90, 0, 0]) { difference() { cylinder(r=rc1,h=a,center=true); rotate ([0, 0, 180]) cutout45(wedgefactor); if (angle == 240) rotate ([0, 0, -90]) cutout45(wedgefactor); } } // top translate ([0,0,a*sqrt(3)]) { rotate ([90, 0, 0]) { difference() { cylinder(r=rc2,h=a,center=true); rotate ([0, 0, 180]) cutout45(wedgefactor); rotate ([0, 0, 90 + acos(1/3)]) cutout45(wedgefactor); } } } } translate (a/3*sqrt(3)*[1,0,0]) { sphere(rs); difference() { cylinder(r1=rc1,r2=rc2,h=a*sqrt(3)); //translate ([0, 0, (25 - angle/30)*wedgehalflength ] ) cutout45(1); for (index = [ 3 : 4 : 11 ]) { translate ([0, 0, index*wedgehalflength ] ) { rotate ([0, 0, 60]) cutout45(wedgefactor); rotate ([0, 0, -60]) cutout45(wedgefactor); cutout45(1); } } for (index = [ 17 : 4 : 25 ]) { translate ([0, 0, index*wedgehalflength ] ) { rotate ([0, 0, 60]) cutout45(wedgefactor); rotate ([0, 0, -60]) cutout45(wedgefactor); if (index != 25 - angle/30) cutout45(1); } } } translate(a*sqrt(3)*[0,0,1]) { sphere(rs); rotate ([0,-90+atan(sqrt(2)),0]) difference() { cylinder(r=rc2,h=a); translate([0, 0, .5*a]) { rotate ([0, 0, (360-acos(1/3))/2-90]) cutout45(wedgefactor); rotate ([0, 0, -(360-acos(1/3))/2+90]) cutout45(wedgefactor); } } } } } } translate (a*[0,0,sqrt(3)+1/3*sqrt(6)]) { sphere(rs); //cylinder(r1=rc1,r2=rc2,h=a*1/3*sqrt(6)); }