Finally, this is a script that creates caseless needle bearings, like this one:

In a shaft with a bit of color:

The function is called NB(outer radius, inner radius, width)

Code:

Code: Select all

```
import Part
import math
def NB(rout,rin,bth):
rnd=(rout-rin)/2.00
cnd=((rout-rin)/2)+rin
nnd=2*math.pi*cnd/(1.8*2*rnd) #Needle number
nnd=math.floor(nnd)
nnd=int(nnd)
#needle cage--------------
ncrout=cnd+0.175*(rout-rin)
ncrin=cnd-0.175*(rout-rin)
nc1=Part.makeCylinder(ncrout,bth)
nc2=Part.makeCylinder(ncrin,bth)
nc=nc1.cut(nc2)
#needle space on the cage-
rsnd=rnd*1.2
thsnd=bth*0.8
for i in range(nnd):
snd=Part.makeCylinder(rsnd,thsnd)
Alpha=(i*2*math.pi)/nnd
nv=(cnd*math.cos(Alpha),cnd*math.sin(Alpha),0.1*bth)
snd.translate(nv)
nc=nc.cut(snd)
#Needle creation----------
for i in range(nnd):
nd=Part.makeCylinder(rnd,thsnd)
Alpha=(i*2*math.pi)/nnd
nv=(cnd*math.cos(Alpha),cnd*math.sin(Alpha),0.1*bth)
nd.translate(nv)
Part.show(nd)
Part.show(nc)
Gui.SendMsgToActiveView("ViewFit")
```