THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/11/2012 at 01:34, xxxxxxxx wrote:
Selecting all children in a Root Null-Object.
I was trying to make it happen but I guess this is a logic problem I need your help.
at the moment i use the callcomand but i guess this is not the fasted solution to select all children in a Null-Object.
c4d.CallCommand(100004768) # Unterobjekte selektieren - select children
c4d.CallCommand(16768) # Objekte verbinden + Löschen Connect and delete
On 26/11/2012 at 10:50, xxxxxxxx wrote:
If you need to select all children you need to
use a recursive function such as below.
To keep the selection to the hierarchy of the
selected object, you add a obj.GetNext() so it
knows where to stop (or it would select everything
from selected object to the end of the OM.
from c4d import gui
def selchildren(obj,next) : # Scan obj hierarchy and select children
while obj and obj != next:
obj = obj.GetNext()
def main() :
try: obj = doc.GetActiveObjects(False)
except: return True # Nothing Selected
if selchildren(obj,obj.GetNext()) :
c4d.CallCommand(16768) #Connect And Delete
On 26/11/2012 at 23:53, xxxxxxxx wrote:
Thanks tcastudios, this is about 60% faster then the callcomand exactly what i needed.
just to understand your code: you are calling the function from itself? with different parameters? thats crazy stuff
also this line buffles me : try: obj = doc.GetActiveObjects(False)
does this read like "Try to set OBJ, and if 0 set to False"
much more to learn young jedi
kind regards mogh