I genereated a cylinder with spheres with the PsDSphereGenerator, and want to have the coordinates of all the centers of each sphere. How can I get a text file with all these coordinates? A similar question asked earlier for the spherocylinder case used the p.shape.endPt parameter to write out the point A and point B position. I want it the same way as in that case but now with the coordinates of the centers of spheres.
The code for spherocylinder points A and B that is analogous to what I want for the sphere case is the following:
with open('capsules.txt','w') as out:
for p in S.dem.par:
if not isinstance(p.shape,woo.dem.Capsule): continue
out.write('%g %g %g %g %g %g %g\n'%(a,a,a,b,b,b,r))
vtk(S) # trigger manually writing Paraview data files
# write paraview script and run it
I think there should be a 'center' parameter for this somehow, but didn't manage yet to write out these coordinates. Can someone help with this?
Thanks in advance :)