How to distinguish sphere and polyhedra in a binary particle system

Asked by lip on 2019-07-11

hello
i am doing a deposit simulation contained both sphere and polyhedra, and the numble is large, i want to calculate the volume of sphere and polyhedra separately, but i do not know how to distinguish polyhedra and sphere, can you give me some advice?
looking forward for your answer.

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
2019-07-11
Last reply:
2019-07-11
Jérôme Duriez (jduriez) said : #1

Hi,

You can test the (class of) bodies' shape like with any other Python object:

isinstance(b.shape,Sphere) # b is a body
or
isinstance(b.shape,Polyhedra)

isinstance is a general Python function that will return True or False

Can you help with this problem?

Provide an answer of your own, or ask lip for more information if necessary.

To post a message you must log in.