Export a single object

On 29/07/2014 at 05:29, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   14 
Platform:      Mac OSX  ; 
Language(s) :     C++  ;

I would like to export a single object to disk, in .OBJ format.
To export in .OBJ format I can use the SaveDocument command, I believe.
But to save just one object, not the entire scene, must I create a temporary document and save that? Should I use the IsolateObjects command to do so?

On 29/07/2014 at 07:13, xxxxxxxx wrote:

Hello Rui,

i did the same thing once and i did i just created a temp document and inserted the object into it, then exported the temp doc into the desired file-format.

I have never used IsolateObjects yet, but it looks like it does the same thing, so it should work as well.


On 29/07/2014 at 07:44, xxxxxxxx wrote:

Thank you very much, Daniel. I will try it out, as soon as I get back from vacation.

Rui Batista

On 29/07/2014 at 08:25, xxxxxxxx wrote:


i just checked my code from back then and it looks like i actually *did* use the IsolateObjects function..

here's an example of how it should work:

    static void exportSelected(BaseDocument* doc, Filename exportFileName){	
    	if(!doc) return;
    	// get all selected objects		
    	AtomArray* ar = AtomArray::Alloc();
    	if(ar->GetCount()<1) return;
    	// copy all objects in Array 'ar' to tmpDoc
    	BaseDocument* tmpDoc = IsolateObjects(doc,*ar);
    	// save doc to file
    			GePrint("exported selected objects to file "+exportFileName.GetFileString());
    		else GePrint("could not export selected objects to file "+exportFileName.GetFileString());

On 29/07/2014 at 09:12, xxxxxxxx wrote:

WOW! Great. Your code will be of great help.
Thank you, Daniel.