THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/06/2011 at 14:34, xxxxxxxx wrote:
So as the title says I can't seem to add objects to a an InExcludeData list. Specifically to a tracer object 'Trace Link' list but for simplicities sake I'm testing with an Object Selection list. I've worked through the CG Rebel P4D 102 tutorial which gets me tantalizingly close, but I can't seem to seal the deal.
http://cgrebel.com/2011/01/p4d102-selected-objects/
I'm a novice to the C4DSDK and know just enough Python to be a little dangerous so I'm figuring things out as I go. This is the code I've got currently, which yields no errors but doesn't do what I want it to do. It's stripped down to it's bare bones, just working with two selected objects, the top an Object Selection object and the bottom just a Cube:
import c4d
from c4d import documents
def main() :
doc = c4d.documents.GetActiveDocument()
selected = doc.GetActiveObjects(0)
obj_list = selected[0][c4d.SELECTIONOBJECT_LIST]
obj = selected[1]
obj_list.InsertObject(obj,0)
c4d.EventAdd()
if __name__=='__main__':
main()