yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #19504
Re: [Question #680258]: how to replace particle
Question #680258 on Yade changed:
https://answers.launchpad.net/yade/+question/680258
Status: Open => Answered
Jan Stránský proposed the following answer:
Hello,
I don't know about any pre-defined function. But it is not difficult:
###
bID = ... # id of existing particle
b = O.bodies[bID] # body instance
pos,r = b.state.pos, b.shape.radius # position and radius
b2 = createDuplicate(pos,2*r) # define this function according to your needs
O.bodies.erase(bID) # delete existing particle
newID = O.bodies.append(b2) # and adds new particle. Note that ID is different
def createDuplicate(pos,size): # for example
from yade import polyhedra_utils
return polyhedra_utils.polyhedralBall(.5*size,30,mat,pos)
###
cheers
Jan
--
You received this question notification because your team yade-users is
an answer contact for Yade.