Listing

How would i

Export a list of all of the objects in a scene?

Thanks

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

First line of code is just

First line of code is just for example. Will create five box in the row with distance of 30 units.
U can use your list of objects. Select objects in the scene and run this line:

--store your selection in array
listOfObj = selection as array

Last line is function for exporting.
For that function you need defined path where object will be exported (exportpath)
Then you need export class (in this case "ObjExp") and selectedonly argument must be on ei. true. If not then yoyu will be export whole scene

barigazy

Shade926's picture

Ive put in my export path but

Ive put in my export path but when i export it to the chose place it doesn't show up there..

Does it export as a list?

barigazy's picture

basic forum rule

You need to post some code or snapshot or even test file first.

barigazy

Shade926's picture

Ye sorry thought i had

Ye sorry thought i had done..

My code looks like this

button exportobjects "Export Selected Objects"
on exportobjects pressed do
(
listOfObj = selection as array
exportpath = @"C:\Users\Michael\Documents\3dsMax\export"
select listOfObj
exportFile exportpath using:ObjExp selectedonly:on
)

barigazy's picture

Probably UAC block exporting.

Probably UAC block exporting. If you have windows8 than this is common problem.
Also you need error check

if selection.count == 0 then messageBox "Select objects!" else
(
    local exportpath = @"C:\Users\Michael\Documents\3dsMax\export"
    exportFile exportpath using:ObjExp selectedonly:on
)

More elegant solution you can find here http://www.scriptspot.com/3ds-max/scripts/batch-exportimport

barigazy

Shade926's picture

Cool

Hello

Thanks for that... Could you explain what the first bit of code does and what the final line does..

Cant get my head round it???

barigazy's picture

first run this in listener to

first run this in listener to see all export classes that max suports
for i in exporterPlugin.classes do print i
You will get then en array.
Let say that you want to export to *.obj list of objects.

-- this is my list of boxes
listOfObj = for i = 1 to 5 collect (Box pos:[0,i*30,0])
exportpath = @"c:\temp"
--now if you want to expor only selection (not whole scene) then
select listOfObj
exportFile exportpath using:ObjExp selectedonly:on

barigazy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.