Access object attributes with Python



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/12/2010 at 08:16, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   12 
    Platform:      
    Language(s) :       PYTHON  ;

    ---------
    Hi all,

    just a simple question: how can I access an object attribute in Python? In Coffee it was something like object#ATTRIBUTE_ID, with the id automatically written by a drag and drop from the attribute's field. Is there something similar in Python?

    Thanks

    Riccardo



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/12/2010 at 08:25, xxxxxxxx wrote:

    Hello cosmodrome,

    You can also drag&drop the attribute in to the python-console.
    To access an example: obj[c4d.PRIM_CUBE_SUBX]=10



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/12/2010 at 08:58, xxxxxxxx wrote:

    Thank you for your answer.

    In fact my problem was more general, because in Coffee the variable "op" is a reference to the object the Coffee tag is applied, whereas in Python - as I just discovered - op is a reference to the tag itself, so I had to write something like:

    obj = op.GetObject()
    obj[c4d.ATTRIBUTE_ID] = 10

    and that way it works :)

    Riccardo


Log in to reply