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
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. klints2
    3. Best
    K
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 5
    • Best 1
    • Controversial 0
    • Groups 0

    Best posts made by klints2

    • RE: Export selected objects to separate files

      Well, I think found it.
      Don't perfect but its works

      import c4d
      import os
      from os.path import join, normpath
      from c4d import documents
      
      def export():
      
          dirpath = "c:/usr/temp/"  # temp directory
          global tdoc
          
          sobj = doc.GetActiveObjects(0)
          # isolate objects
          tdoc = c4d.documents.IsolateObjects(doc, sobj)
         
          # get path with object name
          full_dirpath = normpath(join(dirpath + (doc.GetActiveObjects(0)[0]).GetName() + ".obj"))
         
          # export to obj
          documents.SaveDocument(tdoc,full_dirpath,c4d.SAVEDOCUMENTFLAGS_0,1030178)        
      
      if __name__=='__main__':
          export()
      
          documents.KillDocument(tdoc)
      
      posted in Cinema 4D SDK
      K
      klints2