Question #235985 on Yade changed: https://answers.launchpad.net/yade/+question/235985
Status: Answered => Solved Sergio confirmed that the question is solved: Thank you very much again, Bruno! Finally, I could make a function that solves my problem: def altCapas(): global maxHeight1 global maxHeight2 global maxHeight3 for b in O.bodies: if b.shape.color==(0.3,0.9,1): maxHeight1=max(maxHeight1,b.state.pos[1]) elif b.shape.color==(0.9,0.2,1): maxHeight2=max(maxHeight2,b.state.pos[1]) # print 'Maximum height layer 2:',maxHeight2 # print 'Position y: ', b.state.pos[1] elif b.shape.color==(0.3,0.2,0.1): maxHeight3=max(maxHeight3,b.state.pos[1]) print 'Maximum height layer 1:',maxHeight1 print 'Maximum height layer 2:',maxHeight2 print 'Maximum height layer 3:',maxHeight3 print 'The number of particles that exceed the limit is: ', numOfPart maxHeight1=-500 maxHeight2=-500 maxHeight3=-500 Now it works. I tried to use the 'return', but I did'n achieved a good results. Thank you again Christian and Bruno for your help ;) -- You received this question notification because you are a member of yade-users, which is an answer contact for Yade. _______________________________________________ Mailing list: https://launchpad.net/~yade-users Post to : yade-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp