← Back to team overview

yade-users team mailing list archive

Re: [Question #703098]: Trying to pass on property from python to shape

 

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

    Status: Open => Answered

Karol Brzezinski proposed the following answer:
Hi Danny,

are you sure that you need to modify the *.hpp file? You can add a new
property to the body directly from Yade (Python) console. Since you are
modifying the utils file, I guess that your function is pure Python. Try
this:

####
bid = O.bodies.append(sphere((0,0,0),1)) 
b = O.bodies[bid]
b.shape.myProperty = Vector3(1,2,3) 
print(b.shape.myProperty)
####

The disadvantage of this approach is that the property won't be saved by
O.save function.

Cheers,
Karol

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