Duplicate Document [SOLVED]



  • On 20/05/2015 at 21:44, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   16 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hi,

    is there an easy way to duplicate my ActiveDocument?

    In my solution I have to iterate through all objects and append them to an objectlist and then use IsolateObjects().

    Thanks



  • On 20/05/2015 at 22:46, xxxxxxxx wrote:

    doc->GetClone(...)



  • On 21/05/2015 at 00:39, xxxxxxxx wrote:

    Hi crush4,
     
    what Niklas said! I'd also look into using AliasTrans when using GetClone() too. Helps relink everything back up. I'm sorry I can't provide an example, I haven't got any of that with me at the moment. Maybe this might help:
     
    https://plugincafe.maxon.net/topic/7461/9283_c4datomcopyto-and-aliastrans&KW=aliastrans
     
    WP.



  • On 21/05/2015 at 02:02, xxxxxxxx wrote:

    Yes usually you'd want to use an AliasTrans when cloning, but as far as I know and my experience goes,
    its not necessary for cloning a document. :)



  • On 21/05/2015 at 07:06, xxxxxxxx wrote:

    Thanks for the help! I used:

    BaseDocument *doc = GetActiveDocument();
      BaseDocument *temp = (BaseDocument* ) doc->GetClone(COPYFLAGS_0, NULL);

    temp->SetDocumentName("temp");
      InsertBaseDocument(temp);
      SetActiveDocument(doc);

    This works ;)



  • On 21/05/2015 at 07:28, xxxxxxxx wrote:

    Hi,

    just a small addition on AliasTrans from my side. Perhaps then it's a bit easier to understand, why it's not needed, when cloning documents.

    As WickedP already mentioned, it helps to to relink things...

    Let's assume you have a cube and an instance object, which is linked to the cube.

    If you now take these two objects and make a copy of both of them by ctrl-dragging them in the Object Manager, you will get the following result: Two cubes and two instance objects, both of them linked to the first cube.

    If you duplicate the two objects via Copy&Paste instead, the result will be a bit different. You will end up with two and the copy of the instance object will be linked to the copy of the cube.
    This behavior is realized via AliasTrans. Relinking of BaseLinks inside of a document.

    And as Cinema4D knows no "inter-document" links, there's no need for AliasTrans, when cloning documents.


Log in to reply