include /*[Basic]*/ useVersion=21.326;//⇒ v.gd/ubaer assert(Version>=useVersion,str("lib version ",Version," detected, install ",useVersion," ub.scad library‼ ⇒http://v.gd/ubaer")); nozzle=.2; designVersion=3.1; bed=false; $info=false; /*[Balljoint]*/ //balldiameter d= 8;///[8,16] //length l=[15,14];///[[15,14],[17,17]] // taper angle taper=2; // rim rand=.75;// [.75,1.5] //taper diameter d2=d/1.4; // neck halsL=2;//[2,3] //clearance spiel=0.2; // Knurl size knurlSize=[1.25,1.25];//[1.25,2] //distance taper from center distKonus=d/2+2; // length over center to hold ball topL=d/5; throughHole=false; /*[Thread]*/ // thread diameter dGew=d; // thread size hGew=.375; //[.375,.75] // pitch p=1.3; //number of threads gGew=2;//[1:single thread,2:double thread] // length of thread (changes turns) GewL=max(d/2,5); /*[Stand]*/ stand=false; opt=0; // [1:male — connects to Base,0:female — connects to Ball,3:M4 — male,2:M4 — female,4:Extension] arms=3; // split arm ends fork=false; extensionL=50; size=50; //Klemmbaustein kbs=false; if(kbs)%Color(0.7,alpha=.4)Tz(-9.6)KBS([4,2,1]); konisch=is_list(taper)?taper:[taper,taper]; echo(boltDia=d2,taper=taper); echo(jointDistance=d/2+halsL+l[0]); if(!stand){ if($preview){ R(throughHole?35:75)Ball(l=l[1],d=d,dHals=d/2.25,d2=d2); Schnitt(1,z=-40)Color(l=0.8){Tz(-d/2-halsL-l[0]) Ball(l=l[1],d=d,dHals=d/2.25,d2=d2); Base(); CapNut(); }} if(!$preview)Anordnen(es=(spiel*2+dGew+hGew*2+rand*2+max(dGew+hGew*2+rand*2,d2+rand*2))/2+1){ Tz(l[1])R(180)Ball(l=l[1],d=d,dHals=d/2.25,d2=d2); Tz(l[0])Base(); Tz(topL)R(180)CapNut(); } } if(stand){ Schnitt(1,r=45*0){ Stand(s=size/2,opt=opt,e=arms,fork=fork); if(opt<2&&arms)LinEx(.001)Kreis(r=size/2+5,rand=.001);} if($preview)if(opt==0||opt==2)%Tz(l[1]+4)R(180)Ball(l=l[1],d=d,dHals=d/2.25,d2=d2); else if(opt<4) Tz(l[0]+d/2+3)%Base(); } module Stand(s=10,e=3,opt=1,kbs=kbs,dHals=d/1.75,fork=false){ if(opt<4)difference(){ union(){ Polar(e){ hull(){ T(fork?s/PHI:s) Pille(2,d=3,rad=.5,center=false); Pille(5,d=5,rad=[1,2],center=false); } if(fork){ deg=270/e; T(s/PHI)MKlon(my=1)rotate(deg) hull(){ Pille(2,d=3,rad=.5,center=false); T((s-s/PHI)*tan(deg))Pille(1.5,d=2.5,rad=.5,center=false); } } } if(kbs)cylinder(2,d=Hypotenuse(4,4-2.4)*2+.5); if(opt==0||opt==2)Pille(l[0]-d/2-1,d=d2+spiel+rand*2,rad=[2,.5],center=false); else Pille(5,d=dHals,center=false,rad=[rand/3,0]); if(!e){ LinEx(1.499,[1,1]*.35,grad=45,$d=size,lap=.0001)Quad($d); Tz(1.499)Kehle(rad=2,dia=d2+spiel+rand*2); } } if(opt==0||opt==2)Tz(l[0]-d/2+1.5)R(180)Kegel(d1=d2+spiel,h=l[0]-d/2,grad=90-konisch[0]); cylinder(50,d=opt>2?4.25:dHals-rand*2,center=true);// center hole Tz(-.01)Kegel(d1=(opt>2?4.25:dHals-rand*2)+.5);//Fase if(kbs)KBS(male=false,rot=0,top=4,n=8); } if (opt==2||opt==3) Gewinde(preset="M4",innen=true,wand=rand,h=6,tz=opt==2?-5:+0,center=false); if(opt==1) Tz(5)Halb()Tz(-d/2-1)Ball(dHals=dHals); if(opt==3) difference(){ Tz(4)Halb()Tz(-d/1.5)Ball(); cylinder(8,d1=4.25,d2=4); } //Tz(0) Kegel(d1=d2,h=l[1],grad=90-konisch[1]); if(opt==4) Extension();//le=extensionL); } module Base(l=l[0],d2=d2+spiel +0){ //distKonus=d/2+2; lKnurl=l-distKonus; sphereCut=d*.22; difference(){ union(){ *T(1)Tz(-d/4) Pille(l=d/2,center=true,d=dGew,rad=.5,rad2=.25); Tz(-l)Anschluss(h=[l-GewL-5,GewL +5],rad=1,grad=25,d2=dGew,d1=d2+rand*2,center=false); Gewinde(g=gGew,kern=dGew,dn=dGew+hGew*2,h=distKonus-sphereCut,tz=-GewL*0 +0.45*0-distKonus +2-p,p=p,wand=rand-spiel/2,cyl=false); } R(180)cylinder(sphereCut,d=d*5); sphere(d=d+spiel); cylinder(50,d=d/2,center=true); if(konisch[0])Tz(-l)Kegel(d1=d2,h=l-distKonus,grad=90-konisch[0]); else Tz(-50-distKonus)cylinder(50,d=d2); Tz(-distKonus-.001)Kegel(d1=konisch[0]?d2-sin(konisch[0])*(l-distKonus)*2:d2); Tz(-l-.1)Kegel(d1=d2+.75,grad=45); // chamfer } //Knurl if(rand>1)Tz(-distKonus)Kehle(dia=dGew,rad=.75); Tz(-distKonus-lKnurl)intersection(){ Zylinder(d=dGew+hGew*2 +rand*1.75,a=-.25,lambda=knurlSize[0],h=lKnurl); LinEx(lKnurl,.5,1,$d=dGew+hGew*2+rand*2,grad=45)circle(d=$d); Ring(50,d=d2+.8,rand=-10,center=true); } } module CapNut(cut=throughHole?false:true){ dNut=spiel*2+dGew+hGew*2; h=-distKonus +2-p/2; cutLoch=Kathete(d/2,topL)*2+spiel; difference(){ union(){ difference(){ Pille(l=topL*2,center=true,d=dNut+rand*2,rad=.5,rad2=rand); sphere(d=d+.05); Tz(0.5)R(180)cylinder(50,d=dNut); cylinder(50,d=cutLoch,center=true); if(d2>=cutLoch)echo("\n!!Warning bolt to thick for ball!!\n"); } Tz((-GewL +0.46-1.3/2)*0+h)Torus(d=rand,dia=dNut+rand*2); Tz(.5)R(180)Kehle(dia=-dNut,rad=0.45); rotate(gGew==2?0:0)Gewinde(g=gGew,kern=dGew+spiel*2,dn=dNut,h=GewL,tz=h+p/2,p=p,innen=true,wand=rand,cyl=true); //Knurl Tz(-GewL*0+h)intersection(){ Zylinder(d=dNut+rand*2+.5,a=.25,lambda=knurlSize[1],h=-h+topL-rand/1.5); LinEx(-h +topL-rand/1.5,.5,$d=dNut+rand*2+.5,grad=45)circle(d=$d); Ring(50,d=dNut,rand=-10,center=true); } } if(cut)hull(){ R(90)cylinder(50,d=d/2,center=false); Tz(d*5) R(90)cylinder(50,d=d/2,center=false); } } } module Ball(l=l[1],d=d,dHals=d/2.25,d2=d/1.4,halsL=halsL){ RotEx(cut=true)Rund(min(.5,rand/2-.01),0.2,chamfer=true)difference(){ union(){ //T(-d2/2,d+2)square([d2,l-d-2]); Rund(0.7,1.5){ circle(d=d); T(-dHals/2,0)square([dHals,halsL+d/2+1]); T(-d2/2,halsL+d/2)square([d2,l-d/2-halsL]); } } if(konisch[1])T(d2/2,halsL+d/2)rotate(konisch[1])square([50,50]); if(dHals-rand*2>0)T(0,throughHole?0:250-d/2.2+1.25) square([dHals-rand*2,500],center=true);//infill Wall } } module Extension(le=extensionL,dHals=d/2.25,other=true){ distKonus=distKonus-2+halsL; taperBallL=l[1]-d/2-halsL; l2=l[0]-distKonus +4; rExtension=max(d2/2 -0.75,dHals/2); echo(str("Extension ",le," länge=",le-l[0]-distKonus+ taperBallL)); Tz((-l[0]+taperBallL)){ R(90,0,0)Caliper(l=le,end=3,center=false,help=0,in=2,translate=[15,0],messpunkt=0); RotEx(cut=1)Rund(rand/2-0.1,chamfer=true){ difference(){ T(y=l[0]-taperBallL)Rund(rand/2-.1,2){ square([d2/2,taperBallL]); SBogen(l1=le-l[0]-distKonus+ taperBallL-l2,l2=l2,center=false,extrude=rExtension,dist=d2/2+rand-rExtension,grad=30,r1=(-rExtension+d2/2+rand)/0.4); } //Rund(1,2) union(){ square([rExtension*2-rand*2,500],true);//infill Wall if(konisch[1])T(d2/2,l[0])rotate(-konisch[1])T(y=-taperBallL-5)square([50,taperBallL+10]);//Ball taper (bottom) if(konisch[0])T(d2/2+spiel/2*0,le-distKonus)rotate(-konisch[0] +180)T(y=-9)square([50,l[0]-distKonus+10]);// Base taper (top) if(konisch[0])T(0,le-l[0]-1)circle(r=d2/2+spiel/2*0-tan(konisch[0])*(l[0]-distKonus+1),$fn=4);// Base taper (top) } //Pivot(p0=[0,le],$messpunkt=5); } } // * RotEx(cut=1)Rund(0.5,0.2,chamfer=true)difference(){ // union(){ // //T(-d2/2,d+2)square([d2,l-d-2]); // //Rund(0.7,1.5) // { // //circle(d=d); // T(-dHals/2,0)square([dHals,halsL+d/2+1]); // T(-d2/2,halsL+d/2)square([d2,l[1]-d/2-halsL]); // // T(0,l[1])SBogen(l1=le-l[1]-l[0],l2=l[0],center=false,extrude=dHals/2,help=1,dist=d2/2+rand,grad=25); // } // } // if(konisch[1])T(d2/2,halsL+d/2)rotate(konisch[1])square([50,50]); // if(konisch[0])T(d2/2,le-distKonus)rotate(-konisch[0])square([50,50]); // //T(0,-d/2.2+1.25) // square([dHals-n(6)*2,500],true);//infill Wall // } if(other)%Cut(ghost=0){R(180)Base(); Tz(le)R(180)Ball(); } } }