[SOLVED]Can i Isolate Each Object?

On 27/01/2017 at 04:56, xxxxxxxx wrote:

hi guys,
hope y'all are great are doing great,

So is it possible to  isolate each object?
because c4d.documents.IsolateObjects(doc, T_obj) dont work when using like this

    doc = c4d.documents.GetActiveDocument()
    if doc == None:
        return False
    # Get Models form the Object Manager
    objs = doc.GetActiveObjects(1)
    if not objs:
        gui.MessageDialog("Select objects")
        return False
    for E in objs:
        doctemp = c4d.documents.IsolateObjects(doc, E)
        if doctemp == None:
            return False

but it ask for all objects which is objs.
so it look this :

doctemp = c4d.documents.IsolateObjects(doc, objs)

and that what it likes but it do all of them , what i want is each object when execute.
so its like each object go in it own folder.

plz help and i hope this was understandable to y'all.
Thanks,
Cheers,
Ashton

On 27/01/2017 at 06:13, xxxxxxxx wrote:

The new doc created with isolateObject is not inserted in the list of user doc.
Here an exemple of something I wrote in 5 min and 3months ago(that mean he could have some errors and its not well documented...).

import c4d
import os
  
def main() :
    current_dir = doc.GetDocumentPath()
    buffer_path = None
  
  
    list_obj = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_0)
    if not list_obj:
        return
    
    new_doc = c4d.documents.IsolateObjects(doc, list_obj)
    c4d.documents.InsertBaseDocument(new_doc)
    if not current_dir:
	return
    buffer_path = os.path.join(current_dir,"file_buffer.c4d")
    c4d.documents.SaveDocument(new_doc, buffer_path, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, c4d.FORMAT_C4DEXPORT)
        
    path = c4d.storage.LoadDialog(flags = c4d.FILESELECT_DIRECTORY)
    if not path:
        return
    
    filename = c4d.gui.InputDialog("Nom du dossier", "Dossier")
    if not filename:
        return
    
    
    assets = list()
    missingAssets = list()
    path = str(os.path.join(path,filename))
    c4d.documents.SaveProject(new_doc, c4d.SAVEPROJECT_SCENEFILE | c4d.SAVEPROJECT_ASSETS | c4d.SAVEPROJECT_PROGRESSALLOWED | c4d.SAVEPROJECT_DIALOGSALLOWED | c4d.SAVEPROJECT_SHOWMISSINGASSETDIALOG, path, assets, missingAssets)
    
    if buffer_path:
        os.remove(buffer_path)
        
    if missingAssets:
        gui.MessageDialog("Missing Asset\n" + str(missingAssets))
  
  
    #c4d.documents.KillDocument(new_doc)
  
  
if __name__=='__main__':
    main()

On 27/01/2017 at 14:41, xxxxxxxx wrote:

Hi gr4ph0s

I like what your code is doing but its really like this:  
if I have 4 cubes in the scene , and select them I want them to export each object separately as a export file like .dae 
so i would have:
Cube.dae
Cube1.dae
Cube2.dae
Cube3.dae
in the folder I send it too.

problem is i need each object to Isolate it self and continue the process.

On 28/01/2017 at 13:44, xxxxxxxx wrote:

thanks I got it.:wink:
I was missing this :

        get_E = E.GetName()
        fobj = doc.SearchObject(get_E)
        sobj = doc.SetActiveObject(fobj)
        get = doc.GetSelection()
        new_doc = c4d.documents.IsolateObjects(doc, get)

cheers :slightly_smiling_face: