yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #05464
[Question #186384]: O.bodies.shape ?!
New question #186384 on Yade:
https://answers.launchpad.net/yade/+question/186384
Hello,
I am facing some troubles with a function:
def get_z_o_and_z_u():
rad_sum = 0.0
he_real = 0.0
for ii in sphID:
rad_sum = rad_sum + O.bodies[ii].shape.radius
bh = O.bodies[ii].state.pos[2]
if bh > he_real:
he_real = bh
he_eff = he_real + O.bodies[ii].shape.radius
r_d = rad_sum/sum_spheres
# determine clump dimensions:
z_o = he_eff
z_u = z_o-6*r_d
where sphID is the list of all sphere IDs.
Error message:
File "/home/me/YADE/YADE2989/bin/yade-bzr2989", line 183, in runScript execfile(script,globals())
File "4-simulate-depth.py", line 11, in <module> get_z_o_and_z_u()
File "userinput.py", line 134, in get_z_o_and_z_u
rad_sum = rad_sum + O.bodies[ii].shape.radius
AttributeError: 'NoneType' object has no attribute 'shape'
I am wondering, because this function works (no Error message):
def updSph(rad=1.0):
i = 0
for ii in sphID:
tempID = O.bodies.append(utils.sphere([O.bodies[ii].state.pos[0],O.bodies[ii].state.pos[1],O.bodies[ii].state.pos[2]], material=O.bodies[ii].material.id, radius=O.bodies[ii].shape.radius*rad, wire=False, highlight=False))
sphID[i] = tempID
O.bodies.erase(ii)
i+=1
Does anyone know why this happens?
Thanks,
Christian
--
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.