yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #14281
Re: [Question #517125]: How to set an correct Id of a particle assembly
Question #517125 on Yade changed:
https://answers.launchpad.net/yade/+question/517125
Jan Stránský proposed the following answer:
Hi Huihuang,
randomDensePack returns list of spheres. To handle all the spheres, you
have to iterate over the list, see 1).
if you O.bodies.append with one particle, its ID is returned. If you append
more bodies, their IDs are returned as a list. Again, iteration is needed,
see 2)
1)
ball_id = O.bodies.append(...)
ball = O.bodies[ball_id]
for i in ball:
b = O.bodies[i]
b.state.... = ...
2)
cube=pack.randomDensePack(...)
O.bodies.append(cube)
for b in cube:
b.state.blockDOFs='xyzXY'
b.state.vel=(0,0,-0.1)
cheers
Jan
--
You received this question notification because your team yade-users is
an answer contact for Yade.