Start your script with the following:
chdir(__file__)
In order for Python to find the modules in non-standard locations, you should add the directory path of the module to the sys.path
variable.
A common example is a script that wants to import modules from the same directory where it is located. In that case you can just add the following two lines to the start of your script.
import os,sys sys.path.insert(0,os.dirname(__file__))
Plugin menus can be loaded automatically on pyFormex startup, by adding a line to the gui
section of your configuration file (~/.pyformexrc
).
[gui] plugins = ['surface_menu', 'formex_menu']
If you create your own pugin menus for pyFormex, you cannot autoload them like the regular plugin menus from the distribution, because they are not in the plugin directory of the installation.9.2You can however automatically execute your own scripts by adding their full path names in the autorun
variable of your configuration file.
autorun = '/home/user/myscripts/startup/'
The multisave option allows you to easily record a series of images while working with pyFormex. You may want to turn this sequence into a movie afterwards. THis can be done with the mencoder and/or ffmpeg programs. The internet provides comprehensive information on how to use these video encoders.
If you are looking for a quick answer, however, here are some of the commands we have often used to create movies.
Suppose you have images in files image-000.png, image-001.png, .... First, you should get the size of the images (they all should have the same size). The command
file image*.png
mencoder mf://image-*.png -mf w=796:h=516:fps=5:type=png -ovc copy -oac copy -o movie1.avi
ffmpeg -r 5 -b 800 -i image-%03d.jpg movie.mp4
Saving images in EPS format is done through the gl2ps library, which can be accessed from Python using the wrappers from python-gl2ps-1.1.2.tar.gz.
You need to have the OpenGL header files installed in order to do this. (On Debian: apt-get install libgl1-mesa-dev.)
tar xvzf python-gl2ps-1.1.2.tar.gz cd python-gl2ps-1.1.2 su root python setup.py install