Here’s a TCL script written for use with VMD to automatically generate a bunch of contours from grid files in a specific directory. The script saves the viewing angle and other rendering aspects.

#Set the directory for looking for files here
set dir "/home/cogswell/Downloads/dx/30-blend-95"
set currentDir [pwd]
cd $dir

#set height and width
#set h 500
#set w 500
set h ["%h"]
set w ["%w"]

#Set global defaults and preferences
axes location off
display antialias on
display depthcue on

# save the current display state and representation style
set viewpt [molinfo top get {center_matrix rotate_matrix scale_matrix global_matrix}]
set myrep [molinfo top get {rep}]
mol default style $myrep

foreach f [glob "p*.dx"] {
set file [exec basename $f ".dx"]
mol off top
mol new "$f"
#mol addrep top
molinfo top set {center_matrix rotate_matrix scale_matrix global_matrix} $viewpt
render POV3 "$file.pov" povray +H%h +W%w -I%s -O"$file.png" -D +X +A
mol delete top
}

#return to the original molecule and directory
molinfo top set {center_matrix rotate_matrix scale_matrix global_matrix} $viewpt
mol on top