get informations from clumps (O.bodies.shape.members)

Asked by Christian Jakob on 2012-04-20

Hi everyone,

I need some informations from a clump. All informations are stored in O.bodies[clump_id].shape.members as follows:

{‘id1’:(relPos,relOri) , ‘id2’:(relPos,relOri)}
    | | |
  int Vector3 Quaternion

How can I get for example relPos out of this? And also how can I get an id?

Regards,

Christian

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Christian Jakob
Solved:
2012-04-20
Last query:
2012-04-20
Last reply:
Christian Jakob (jakob-ifgt) said : #1

Found out, that

b = O.bodies[clump_id]

id_member1 = b.shape.members.keys()[0]
position_member1 = b.shape.members[id_member1][0]
orientation_member1 = b.shape.members[id_member1][1]

will do what I want.

Klaus Thoeni (klaus.thoeni) said : #2

Hi Christian, you could just use:

O.bodies[clump_id].shape.members[bodyid][0]
O.bodies[clump_id].shape.members[bodyid][1]

to get relPos and relOri of bodyid respectively.

Klaus

On Fri, 20 Apr 2012 05:35:38 PM Christian Jakob wrote:
> Question #194186 on Yade changed:
> https://answers.launchpad.net/yade/+question/194186
>
> Status: Open => Solved
>
> Christian Jakob confirmed that the question is solved:
> Found out, that
>
> b = O.bodies[clump_id]
>
> id_member1 = b.shape.members.keys()[0]
> position_member1 = b.shape.members[id_member1][0]
> orientation_member1 = b.shape.members[id_member1][1]
>
> will do what I want.

Christian Jakob (jakob-ifgt) said : #3

Thanks Klaus,

... and bodyids one gets with .members.keys()