OOF2: The Manual

Appendix A. Text Mode

When OOF2 is invoked with the --text command line argument, the graphical user interface is not started and Python prompt (>>>) is presented:


                          Welcome to OOF2!

OOF2 was written at the National Institute of Standards and Technology
(NIST).  NIST assumes no responsibility for the operation,
modification, or mainentance of OOF2.


Type "OOF.Copyright()" to see the copyrights associated with OOF2.
Type "OOF.Credits()" for a list of the authors.
Type "help()" for Python help.

At this point, OOF2 is a normal interactive Python interpreter, except that all of the OOF2 modules have been imported (as well as the Python math module). If you don't know Python, it's still possible to use text mode by reading the rest of this Appendix.

OOF2's text mode is designed more for remote control (driving OOF2 from an external program) than for interactive use by a human being. It is possible to use it interactively, but it would be a good idea to keep Chapter 6 handy while doing so.

In text mode, typing the name of an OOF2 command menu lists the names of the commands and submenus that it contains. The main menu is called OOF:

>>> OOF
OOF: File Windows Microstructure PixelGroup PixelSelection Credits Copyright
 Disclaimer ActiveArea Property Material NodeGroup SegmentGroup ElementGroup
 Skeleton Mesh NodeSelection SegmentSelection ElementSelection Solver Image Help

Submenus and commands are members of their menus (in the OO sense), and are accessed with the Python . operator:

>>> OOF.Material
Material: New Delete Copy Add_property Remove_property Assign Remove

Typing the name of a command prints nothing much useful, because a command doesn't have any members:

>>> OOF.Material.New

Appending parentheses to a command, however, echoes and executes it:

>>> OOF.Disclaimer() 

Recipients of this software assume all responsibilities associated with its
operation, modification and maintenance.

If the command requires arguments, they can be provided within the parentheses:

>>> OOF.Material.New(name='pbj')

Arguments must be provided in the form name=value. Any omitted arguments will be assigned the value None.[70]

All of the objects that can be used as values of command arguments are defined in the OOF2 Python environment. It's therefore possible to type complicated commands like this:

>>> OOF.Skeleton.Boundary.Construct(skeleton='microstructure:skeleton',
    constructor=EdgeFromSegments(group=selection,direction='Left to right'))

Consult Chapter 6 for the names of the commands and the forms of their arguments.

Some notes for those who aren't familiar with Python:

  • Don't type extra spaces or tabs at the beginnings of lines.

  • If you want to stretch a command over more than one line, end the incomplete lines with a backslash (\). The backslash isn't necessary if the line break is inside parentheses.

  • Character strings must be quoted. Either single or double quotes may be used.

  • To exit, type ctrl-D, or OOF.File.Quit().

[70] Versions before 2.0.2 would prompt the user for missing arguments. This is incompatible with the ability to have optional arguments, which we decided was more useful.