yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #12785
Re: [Question #294531]: Change colour of spheres when based on Movement
Question #294531 on Yade changed:
https://answers.launchpad.net/yade/+question/294531
Status: Open => Answered
Jan Stránský proposed the following answer:
Hello,
Yade (Python) goes through the script and executes line by line. If you
have it like that in your script (once), then it is executed just once.
To execute is regulary, use PyRunner [1] in your engines:
#########################
def colorSpheres():
for s in O.bodies:
s.shape.color = ....
O.engines = [
...
PyRunner(iterPeriod=100,command="colorSpheres()"), # you can use
realPeriod or virtPeriod instead of irerPeriod
]
#########################
cheers
Jan
[1] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.PyRunner
2016-05-28 12:56 GMT+02:00 Clinton Schramm <
question294531@xxxxxxxxxxxxxxxxxxxxx>:
> New question #294531 on Yade:
> https://answers.launchpad.net/yade/+question/294531
>
> Hey Guys
> New to Yade, been building a model for a tunnel simulation. What i'm
> trying to acheieve is have the spheres change colour based on there
> displacement so that I can see where the movement is occuring. Not sure if
> it's necessary to post the whole code?
>
> Right now the line I am using is
>
> for s in O.bodies:
>
> s.shape.color=scalarOnColorScale(0.1*s.state.displ().norm(),0,0)
>
> What currently happens is the spheres change colour, but only initially.
> Is this the right code to do that? Could someone explain what this code is
> actually doing?
>
>
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>
--
You received this question notification because your team yade-users is
an answer contact for Yade.