Notifications
Clear all

[Closed] new to maxscript- viewport grab task

Hi everyone, I’ve got a repetitive chore and I think maxscript can help. I haven’t used anything but macros though and this time I need a script that I can run from a tool like BatchIt ( http://paulneale.com/scripts/batchItMax/batchItMax.htm ) on a directory with a few hundred scene files.

Here’s the task:

Process a whole directory in one go without me having to manually open each file, activate the top viewport and activate a grab_viewport macro
Save renders of the top-down view of the centered object in each file (these are all individual building assets)
Save them with the same name as the original files in a separate directory

Does this sound do-able? If so, how do I make the grab viewport take just a top down view (or should I create a camera in each file and use that view)? I’ve found two different grab viewport scripts that work and I have BatchIt already (which is awesome). I’m just not sure how to make the view I need “active” so the batch processing grabs the right view. Any info greatly appreciated!

PS I need all of the top-down images to batch in photoshop so I can make a symbol set for an overland map with to-scale shapes of all the buildings.

2 Replies

Hi violetce!

Yes, it is very doable. I did something simular, except I used a text file with a number of parameters to determine the renderer settings.

Check out the render() method in the maxscript docs.

You will need to troll the directory where your scene files exist, basically loading each one, perform the render then move onto the next file.

Hope this helps.

Shane

Hi,
this should get you going, I hope


MyPath="C:\\renders\\grabs\\"
viewport.setType #view_top 
img = gw.getViewportDib()
img.filename = MyPath + (getfileNameFile maxFileName) + ".jpg"
save img