Question #686692 on Yade changed:
https://answers.launchpad.net/yade/+question/686692

    Status: Open => Answered

Jan Stránský proposed the following answer:
a MWE:
#########
def randomOrientation(): # most likely not very well random, but for this 
example it is ok
   from random import random as r
   return Quaternion((r(),r(),r()),2*pi*r())

# create loose spherical packing using makeCloud
sp = yade.pack.SpherePack()
mi,ma = (0,0,0),(20,20,20)
nCyls,nSphs = 40,30
sp.makeCloud(mi,ma,rMean=2,rRelFuzz=.5,num=nCyls) # makeCloud for cylinders
sp.makeCloud(mi,ma,rMean=1,rRelFuzz=.5,num=nSphs) # makeCloud for spheres
for i,(pos,radius) in enumerate(sp):
   if i < nCyls: # add cylinder
      ori = randomOrientation()
      extents = (radius,.1*radius,.1*radius)
      O.bodies.append(box(pos,extents,ori))
   else: # add sphere
      O.bodies.append(sphere(pos,radius))
##########
there is no cylinder command in my yade, so I used box instead, but the idea 
should be clear.
cheers
Jan

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to