ricksilliker
10-04-2012, 05:28 PM
Hi All,
So I have have been running through the help docs for the sdk, and I cannot seem to find any sort of parent function for python. I have a feeling it is GeListNode.InsertUnder(), but I cannot seem to get it to work for the life of me. Mostly because I am having a hard time understanding the help docs and their descriptions. Here is my simple script so far. (Trying to group objects).
import c4d
#===================
def groupIt(doc, op):
doc.SetActiveObject(op)
xName = c4d.BaseList2D.GetName(x) #gather obj name
drive = c4d.BaseObject(c4d.Onull) #create drive null
doc.InsertObject(drive) #insert drive null
drive[c4d.ID_BASELIST_NAME] = xName + "_DRIVE" #name drive null
c4d.GeListNode.InsertUnder(drive(x)) #parent object under drive null
if __name__=='__main__':
doc = c4d.documents.GetActiveDocument()
selected = doc.GetActiveObjects(0)
for x in selected:
groupIt(doc, x)
c4d.EventAdd()
Any assistance or push in the right direction would be great.
Rick
So I have have been running through the help docs for the sdk, and I cannot seem to find any sort of parent function for python. I have a feeling it is GeListNode.InsertUnder(), but I cannot seem to get it to work for the life of me. Mostly because I am having a hard time understanding the help docs and their descriptions. Here is my simple script so far. (Trying to group objects).
import c4d
#===================
def groupIt(doc, op):
doc.SetActiveObject(op)
xName = c4d.BaseList2D.GetName(x) #gather obj name
drive = c4d.BaseObject(c4d.Onull) #create drive null
doc.InsertObject(drive) #insert drive null
drive[c4d.ID_BASELIST_NAME] = xName + "_DRIVE" #name drive null
c4d.GeListNode.InsertUnder(drive(x)) #parent object under drive null
if __name__=='__main__':
doc = c4d.documents.GetActiveDocument()
selected = doc.GetActiveObjects(0)
for x in selected:
groupIt(doc, x)
c4d.EventAdd()
Any assistance or push in the right direction would be great.
Rick
