← Back to team overview

yade-users team mailing list archive

Re: [Question #294531]: Change colour of spheres when based on Movement

 

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

    Status: Answered => Open

Clinton Schramm is still having a problem:
Hi Jan

I have tried to implement what you said, but get the error "State object
has no attribute 'Pos'

Could you give an example on how to reference this correctly. Ideally I
would like to see the colour change based on the cummunulative
displacement from a certain point. (When the translation engine begins)

def checkUnbalancedtunnelmovement():
   global voidcheck
   if voidcheck==2:
	O.engines=O.engines+[TranslationEngine(translationAxis=[0,1,0],velocity=0.05,ids=TBM)]
        for s in O.bodies:
    		s.state.refPos[1]=s.state.Pos[1]
	O.engines=O.engines+[PyRunner(command='Changecolor()',iterPeriod=200)]
	print O.engines, '2'
	voidcheck=1
 	# start plotting the data now, it was not interesting before
   	#O.engines=O.engines+[PyRunner(command='addPlotDataForceTunnel()',iterPeriod=200)]
   checker.command='calculateforces()'


def Changecolor():    
   for s in O.bodies:
		s.shape.color=scalarOnColorScale(s.state.displ().norm(),0,.7) # for changing color based on the movement of sheres.

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