importing using for loops

hey there,

i'm a complete beginner with maxscript, and am struggling to do something that i'm sure should be very simple, though the help files aren't really helping me out.

all i hope to do is have a simple for loop that allows me to import a series of .wrl files, render each one, and output the rendered images as .jpg files. At the moment i'm using the following script as a test with 2 files:

for i = 1 to 2 do
(
importFile ""Untitled.wrl"+i+".wrl"" #noPrompt
render outputFile: ""rendered"+i+".jpg""
)

and i get an error about syntax :(

Any help would be much appreciated.

Comments

Comment viewing options

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

Thanks br0t! Your comments

Thanks br0t! Your comments have really helped me get started :)

br0t's picture

Well you have some syntax

Well you have some syntax problems :D
The paths are not specified, some " and a .wrl too much.
Try this:

for i = 1 to 2 do
(
importFile ("$scenes/Untitled"+(i as String)+".wrl") #noPrompt
render outputFile: ("$scenes/Untitled"+(i as String)+".jpg") vfb:false
)

Your Untitled1.wrl and Untitled2.wrl will be imported, rendered and saved as Untitled1.jpg etc.
Note that they have to be in the right folder, here: "C:\Users\Username\Documents\3dsmax\scenes".
The "vfb:false" will prevent 3dsmax from opening a rendered frame window after each render, so you don't have like hundreds of windows opened after importing many files.
Greetings

Never get low & slow & out of ideas

Comment viewing options

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