Forum Groups
  All forums
    Help & Feedback
      Work in progress
      Finished Art
      Non-Max related

Maxunderground news unavailable

First page  Go to the previous page   [01]  [02]  Go to the next page  Last page
Quick maxscript help (batch import-process-export)
show user profile  horizon
Ok, this should be fairly easy but I have no idea how to operate import/export and filenames from within maxscript

I have 81 objects in a folder, I can name them anything if it could help to access them from script.
I need to import an object (fbx), do some modifier stuff I know how to script, reset the xform, collapse to mesh, and export to dae (collada dae, not autodesk dae, I have a plugin for it, hope that won't be a problem.

Any ideas?

read 2411 times
8/20/2009 9:06:22 AM (last edit: 8/20/2009 9:06:22 AM)
show user profile  Nik Clark
Not all plugins are open to maxscript. Check that first. The rest is doable. If I wasn't in an airport departure lounge, I could help more.

read 2398 times
8/20/2009 10:12:34 AM (last edit: 8/20/2009 10:12:34 AM)
show user profile  horizon
This is what I get in the macro recorder when importing:

actionMan.executeAction 0 "40010" -- File: Import File
Standardmaterial ().ReferenceTarget.COLLADA_id = "ColorMaterial_D6E49900"
$.name = "objectName"
$objectName.baseObject.ReferenceTarget.COLLADA_id = "objectName-mesh"
$objectName.ReferenceTarget.COLLADA_id = "objectName-node"
$ = "objectName01"

I named the object objectName

I have no idea if that answers your question though.

read 2391 times
8/20/2009 10:41:21 AM (last edit: 8/20/2009 10:41:21 AM)
show user profile  horizon
Anyone? Dub?

read 2367 times
8/21/2009 6:14:07 AM (last edit: 8/21/2009 6:14:07 AM)
show user profile  advance-software
If you play back what you've captured, does it repeat the process ?
read 2363 times
8/21/2009 7:15:25 AM (last edit: 8/21/2009 7:15:25 AM)
show user profile  horizon
It just opens the import window (browse for files).
And I can't even capture the reset xform action as I thought I would...


read 2346 times
8/22/2009 6:56:04 AM (last edit: 8/22/2009 6:56:04 AM)
show user profile  advance-software
That's what I thought might happen. It might not be possible to silently invoke the import/export plugins you're trying to use.

If you really must have this automated, you might be able to use a Windows macro recorder program to capture key strokes to perform the operations you require. This would import & export from the same files, which you could copy in/out at the end of each run.

google : "macro recorder windows"

Disclaimer : I've never tried running import/export silently. There might be a simpler solution.

I could post a support query for you with Autodesk, if you like, but you probably won't get an answer until the middle of next week. Even then, it might just confirm the above.

Maybe try asking on the Area or CG Talk if you haven't done so already.
read 2340 times
8/22/2009 7:32:10 AM (last edit: 8/22/2009 8:00:28 AM)
show user profile  horizon
Nah, don't bother, I'm just gonna go and do it by hand, hopefully there won't be any more after this batch.

Thanks a bunch anyways AS

read 2323 times
8/22/2009 9:22:36 AM (last edit: 8/22/2009 9:22:36 AM)
show user profile  Garp
I got it working.

I first exported manually 3 files named theFile1.fbx, theFile2.fbx and theFile3.fbx, each one containing a box named theBox.
Then I ran this:
for i = 1 to 3 do
resetMaxFile #noPrompt
fName = "theFile" + i as string
importFile ("c:/testImpExp/" + fName + ".fbx") #noPrompt using:importerPlugin.classes[5]
select $theBox
addModifier $ (twist angle:45 axis:2)
centerPivot $
resetXForm $
collapseStack $
exportFile ("c:/testImpExp/" + fName + ".dae") #noPrompt using:exporterPlugin.classes[18]

After that I re-imported each file manually and everything was fine.

Note that the indices for importerPlugin.classes and exporterPlugin.classes might be different for you. Check the arrays in the listener.
For me, FBXIMP was the 5th importer and ColladaNextGenExporter the 18th exporter.

read 2321 times
8/22/2009 9:26:17 AM (last edit: 8/22/2009 9:26:43 AM)
show user profile  Garp
... hello?

read 2287 times
8/23/2009 6:36:04 AM (last edit: 8/23/2009 6:36:04 AM)
show user profile  horizon
Aww damn, I already did it by hand.

But I'll probably need importing later, so... I don't know where to check that plugin class numbers, and it won't import with the number 5 I guess...

read 2284 times
8/23/2009 6:46:39 AM (last edit: 8/23/2009 6:46:39 AM)
show user profile  Garp
Mmm, that's what I figured. I just noticed that I was 4 min late! Sorry ;)

Type importerPlugin.classes in the listener, it will display an array with all the available plugin importers you have. Then just count them. (same with the exporters)

edit: forget the classes, you can just enter the names:
importFile ("c:/testImpExp/" + fName + ".fbx") #noPrompt using:FBXIMP
exportFile ("c:/testImpExp/" + fName + ".dae") #noPrompt using:ColladaNextGenExporter

read 2281 times
8/23/2009 6:52:50 AM (last edit: 8/23/2009 7:06:22 AM)
show user profile  horizon
Well. numbers are 5 and 8 for me, but the export and import functions do nothing

I stripped it down to this:
i = 1
fName = "file" + i as string
importFile ("c:/testImpExp/" + fName + ".fbx") ##noPrompt using:importerPlugin.classes[5]

And got this in the listener:

No object was imported, and no file was created with the same lines but on export
it does the same with the names instead of classes

read 2275 times
8/23/2009 7:10:12 AM (last edit: 8/23/2009 7:12:32 AM)
show user profile  Garp
You do have a folder named c:/testImpExp and a file named file1.fbx in it? (just checking)

edit: also you have two '#' signs before noPrompt.

read 2272 times
8/23/2009 7:14:22 AM (last edit: 8/23/2009 7:19:50 AM)
show user profile  horizon
Ah I messed up the copying, I have another folder on E, and no double # before no prompt, but it's all ok in the script window in max
The folder is correct, and i have file1 to 3, .fbx ofcourse

read 2267 times
8/23/2009 7:20:17 AM (last edit: 8/23/2009 7:20:43 AM)
First page  Go to the previous page   [01]  [02]  Go to the next page  Last page
#Maxforums IRC
Open chat window