CINEMA 4D – Get Python Object/Tag ID

17 November 2015

One thing you will do over and over when scripting for Cinema 4D is look for Object and Tag Types.

These are accessed by a unique ID. This little script will help you find the correct Type ID, Name and Tag parent Object of selected Objects and Tags:

import c4d
from c4d import gui

def main():
#CallCommand(12305)
#CallCommand(13957)
#doc=GetActiveDocument()
obj=doc.GetActiveObject();

print "#############################"

if obj:
    print "Object:", obj#, obj.GetType(), obj.GetName()
else:
    print "no Object selected"

tag=doc.GetActiveTag();
if tag:
    print "Tag:", tag, " on Object: ", tag.GetObject()
else:
    print "no Tag selected"

print "#############################"

if __name__=='__main__':
main()

 

Alex - post author

Hi, I am Alex, a passionate Director and 3D Generalist currently working in an Animation Studio.

Leave a Reply

Notify of
avatar
Sort by:   newest | oldest | most voted
Aivaras
Guest

Hi Alex,
Thanks for this useful snippet, however, It’s broken due to missing indentation in your code.

wpDiscuz