PDA

View Full Version : Export objects!


dellis
01-30-2008, 08:05 PM
Hey all,

I'm not a maxscripter by any stretch (yet)...but i've searched for a solution to this problem and couldn't find one that works. It seems like it would be such a basic thing to me...anyway...heres the problem.

I'd like to be able to select a bunch of objects in a scene and then be able to export them as individual .stl files in a directory. Yup...thats it!

All the scripts that i found/tried that were used for this...didn't work when choosing .stl as the output. Any help would be really, really appreciated.

Thanks!

RustyKnight
01-30-2008, 09:57 PM
Hey all,

I'm not a maxscripter by any stretch (yet)...but i've searched for a solution to this problem and couldn't find one that works. It seems like it would be such a basic thing to me...anyway...heres the problem.

I'd like to be able to select a bunch of objects in a scene and then be able to export them as individual .stl files in a directory. Yup...thats it!

All the scripts that i found/tried that were used for this...didn't work when choosing .stl as the output. Any help would be really, really appreciated.

Thanks!Not knowing the limitations of the format, you should be able to useexportFile <filename_string> [ #noPrompt ] [ selectedOnly:<boolean> ] [ using:<maxclass> ]

Shane

dellis
02-04-2008, 08:12 PM
Okay...took your suggestion and after some messing around i got it working...well...kind of! I got it working for one single object...but this has some inherent problems with respect to how i want to use it. Ideally i would like to be able to select a bunch of different objects in the scene and have MAX export them all as seperate objects in seperate files in a directory.

Heres what i have:

/*
[DESCRIPTION]
Stereolithography Export Version 0.01.
Simple script for creating STL files from individual objects in a scene.
[INSTALLATION]
Dock script in a tab or toolbar...or place in startup directory.
[CREATION INFO]
Author: Dwayne D. Ellis. www.dwayne-ellis.com (http://www.dwayne-ellis.com)
Last Modified: February 4 2008
*/
if the_STL_Floater != undefined do (closerolloutfloater the_STL_Floater)
theClasses = exporterPlugin.classes
rollout export_roll1 "Export"
(
button theButton "Press me!"
on theButton pressed do
(
exportFile (GetDir #scene + "/exportTest" ) using:theClasses[7] selectedOnly: false
)

)
rollout help_roll2 "Help"
(
button theButton2 "Help!"
on theButton2 pressed do
(
messageBox "This a small utility for exporting objects as stereolithography files." title: "Stereolithogrpahy Export Help" beep: true
)
)

the_STL_Floater = newRolloutFloater "Stereolithography Export" 250 120
addRollout export_roll1 the_STL_Floater
addRollout help_roll2 the_STL_Floater

Any help would be greatly appreciated...i'm rally nearing my wall of maxscript knowledge.

U.S.S. Speed
02-05-2008, 12:03 AM
Try :

f the_STL_Floater != undefined do (closerolloutfloater the_STL_Floater)
theClasses = exporterPlugin.classes
rollout export_roll1 "Export"
(
button theButton "Press me!"
on theButton pressed do
(
i = 1
for o in Geometry do
(
select o
exportFile (GetDir (#scene + "/exportTest_" + o.name + "_" + i as string) ) using:theClasses[7] selectedOnly: True
i = i + 1
)
)

)
rollout help_roll2 "Help"
(
button theButton2 "Help!"
on theButton2 pressed do
(
messageBox "This a small utility for exporting objects as stereolithography files." title: "Stereolithogrpahy Export Help" beep: true
)
)

the_STL_Floater = newRolloutFloater "Stereolithography Export" 250 120
addRollout export_roll1 the_STL_Floater
addRollout help_roll2 the_STL_Floater

I think you want only to export geometry, so the "For o in Geometry" cycle between all the geometry object one by one, select them, and export the same way as before, but the selectedOnly is now True.
Also added the object name to the export path, so every file will have the name of their object.
(Added an number increment in case 2 objects in your scene has the same name.)

RustyKnight
02-05-2008, 12:15 AM
You know U.S.S Speed, you've just about got itIdeally i would like to be able to select a bunch of different objects in the scene and have MAX export them all as seperate objects in seperate files in a directorySo rather then exporting the ALL the geomotry, he only wants to export the SELECT geomotry, but to individual files...

I was trying to think of a way to do, but you've just about covered everything...except....your solution exports all the geomotry...but if we doon theButton pressed do
(
local lstItems = selection as array
i = 1
for o in lstItems do
(
select o
exportFile (GetDir (#scene + "/exportTest_" + o.name + "_" + i as string) ) using:theClasses[7] selectedOnly: True
i = i + 1
)
)
We should just about hit the nail on the head!

By the way, nice solution!

Shane

U.S.S. Speed
02-05-2008, 12:39 AM
Oups... Didn't notice he wanted only selection.
Should really read more.

dellis
02-05-2008, 01:56 PM
First off..just wanted to say thanks for the help you guys. I'm really starting to realize that i need to learn maxscript alot better. I copied and pasted the code adjustments that you guys made and i'm getting an error....not sure what it means or how to fix it. Here is the whole thing as i'm running it:



/*
[DESCRIPTION]
Stereolithography Export Version 0.01.
Simple script for creating STL files from individual objects in a scene.
[INSTALLATION]
Dock script in a tab or toolbar...or place in startup directory.
[CREATION INFO]
Author: Dwayne D. Ellis. www.dwayne-ellis.com (http://www.dwayne-ellis.com)
Last Modified: February 4 2008
*/
if the_STL_Floater != undefined do (closerolloutfloater the_STL_Floater)
theClasses = exporterPlugin.classes
rollout export_roll1 "Export"
(
button theButton "Press me!"
on theButton pressed do
(
local lstItems = selection as array
i = 1
for o in lstItems do
(
select o
exportFile (GetDir (#scene + "exportTest_" + o.name + "_" + i as string) ) using:theClasses[7] selectedOnly: True
i = i + 1
)
)

)
rollout help_roll2 "Help"
(
button theButton2 "Help!"
on theButton2 pressed do
(
messageBox "This a small utility for exporting objects as stereolithography files." title: "Stereolithogrpahy Export Help" beep: true
)
)
the_STL_Floater = newRolloutFloater "Stereolithography Export" 250 120
addRollout export_roll1 the_STL_Floater
addRollout help_roll2 the_STL_Floater


Its erroring out at the exportFile line.


Thanks again for all the help!!! I really appreciate it.

RustyKnight
02-05-2008, 09:35 PM
I think (and it would nice if someone else could double check for me) that the systex is wrong...exportFile (GetDir (#scene + "exportTest_" + o.name + "_" + i as string) ) using:theClasses[7] selectedOnly: TrueShould readexportFile ((GetDir #scene) + ("exportTest_" + o.name + "_") + (i as string)) using:theClasses[7] selectedOnly: TrueIt would be useful, if in the furture, you could also quote the error message ;)

Shane

dellis
02-06-2008, 03:30 PM
Hey,

Sorry about the error message thing. I substituted the line in that you corrected and not the error message is:

Cannot determine export file type--Export cancelled.

I have tried different numbers in the array for the different exporters....some worked some didn't. The only format that our finite element software will import is .stl which is preferrable and vrml.

So you guys have to know i am realy appreciating the help!

dellis
02-09-2008, 01:18 PM
I'm wondering if this isn't working because you can't, explicitly, export multiple, selected objects to the .stl format even through the UI.

Hope someone can figure this out....i feel like i'm on one of those hamster wheels right now!

mrapelje
02-11-2008, 06:06 PM
I have a script that should do this you will need to change .ase to .stl -- it will use the stl export setting that you last used.

Files will be in the default export location.

http://www.polyleaf.com/Products.htm download the JEEWiz script.

RustyKnight
02-13-2008, 04:58 AM
I think (and it would nice if someone else could double check for me) that the systex is wrong...exportFile (GetDir (#scene + "exportTest_" + o.name + "_" + i as string) ) using:theClasses[7] selectedOnly: TrueShould readexportFile ((GetDir #scene) + ("exportTest_" + o.name + "_") + (i as string)) using:theClasses[7] selectedOnly: TrueIt would be useful, if in the furture, you could also quote the error message ;)

ShaneThis is a long shot, but have you tried appending the ".stl" extension to the end of the file name??

exportFile ((GetDir #scene) + ("exportTest_" + o.name + "_") + (i as string) + ".stl") selectedOnly: True

You are also correct, we can only export a single object to stl, but since we only have one object selected, it shouldn't make any difference...

Shane

CGTalk Moderation
02-13-2008, 04:58 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.