yade-users team mailing list archive
Mailing list archive
Re: [Question #677828]: creat many polyhedra in a box
Question #677828 on Yade changed:
Status: Open => Answered
Jan Stránský proposed the following answer:
> list = ...
although might work, I suggest not to use python built-in types (list,
tuple, set, int...) as variable names
sp.makeCloud(...) modifies the 'sp' object. It returns number of created spheres, but the sp variable (SpherePack instance) is important for you.
you create t=polyhedra only once, so O.bodies.append the same body object would be an error anyway
> i want to creat many polyhedra in a box with same size
then do not use rRelFuzz for makeCloud (controls size distribution of created spheres)
ployhedra_utils.polyhedra: if v parameter is used, size is ignored
from yade import pack, polyhedra_utils
polyMat = PolyhedraMat()
#replace the sphere with polyhedra
for center,radius in sp:
# note: new polyhedron for each cycle
t = polyhedra_utils.polyhedra(polyMat,(radius,radius,radius))
t.state.pos = center # sets polyhedron position according to sphere position
You received this question notification because your team yade-users is
an answer contact for Yade.