Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    How to activate the recent Saved Document

    Cinema 4D SDK
    python r25
    2
    3
    414
    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.
    • M
      mogh
      last edited by mogh

      Dear Developers,

      I have a python script which saves the unsaved (untiteled) active document to a *_imported.c4d file which works fine, but Cinema still has the original "Untiteled" Filename active how can I activate the successfully saved file in Cinema 4D and discard the "untiteled"

      thanks in advance.

      here is my save method:

          def savedoc(self, doc):
              c4d.StatusSetText ('Saving Document.')
      
              path = self.folderpath
              if doc.GetDocumentPath():
                  path = doc.GetDocumentPath()
      
              name = doc.GetDocumentName()    
              # an unsaved doc has no extension we have to check
              if name[-4:] == ".c4d":            
                  newname = name # the user has his own document we dont change the name
              else:
                  newname = name + "_imported.c4d" # the user has no document we give a little context
                  
                  # c4d does not update to _imported.c4d doc.
                  #doc.SetName(newname)            
                  #c4d.documents.SetActiveDocument(doc) 
                  
              filename = os.path.join(path, newname)
              
              print ("Saving file to: ",  filename)        
              c4d.documents.SaveDocument( doc, filename,                                     c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST | c4d.SAVEDOCUMENTFLAGS_DIALOGSALLOWED, format=c4d.FORMAT_C4DEXPORT)
      
      fwilleke80F 1 Reply Last reply Reply Quote 0
      • fwilleke80F
        fwilleke80 @mogh
        last edited by

        @mogh Did you try doc.SetDocumentName(newname)?

        www.frankwilleke.de
        Only asking personal code questions here.

        1 Reply Last reply Reply Quote 1
        • M
          mogh
          last edited by

          No stupid me,
          overlocked this ... thanks for the hint Frank.

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