On 13/05/2017 at 05:28, xxxxxxxx wrote:
Hi,
I am stuck with something which should be quite simple and would really appreciate if someone can help me with it.
I just want to create a simple list of all the children of an object. I got the point you have to use a recursive loop and found this one (I have it on a script tag) :
def process_hierarchy(op) :
print op
op = op.GetDown()
while op:
process_hierarchy(op)
op = op.GetNext()
def main() :
process_hierarchy(op.GetObject())
When I define a list and append the children it is also reset at every round... (I get a list with just one child)
Here is what is not working:
def process_hierarchy(op) :
listChildren=[]
listChildren.append(op)
op = op.GetDown()
while op:
process_hierarchy(op)
op = op.GetNext()
print listChildren
Does anyone know how I can do this list?
Many thanks,
H.