NewBie Question: ObjectHierarchie sorted

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 10/01/2005 at 05:40, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   8.50 
Platform:   Windows  ;   
Language(s) :   C.O.F.F.E.E  ;

---------
Hello,
i want to make a function which sort my doc new. I have many Objects with the same Name. They should be Grouped under a NullObject.
My Problem is that not all Objects were taken.
My function dosen't take Objects which are deeper in the Hierachie and I don't know why. Can anyone please help me?
Here is my function:
FindAndMove(ObName,NObName,op,doc){
var ...
parent = doc->FindObject(NObName);
while(op){
nam=op->GetName();
if(nam=ObName){
op->Remove;
op->InsertUnter(parent);
b=tostring(i);
b+=ObName;
//Rename the object, so that it would not be found a 2.time
op->SetName(b)
op->Message(MSG_UPDATE);
}
if(op->GetDown){
FindAndMove(ObName,NObName,op,doc);
}
op=op->GetNext();
}
}

Greetings Tim

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 14/01/2005 at 08:18, xxxxxxxx wrote:

If you're recursive function is too deep then there will be a stack error. You will have to turn one dimension of the recursion into a while-loop instead.

    
    
    Recurse(op)  
    {  
      while (op)  
      {  
        DoSomething(op);  
        Recurse(op);  
        op = op->GetNext();  
      }  
    }

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 17/01/2005 at 05:00, xxxxxxxx wrote:

Thanks,
i got an stack error. your functions works great!

Greetings...