← Back to team overview

yade-users team mailing list archive

Re: [Question #404417]: Generate a specific number of spheres in the empty spaces of a created loose pack

 

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

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hi Amir,
thanks for the script, revealing the problem (which would be very difficult
without the scripts). The problem is in your 2nd script:

sp = pack.SpherePack([(b.state.pos,b.shape.radius) for b in O.bodies if
> isinstance (b.shape,Sphere)])
> print len(O.bodies)
> sp = pack.SpherePack() # TO BE DELETED, DO NOT CREATE NEW SpherePack !
> sp.makeCloud((0,0,0.0),(0.01,0.01,0.01),rMean=r2,num=10)


once you create sphere pack from existing particles (first "sp = ..."), do
not create another spherePack, since then sp variable is somathing
completely different and you would lose your particles (as you experience
now).

sp = SpherePack()
sp.fromSimulation() # a more elegant way instead
of pack.SpherePack([(b.state.pos,b.shape.radius) ...)
sp.makeCloud((0,0,0.0),(0.01,0.01,0.01),rMean=r2,num=10)
# ... delete existing spheres OR O.clear(); O.bodies.append(facetBox(...))
sp.toSimulation()

cheers
Jan

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