← Back to team overview

yade-dev team mailing list archive

Re: acces to sphere/wall information

 

Concerning the python way to access body's geometry, I tried what you
suggested but when I do this

for i in O.interactions:
    if not i.isReal : continue
    if O.bodies[i.id1].shape=='Facet' or O.bodies[i.id2].shape=='Facet':
        print O.bodies[i.id1].shape, O.bodies[i.id2].shape

it seems like if the test is never true, which is not the case if I do the
test with the "real" id of the Facet (identify through the xml file for
example):

for i in O.interactions:
    if not i.isReal : continue
    if id.id1==FacetId or i.id2==FacetId:
        print O.bodies[i.id1].shape, O.bodies[i.id2].shape

But maybe I am in a dead end because, in fact, I would like to assign a
parameter to the identified bodies like this (remaining in the loop on
interactions)

O.bodies[i.id1].shape['diffuseColor']=(1,0,0),
O.bodies[i.id2].shape['diffuseColor']=(1,0,0)

and I get this message

SyntaxError: can't assign to literal

which means that I probably do not play with the right entity... Do you have
any advice? I am stucked...


  Luc

2009/12/17 Václav Šmilauer <eudoxos@xxxxxxxx>

> > >
> > >   int sphereIds=Sphere::getClassIndexStatic();
> > >
> > >
> > Emanuele just showed me that this member is private currently.
>
> Ah, sorry. I wrote that from the top of my head. We can make it public,
> I don't see problem with that (classes create their indices in the ctor,
> which is called at startup anyway; so there is no risk of getting -1, I
> think.
>
> Can you change that to public? Go lib/multimethods/Indexable.hpp, it is
> the first thing under REGISTER_CLASS_INDEX definition.
>
> BTW just checking that the Sphere ctor taking radius doesn't call
> createIndex(), which could have disastrouc consequences (not disastrous
> like earthquake, but crashing the code).
>
> Regards, v.
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-dev<https://launchpad.net/%7Eyade-dev>
> Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-dev<https://launchpad.net/%7Eyade-dev>
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References