← Back to team overview

yade-users team mailing list archive

Re: Get sphere radius from bodies

 

Thanks a lot!
______________________________


Anton Gladkyy


2009/11/30 Václav Šmilauer <eudoxos@xxxxxxxx>

>
> > Hi, all!
> >
> > Sorry for a simple question, but how can I get sphere radius from
> > bodies?
> > I can get sphere position as O.bodies[0].state.pos[0], but what about
> > radius?
> O.bodies[0].mold['radius'] (if it is a sphere, otherwise you get
> KeyError).
>
> The confusing thing is that InteractingGeometry is called "mold", based
> on my original simplification proposal: GeometricalModel->Shape,
> InteractingGeometry->Mold; since GeometricalModel is gone now, let's
> call it geom. It is more readable and there is no problem having both
> anyways.
>
> I added a "geom" alias for mold in last commit, so you can use
> O.bodies[0].geom['radius'] instead.
>
> PS. You can test sphericity in several ways:
>
> if O.bodies[0].geom.name=='Sphere' # test name of the InteractingGeometry
> instance
> 'radius' in O.bodies[0].geom.keys()  # tests presence of the radius
> attribute
> if O.bodies[0].geom.has_key('radius') # this one should be a little faster
>
> Cheers, Vaclav
>
>
>
> >
> > Thank you.
> >
> > ______________________________
> >
> > Anton Gladkyy
> > _______________________________________________
> > Mailing list: https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
> > Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
> > More help   : https://help.launchpad.net/ListHelp
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
> Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References