scallop dome pyformex logo

Table Of Contents

Previous topic

pyFormex user guide

Next topic

The Graphical User Interface

[FSF Associate Member]

Valid XHTML 1.0 Transitional

Running pyFormex

To run pyFormex, simply enter the command pyformex in a terminal window. This will start the Graphical User Interface (GUI), from where you can launch examples or load, edit and run your own scripts.

The installation procedure may have installed into your desktop menu or even have created a start button in the desktop panel. These provide convenient shortcuts to start the GUI by the click of a mouse button.

The program takes some optional command line arguments, that modify the behaviour of the program. Appendix Command line options gives a full list of all options. For normal use however you will seldom need to use any of them. Therefore, we will only explain here the more commonly used ones.

By default, sends diagnostical and informational messages to the terminal from which the program was started. Sometimes this may be inconvenient, e.g. because the user has no access to the starting terminal. You can redirect these messages to the message window of the GUI by starting pyformex with the command pyformex --redirect. The desktop starters installed by the installation procedure use this option.

In some cases the user may want to use the mathematical power of without the GUI. This is e.g. useful to run complex automated procedures from a script file. For convenience, will automatically enter this batch mode (without GUI) if the name of a script file was specified on the command line; when a script file name is absent, start in GUI mode. Even when specifying a script file, You can still force the GUI mode by adding the option –gui to the command line.

Command line options

The following is a complete list of the options for the pyformex command.This output can also be generated by the command pyformex --help.

Usage
=====
  pyformex [<options>] [ [ scriptname [scriptargs] ] ...]

pyFormex is a tool for generating, manipulating and transforming large
geometrical models of 3D structures by sequences of mathematical
transformations.

Options
=======
--gui                   Start the GUI (this is the default when no scriptname
                        argument is given)
--nogui                 Do not start the GUI (this is the default when a
                        scriptname argument is given)
--interactive           Go into interactive mode after processing the command
                        line parameters. This is implied by the --gui option.
--dri                   Use Direct Rendering Infrastructure. By default,
                        direct rendering will be used if available.
--nodri                 Do not use the Direct Rendering Infrastructure. This
                        may be used to turn off the direc rendering, e.g. to
                        allow better capturing of images and movies.
--opengl=OPENGL         Force the usage of an OpenGL version. The version
                        should be specified as a string 'a.b'. The default is
                        1.0
--uselib                Use the pyFormex C lib if available. This is the
                        default.
--nouselib              Do not use the pyFormex C-lib.
--commands              Use the commands module to execute external commands.
                        Default is to use the subprocess module.
--config=CONFIG         Use file CONFIG for settings
--nodefaultconfig       Skip the default site and user config files. This
                        option can only be used in conjunction with the
                        --config option.
--redirect              Redirect standard output to the message board (ignored
                        with --nogui)
--noredirect            Do not redirect standard output to the message board.
--debug=DEBUG           Display debugging information to sys.stdout. The value
                        is a comma-separated list of (case-insensitive)
                        strings corresponding with the attributes of the
                        DebugLevels class. The individual values are OR-ed
                        together to produce a final debug value. The special
                        value 'all' can be used to switch on all debug info.
--debuglevel=DEBUGLEVEL
                        Display debugging info to sys.stdout. The value is an
                        int with the bits of the requested debug levels set. A
                        value of -1 switches on all debug info. If this option
                        is used, it overrides the --debug option.
--newviewports          Use the new multiple viewport canvas implementation.
                        This is an experimental feature only intended for
                        developers.
--testmodule=TESTMODULE
                        Run the docstring tests for module TESTMODULE.
                        TESTMODULE is the name of the module, using . as path
                        separator.
--testcamera            Print camera settings whenever they change.
--testexecutor          Test alternate executor: only for developers!
--memtrack              Track memory for leaks. This is only for developers.
--fastnurbs             Test C library nurbs drawing: only for developers!
--pyside                Use the PySide bindings for QT4 libraries
--pyqt4                 Use the PyQt4 bindings for QT4 libraries
--listfiles             List the pyformex Python source files.
--search                Search the pyformex source for a specified pattern and
                        exit. This can optionally be followed by -- followed
                        by options for the grep command and/or '-a' to search
                        all files in the extended search path. The final
                        argument is the pattern to search. '-e' before the
                        pattern will interprete this as an extended regular
                        expression. '-l' option only lists the names of the
                        matching files.
--remove                Remove the pyFormex installation and exit. This option
                        only works when pyFormex was installed from a tarball
                        release using the supplied install procedure. If you
                        install from a distribution package (e.g. Debian), you
                        should use your distribution's package tools to remove
                        pyFormex. If you run pyFormex directly from SVN
                        sources, you should just remove the whole checked out
                        source tree.
--whereami              Show where the pyformex package is installed and exit
--detect                Show detected helper software and exit
--version               show program's version number and exit
--help, -h              show this help message and exit

Running without the GUI

If you start with the --nogui option, no Graphical User Interface is created. This is extremely useful to run automated scripts in batch mode. In this operating mode, will interprete all arguments remaining after interpreting the options, as filenames of scripts to be run (and possibly arguments to be interpreted by these scripts). Thus, if you want to run a script myscript.py in batch mode, just give the command pyformex myscript.py.

The running script has access to the remaining arguments in the global list variable argv. The script can use any arguments of it and pop them of the list. Any arguments remaining in the argv list when the script finishes, will be used for another execution cycle. This means that the first remaining argument should again be a script.