Notifications
Clear all

[Closed] How can I save a viewport to a file

Hi,

I want to save a viewport to an image file, is this possible with MaxScript?

Thank you,
Christian

2 Replies

There is a more complex example in the help file but this is quick and dirty.

snagViewport =  gw.getViewportDib()
   snagViewport.filename = (getdir #image) + "\\" + getfilenamefile (maxFilename as string) + "_" + (viewport.GetType() as string) + "_" + ((getfiles ((getdir #image) + "\\" + getfilenamefile (maxFilename as string) + "_" + (viewport.GetType() as string) + "*")).count as string) + ".bmp"
   save snagViewport
   display snagViewport

Saves a snapshot of the active view to the images directory in your max folder and will increment the filename so that multiple screens can be captured.

Thank you, gw.getViewportDib() was the function that I was looking for!