← Back to team overview

yade-users team mailing list archive

Re: [Question #702750]: How to detect the coordinates of each particle?

 

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

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,

> How do I get the coordinates of each particle?

it depends on the definition of "get".

You can print them in a for loop:
for b in O.bodies: print(b.state.pos)

You can get the coordinates e.g. as a list:
coords = [b.state.pos for b in O.bodies]

You can save them as a file:
yade.export.text("some_file_name.txt")

You can ...

> how do I know the z-value of the uppermost particle?

zMax = max(b.state.pos[2] for b in O.bodies)

Cheers
Jan

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