Home > Visualization > Visit Scripting

Visit Scripting

Tags:  

VisIt Scripting

The easiest way to do VisIt scripting is to invoke Visit in client mode. The alternative is to start your python interpreter directly, and the import the visit module. However, this requires more elaborate PATH, PYTHON_PATH, and LD_LIBRARY_PATH or DYLD_LYBRARY_PATH setup.
#!/Applications/VisIt/bin/visit -cli

OpenDatabase("/Data/viz course 2007/src/volume.vti")

AddPlot("Contour","Scalars")

isos=ContourAttributes() 
isos.contourNLevels = 4
SetPlotOptions(isos)

DrawPlots()




The alternative to calling visit with the -cli flag, is to open python, and then import visit as a module. In order to do this, first you have to make sure your visit has a visit.so and visitmodule.so libs. These live under the lib directory in side your os specific VisIt directory. Second you have to setup your python to find all the necessary libraries. Currently what has worked for me --and it is probably overkill on includes-- is the following paths (for csh/tcsh.)

# if this is a file, "source " it from your shell

setenv PYTHONPATH /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5

setenv VISITHOME  /Applications/VisIt

setenv PYTHONPATH ${PYTHONPATH}:${VISITHOME}/1.6.1/darwin-ppc/lib
setenv PYTHONPATH ${PYTHONPATH}:${VISITHOME}/1.6.1/darwin-ppc/lib/python
setenv PYTHONPATH ${PYTHONPATH}:${VISITHOME}/1.6.1/darwin-ppc/lib/python/lib
setenv PYTHONPATH ${PYTHONPATH}:${VISITHOME}/1.6.1/darwin-ppc/lib/python/lib/python2.5
setenv PYTHONPATH ${PYTHONPATH}:${VISITHOME}/1.6.1/darwin-ppc/lib/python/lib/python2.5/lib-dynload

@ findInPath = `echo $PATH | grep -i visit | wc -l`
if ( $findInPath == 0 ) then
  setenv PATH /usr/local/bin:/Applications/VisIt/bin:$PATH
endif
Notice you may already have a PYTHONPATH set, so you do not need to reset it. Also, you will have to customize it for your platform's directory. This sample shows for darwin-ppc version.


 RSS of this page