Error when copying...

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

On 11/03/2003 at 01:42, xxxxxxxx wrote:

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

---------
Hi,
When I try to copy an object using GetClone() function, my C4D, gave Illegal Performance and shuts down the application. Where am I doing wrong?

    
    
    
    
    var CurrentDoc = GetActiveDocument();  
    
    
    
    
    
    var objFile = GeGetRootFilename();  
    objFile->RemoveLast();  
    objFile->AddLast("diamond.c4d");
    
    
    
    
    var doc = LoadDocument(objFile);
    
    
    
    
    var DiamondDoc = GetActiveDocument();
    
    
    
    
    var Obj=DiamondDoc->GetFirstObject();
    
    
    
    
    if (Obj)
    
    
    
    
    {  
       var Obj1 = Obj->GetClone(0);  
       CurrentDoc->InsertObject(Obj1,NULL,NULL);
    
    
    
    
       DiamondDoc->Remove();  
       DiamondDoc=NULL;
    
    
    
    
     }  
    
    
    
    
    
    GeEventAdd(DOCUMENT_CHANGED);
    
    
    

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

On 11/03/2003 at 11:43, xxxxxxxx wrote:

I think the problem comes from the line **DiamondDoc- >Remove();
**The Remove() function works with objects, but it doesn't close a C4D document, it crashs C4D
I think your goal is to open a C4D file (DiamondDoc), copy the first object in the actual projet (CurrentDoc), then close the last opened document.
I don't know if there is a way to close a project in COFFEE...

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

On 11/03/2003 at 23:39, xxxxxxxx wrote:

Even I remove **DiamondDoc- >Remove(); **statement, still I am facing the same pbm.

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

On 18/03/2003 at 10:16, xxxxxxxx wrote:

H.G. Seib posted some code for merging documents some time ago: http://www.plugincafe.com/forum_browse.asp?messageID=883. Please give it a try.