up=40; //diameter of upright rod hor=20; // diameter of horizontal rod hup =80; //height of upright lhor = 50; //length of horizontal (from centre) bevel=15; fl=3; //flange width th=3; // wall thickness angle=90; // joint angle ///////////////// ang=angle-90; module rod(d,h){ linear_extrude(h) circle(d=d); } module fillet(a,b,c,d,up,hor){ hull(){ intersection(){ rod(up+a,hup); //upright tube translate([-0,0,hup/2]) rotate([0,90,0]) rod(hor+b,lhor); } intersection(){ rod(up+c,hup); // side tube translate([-0,0,hup/2]) rotate([0,ang,0]) rotate([0,90,0]) rod(hor+d,lhor); } } } $fn=100; module solid(up,hor,hup,lhor,bevel,fl,th,ang){ cylinder(d=up,h=hup); translate([-0,0,hup/2]) rotate([0,ang,0]) rotate([0,90,0]) cylinder(d=hor,h=lhor); for (j= [0:2:90]){ a=bevel*sin(j); b=bevel*cos(j); fillet(fl*2,a,b,fl*2,up,hor); } } module pipe(up,hor,hup,lhor,bevel,fl,th,ang){ difference(){ solid(up,hor,hup,lhor,bevel,fl,th,ang); translate([0,0,-hup]) cylinder(d=up-th-th,h=hup*3); translate([-0,0,(hup/2)]) rotate([0,ang,0]) rotate([0,90,0]) cylinder(d=hor-th-th,h=lhor*2); } } module smoothpipe(up,hor,hup,lhor,bevel,fl,th,ang){ difference(){ pipe(up,hor,hup,lhor,bevel,fl,th,ang); solid(up-th-th,hor-th-th,hup,lhor,bevel+th,0,th,ang); } } smoothpipe(up,hor,hup,lhor,bevel,fl=5,th,ang); translate([0,50,0]) pipe(up,hor,hup,lhor,bevel,fl=0,th,ang); translate([0,100,0]) pipe(up,hor,hup,lhor,bevel=0,fl=0,th,30);