← Back to team overview

yade-users team mailing list archive

Re: [Question #659211]: Fixing spheres

 

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

Jan Stránský posted a new comment:
Hi Mihsen,

>  if isinstance(b.shape,Clump):

yes, I guess this condition could be important :-) next time, please
post complete code, this could have been guessed directly from it

> BWT, why the YADE did not show any error due to b.vel ?!!

Becasue in Python, Body is (almost) just a Python object (instance of a
class), so you can assign not reserved names. Actually it can be a nice
feature, you can e.g. label particles which macrograin they belongs to,
like in [1], Body.agglomerate is id of a macro grain.

just some playing:

in Python:
###
class A:
   def __init__(self,a):
      self.a=a
a = A(2)
print a.a # sbould be 2
a.a = "hello"
print a.a # sbould be "hello"
a.whatever = 123 # valid assignment of new "whatever" member
###

the same with Body:
###
b.vel = "aaa" # valid, since Body.vel is nothing yet
b.state.vel = "aaa" # error, because state.vel is defined in c++ and should be Vector3
###

cheers
Jan

[1] https://github.com/yade/trunk/tree/master/examples/agglomerate

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