← Back to team overview

yade-users team mailing list archive

[Question #402260]: Rotate pack

 

New question #402260 on Yade:
https://answers.launchpad.net/yade/+question/402260

Hi,

I'm creating a regular Hexa pack inSphere and removing randomicaly some particles. But I also would like to rotate the pack in each simulation. As follow:

rad,gap=.0002,0 #particle radius and gap
r=random.uniform(rmin, rmax) #aggregate radius random according to the class defined
oriBody = Quaternion(Vector3(0,1,0),(pi/2)) #Rotation of the pack
ag = pack.regularHexa(pack.inSphere((0,0,r),r),oriBody,radius=rad,gap=gap,color=(0,0,1))

a = len(ag)
c = 0.25*a #percentage of maximum particle removal
d = 0.135*a #percentage of minimum particle removal
n=random.randint(int(d), int(c)) #number of spheres to exclude randomically

#randomly remove spheres from packing
for i in range(0,len(ag)-n):
	b = ag[random.randint(0,len(ag)-1)]
	O.bodies.append(b)
	ag.remove(b)

The script is working well, however when I insert the rotation it doesn't work. I've tried using "ag.toSimulation(oriBody)", but also didn't work.

Does someone know what is wrong?

Thanks a lot,
Luis

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