THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/12/2010 at 16:25, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12
Platform:
Language(s) : PYTHON ;
---------
I have been trying create a script to access 3 link fields I added as user data to a python object. I seem to be able to get a container of all the user data using the op.GetUserDataContainer() command, but i cant seem to figure out how to use the tuples of data it spits out to get the position of the linked objects. i have a feeling im going about this completely wrong, so any help would be greatly appreciated.
when i put this code into my python object:
import c4d
from c4d import utils
def main() :
UserData = op.GetUserDataContainer()
print UserData
the console prints out :
[((1, 133, 0), <c4d.BaseContainer object at 0x0000000016616308>), ((2, 133, 0), <c4d.BaseContainer object at 0x0000000016616260>), ((3, 133, 0), <c4d.BaseContainer object at 0x00000000166162D0>)]
and when i try to get individual elements using the __getitem__(0) :
def main() :
UserData = op.GetUserDataContainer()
obj1 = UserData.__getitem__(0)
print obj1
it prints out:
((1, 133, 0), <c4d.BaseContainer object at 0x0000000016616308>)
ok, so far so good.
but when i try to access that object's position:
def main() :
UserData = op.GetUserDataContainer()
obj1 = UserData.__getitem__(0)
obj1_pos = obj1.GetRelPos()
print obj1_pos
I get this error:
Traceback (most recent call last) :
File "<Python Generator>", line 9, in main
AttributeError: 'tuple' object has no attribute 'GetRelPos'
thanks in advance for any help! I'm a noob to all of this.