Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Duplicate Document [SOLVED]

    SDK Help
    0
    6
    492
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        doc->GetClone(...)

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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://developers.maxon.net/forum/topic/7461/9283_c4datomcopyto-and-aliastrans&KW=aliastrans
           
          WP.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            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. 🙂

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              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 😉

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                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.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post