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. Posts
    K
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 5
    • Best 1
    • Controversial 0
    • Groups 0

    Posts made by klints2

    • RE: Export selected objects to separate files

      Hi @m_adam, thanks for you correction and advice, it's really usefull for me. I'm learn python just couple month and not sure in my code yet.

      • yeah i'm missed this mistake
        full_dirpath = normpath(join(dirpath, (doc.GetActiveObjects(0)[0]).GetName() + ".obj"))

      Thanks one more time, always good to have help and support!

      posted in Cinema 4D SDK
      K
      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
    • RE: Export selected objects to separate files

      @mikeudin Thanks, but don't undestand how works this command, i was tried to get list from isolated = c4d.documents.IsolateObjects(doc, selected) but it's give me nothing and i can't use for for it.
      How do i can exported only selected list to obj, without dialog windows?

      Sorry this is my first script for c4d, i'm maya user and little confused. Thanks

      posted in Cinema 4D SDK
      K
      klints2
    • RE: Export selected objects to separate files

      Whos knows any solution for it?

      posted in Cinema 4D SDK
      K
      klints2
    • Export selected objects to separate files

      Hello guys,

      I wrote small script and got one problem. I can't export selected objects to separate files, after export operation i got obj files with duplicate meshes inside. Which the command do i must use for it?

      import c4d
      import os
      from os.path import join, normpath
      
      dirpath = "c:/usr/temp/mayablender/"
      
      def main():
          doc = c4d.documents.GetActiveDocument()
          selected = doc.GetActiveObjects(0)
      
       
          for ob in selected:
              ob.DelBit(c4d.BIT_ACTIVE) 
              doc.SetActiveObject(ob)        
                         
              
              full_dirpath = normpath(join(dirpath + ob.GetName() + ".obj"))
      
              # export to obj
              c4d.documents.SaveDocument(doc,full_dirpath,c4d.SAVEDOCUMENTFLAGS_0,1030178)
              
      
      
      if __name__=='__main__':
          main()
      
      
      posted in Cinema 4D SDK
      K
      klints2