A question about the function
Hello,
I try to define a function to caculate the distance of the pheres after they dropped the plank, but there are some error in my code, could someone can help me ?
Thanks a lot in advance.
ZDJ
*******code *********
##makeCloud####
sp=pack.
sp.makeCloud(
sp.toSimulation
###Function#####
def measureDis():
for i in sp:
cz = i.state.pos[2]
czmax = max(cz)
czmin = min(cz)
Dis = czmax - czmin
if unbalancedForce() < 0.3:
print 'the distance is:',Dis
*******error in screen *********
AttributeError Traceback (most recent call last)
/usr/bin/yade in <module>()
/usr/bin/yade in measureDis()
65 def measureDis():
66 for i in sp:
---> 67 cz = i.state.pos[2]
68 czmax = max(cz)
69 czmin = min(cz)
AttributeError: 'tuple' object has no attribute 'state'
But when I change the code of function like this:
###Function#####
def measureDis():
for i in sp:
cz = O.bodies(
czmax = max(cz)
czmin = min(cz)
Dis = czmax - czmin
if unbalancedForce() < 0.3:
print 'the distance is:',Dis
The error is below
*******error in screen *********
TypeError Traceback (most recent call last)
/usr/bin/yade in <module>()
/usr/bin/yade in measureDis()
65 def measureDis():
66 for i in sp:
---> 67 cz = O.bodies(
68 czmax = max(cz)
69 czmin = min(cz)
TypeError: 'BodyContainer' object is not callable
What should I do to correct it ? Thanks again.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Jan Stránský
- Solved:
- Last query:
- Last reply: