← Back to team overview

yade-users team mailing list archive

Re: [Question #235985]: Highest clump position in clump cloud

 

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

Sergio posted a new comment:
Hi Christian,

Thank you for your comment. The loops taking in care the colors seems a
very good idea!

I have tried to implement it, but the results are not as expected. I
have write the following function (called by a Pyrunner):

def alturasMaximasCapas():
	for b in O.bodies:
		if b.isClump==True and b.shape.color==(0.3,0.9,1):
			maxHeight1=max(maxHeight1,b.state.pos[1])
			print maxHeight1
		elif b.isClump==True and b.shape.color==(0.9,0.2,1):
			maxHeight1=max(maxHeight1,b.state.pos[1])
			print maxHeight2
		elif b.isClump==True and b.shape.color==(0.3,0.2,0.1):
			maxHeight1=max(maxHeight1,b.state.pos[1])
			print maxHeight3

But I have no output about any maxHeightX. If I try to call maxHeight1 in terminal, it returns 'name 'maxHeight1' is not defined'
If I give a  initial value out of the def function, i.e. maxHeight1=-1000 to ensure it has to change, the terminal returns the initial value without any change.

I don't know where the problem could be. It is the first time I use a
Python based program, so I have no knowledge of this programming
language. :(

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.