← Back to team overview

yade-users team mailing list archive

Re: [Question #667119]: how to specifically find interraction number of spheres to a body

 

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

    Status: Open => Answered

Jérôme Duriez proposed the following answer:
Hi,

To test whether a body is of spherical shape, you may use the general
Python function isinstance (that checks whether a particular Python
object is an instance of a particular class)

Example:

id = O.bodies.append(sphere(Vector3(0,0,0),1))
isinstance(O.bodies[id].shape,Sphere) # will return True

id = O.bodies.append(facet([Vector3(0,0,0),Vector3(0,1,0),Vector3(1,1,1)]))
isinstance(O.bodies[id].shape,Sphere) # will return False

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