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

Jan Stránský proposed the following answer:
> No, it will still report errors mentioned above.
> Yes, that's the error

It is a good habit to read error messages.
Even if you do not fully understand them, you should be able to distinguish 
that it is different error.

> I don't have a way to solve it.

The error gives you exact line where the problem is.
Even if you do not fully understand the error, there are some clues making it 
possible for you to solve it yourself with just a little debugging.

The keywords of the error message are "Body", "int", "Material".
Combining this info with the error line
O.bodies[body].material = mat2
it is not difficult after some debugging (a few print(...) is sufficient) to 
realize that mat2 is int.

In an independent Yade session you can test something like:
###
b = sphere((0,0,0),1)
print(b.material)
b.material = FrictMat() # OK
b.material = 1 # the same error message
###

Similarly to bodies, material and its ID is unique pair.
Similarly to O.bodies.append, O.material.append returns material ID, not 
material itself

So either use this pattern for materials
###
mat = SomeMat(...)
matID = O.materials.append(mat)
###
or
###
matID = O.materials.append(...)
mat = O.materials[matID]
###

Cheers
Jan

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

_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to