MoI discussion forum
MoI discussion forum

Full Version: FBX multiple objects export to separate files.

Show messages:  1-14  15-27

From: Anton.Berezin (ANTONBEREZIN)
18 Nov 2020   [#15] In reply to [#14]

Hi.
I used this script which exporting all objects to AI* files, but all objects (fit to page). I used 3d viewport.
I think it will be good idea if it exporting each object + one test object( named "scale") maybe just line or rectangle.

This will allow the save scale of the objects relative to the test object and to each other

Could you help me to add this function to script?

Thanks


From: Michael Gibson
18 Nov 2020   [#16] In reply to [#15]
Hi Anton, are you exporting a 3D perspective view? Because if so the length of a line with perspective applied will not be able to give a scale factor like that.

- Michael
From: Anton.Berezin (ANTONBEREZIN)
18 Nov 2020   [#17] In reply to [#16]

Please check my images maybe it will be more clear.
Thanks.

Image Attachments:
image-01.png  image-02.png 


From: Michael Gibson
18 Nov 2020   [#18] In reply to [#17]
Hi Anton, so if I understand right you want the line to establish a common page width?

Is the script you are using the "ExportNamedObjectsToIndividualFiles.js" from above in this thread (http://moi3d.com/forum/index.php?webtag=MOI&msg=8226.8) ?

Do you want something like the line has a certain name and the script will export that additionally to each file?

So in the script ExportNamedObjectsToIndividualFiles.js, on line 36 it has this currently:

code:
for ( var name in named_objs )
{
	// Clear the selection and then set all objects of this name to be selected.
	moi.geometryDatabase.deselectAll();
	named_objs[name].setProperty( 'selected', true );


So if you want the line to export with each file, it could go like this:

code:
for ( var name in named_objs )
{
	// Clear the selection and then set all objects of this name to be selected.
	moi.geometryDatabase.deselectAll();
	named_objs[name].setProperty( 'selected', true );

// new code here:

	var line_name = 'reg_line';
	if ( name == line_name )
		continue; //  Don't export the line all by itself.

	// select the line so it will export.
	if ( named_objs[line_name] )
		named_objs[line_name].setProperty( 'selected', true );


I haven't tested that, let me know if it doesn't work.

- Michael
From: Anton.Berezin (ANTONBEREZIN)
19 Nov 2020   [#19] In reply to [#18]

Sorry but it is not working.
Probably just I am not good java developer.


I am getting all 3 objects (1,2, line) as separate files

Thanks for your help again


From: Michael Gibson
19 Nov 2020   [#20] In reply to [#19]
Hi Anton, can you please post the current script you have and an example .3dm file ?

- Michael
From: Anton.Berezin (ANTONBEREZIN)
19 Nov 2020   [#21] In reply to [#20]

Yes sure.
And sorry for my incompetence

Attachments:
ExportNamedObjectsToIndividualFiles_test.js
test.3dm


From: Michael Gibson
19 Nov 2020   [#22] In reply to [#21]
Hi Anton, try this attached one, and also the script is expecting the line's object name to be "reg_line" but in your .3dm file it is named "Testline".

I still didn't test this so please let me know if it still doesn't work and I will take a closer look.

- Michael

Attachments:
ExportNamedObjectsToIndividualFiles_test.js


From: Anton.Berezin (ANTONBEREZIN)
19 Nov 2020   [#23] In reply to [#22]

Oh thanks man. It is realy working.
How could I thank you?
I am illustrator and if you need something to draw let me know.
(yaberezinanton@yandex.ru)


From: Michael Gibson
19 Nov 2020   [#24] In reply to [#23]
Hi Anton, that's great!

> How could I thank you?

It would be fun to see some of the output that you're using it for! :)

- Michael
From: Anton.Berezin (ANTONBEREZIN)
19 Nov 2020   [#25] In reply to [#24]

I’m trying to create method to export a complex illustration\model as different parts\files for further processing and assembly in Adobe illustrator.

I will show you the result

Thanks again


From: Mindset (IGNITER)
1 Jan 2023   [#26] In reply to [#22]
Hey Michael,

How can I make ExportNamedObjectsToIndividualFiles work for STEP [(*.stp, *.step, *.stpz) (AP 203, AP 214, AP 242)] ,or SAT [(*.sat) (Up to 2020)] Files?
Also, my target app, Alibre Atom3D, accepts only one Solid per file.
This script will write out every object having an identical name to the same file.
Might it append a numeric incremental for each such duplicately named solid and thereby save it into its own separately named file?
Another problem is that it will write out a group, rather than just its individual constituent solids.
Also, might the user pick the output directory at runtime ?


Thanks,
MindSet
From: Michael Gibson
1 Jan 2023   [#27] In reply to [#26]
Hi MindSet,

Are you using the ExportNamedObjectsToIndividualFiles.js that was in this previous post? :
http://moi3d.com/forum/index.php?webtag=MOI&msg=8226.8

re:
> How can I make ExportNamedObjectsToIndividualFiles work for STEP [(*.stp, *.step, *.stpz)
> (AP 203, AP 214, AP 242)] ,or SAT [(*.sat) (Up to 2020)] Files?

MoI will figure out what file type to write based on the file extension on the filename.

So to make it export STEP instead of FBX, go to line number 43 in the script which has this currently:
code:
    var filename = g_dirname + name + '.fbx';

And change the .fbx to .stp like this:
code:
    var filename = g_dirname + name + '.stp';

re:
> Might it append a numeric incremental for each such duplicately named solid and thereby save it
> into its own separately named file?

I've attached a version that should do that.


> Another problem is that it will write out a group, rather than just its individual constituent solids.

This should be fixed in the attached version also.


> Also, might the user pick the output directory at runtime ?

Sorry no that's not easy to do currently because there is not a directory picking UI set up for a script to use. I'll see what's involved in setting one up.

- Michael

Attachments:
ExportNamedObjectsToIndividualFiles.js


Show messages:  1-14  15-27