-- maxCapture -- copyright 2005 - www.nikclark.com -- -- A utility for capturing the current viewport in max -- Creates a new .bmp every time you click the button -- Saves the files as: 0001.bmp,0002.bmp0003.bmp, etc -- Has tiny footprint to save screen space. -- -- A thumbnail of the scene is displayed in the control every time. -- The filename and directory can be set. -- -- If you type a name into the text box, it will be used -- in the filenames. Leave it blank and it will be numerical. -- -- Every time the a new name is entered or the directory changed, -- The numbers will start back at 0001.bmp. -- -- This tool is free for all uses. -- Redistribution is not allowed without permission. -- Not for use in France. -- -- Revision History -- 23 march 2005 - V1.0 - Initial release -- rollout ControlRollout "maxCapture" width:104 height:168 ( local myGrab local myBitmap local myDisplayBitmap local myIncrement = 1 local myDir = (getdir #image) local myName = "" local newHeight local x = #(0,0,0) button grabIt "Grab Viewport" pos:[2,30] width:100 height:38 button setDir "set directory" pos:[2,2] width:100 height:12 editText edt1 "" pos:[-1,15] width:102 height:14 bitmap bmp1 "" pos:[2,69] width:100 height:100 fn grabViewport = ( if myName != undefined then myName = edt1.text myBitmap = gw.getViewportDib() myNewIncrement=(substring "0000" 1 (4-(x=myIncrement as string).count))+x myBitmap.filename = (myDir + "\\" + myName + myNewIncrement as string + ".bmp") print ("saved as " + myBitmap.filename as string) save myBitmap myIncrement += 1 newHeight = myBitmap.height * (100/myBitmap.width as float) myDisplayBitmap = rendermap (bitmaptexture filename:(myDir + "\\" + myName + myNewIncrement as string + ".bmp")) size:[100,newHeight] filter:true setPixels myDisplayBitmap [0,0] #((color 197 197 197)) bmp1.bitmap = myDisplayBitmap ) fn myGetpath = ( myDir = getSavePath() if myDir != undefined then () else myDir = (getdir #image) myIncrement = 1 ) on grabIt pressed do try(grabViewport())catch() on setDir pressed do try(myGetpath())catch() on edt1 changed val do try(myIncrement=1)catch() ) createdialog ControlRollout width:104 style: #(#style_titlebar, #style_border, #style_toolwindow, #style_sysmenu)