Session and Top-Level Functionality

Session

Tecplot Engine and Tecplot 360 EX License management.

The session module contains methods used to manipulate the Tecplot Engine such as notification of a state-change that was done outside of PyTecplot. It also contains methods for acquiring and releasing the Tecplot 360 EX License.

tecplot.session.stop()[source]

Releases the Tecplot 360 EX License and shuts down Tecplot Engine.

This shuts down the Tecplot Engine and releases the Tecplot 360 EX License. Call this function when your script is finished using PyTecplot. Calling this function is not required. If you do not call this function, it will be called automatically when your script exists. However, the Tecplot 360 EX License will not be released until you call this function.

Note that stop() may only be called once during the life of a Python session. If it has already been called, subsequent calls do nothing.

See also: tecplot.session.acquire_license(), tecplot.session.release_license().

Example

>>> import tecplot
>>> # Do useful things with pytecplot
>>> tecplot.session.stop() # Shutdown the tecplot and release license
tecplot.session.acquire_license()[source]

Attempts to acquire the Tecplot 360 EX License

Call this function to attempt to acquire a Tecplot 360 EX License. If Tecplot Engine is not started, this function will start the Tecplot Engine before attempting to acquire a license.

This function can be used to re-acquire a license that was released with tecplot.session.release_license.

If the Tecplot Engine is currently running, and a Tecplot 360 EX License has already been acquired, this function has no effect.

Licenses may be acquired and released any number of times during the same Python session.

Raises TecplotLicenseError if a valid license could not be acquired.

See also: tecplot.session.release_license()

Example


>>> import tecplot
>>> # Do useful things
>>> tecplot.session.release_license()
>>> # Do time-consuming things not related to |PyTecplot|
>>> tecplot.session.acquire_license()  # re-acquire the license
>>> # Do useful |PyTecplot| related things.
tecplot.session.release_license()[source]

Attempts to release the Tecplot 360 EX License

Call this to release a Tecplot 360 EX License. Normally you do not need to call this function since tecplot.session.stop() will call it for you when your script exists and the Python interpreter is unloaded.

This function can be used to release a license so that the license is available to other instances of Tecplot 360 EX.

If the Tecplot 360 EX License has already been released, this function has no effect.

Licenses may be acquired and released any number of times during the same Python session.

See also: tecplot.session.acquire_license()

Example


>>> import tecplot
>>> # Do useful things
>>> tecplot.session.release_license()
>>> # Do time-consuming things not related to |PyTecplot|
>>> tecplot.session.acquire_license()  # re-acquire the license
>>> # Do useful |PyTecplot| related things.
tecplot.session.tecplot_install_directory()[source]

Tecplot 360 EX installation directory.

Top-level installation directory for Tecplot 360 EX. This will typically contain configuration files and the examples directory.

This directory is platform-dependent and will contain configuration files and the examples directory:

import os
import tecplot

installdir = tecplot.session.tecplot_install_directory()
infile = os.path.join(installdir,'examples','3D','spaceship.lpk')
outfile = 'spaceship.png'
tecplot.load_layout(infile)
tecplot.export.save_png(outfile, 600)
../_images/spaceship.png
tecplot.session.tecplot_examples_directory()[source]

Tecplot 360 EX examples directory.

Examples directory that is typically installed with Tecplot 360 EX. This may be overridden with the TECPLOT_EXAMPLES environment variable.

This directory is platform-dependent and by default contains the various examples shipped with Tecplot 360 EX:

import os
import tecplot

exdir = tecplot.session.tecplot_examples_directory()
infile = os.path.join(exdir,'3D','JetSurface.lay')
outfile = 'jet_surface.png'
tecplot.load_layout(infile)
tecplot.export.save_png(outfile, 300)
../_images/jet_surface.png

Miscellaneous

class tecplot.tecutil.Index[source]

Position identifier type.

This type is used internally to represent a position in a list. It is used to indicate that a change between zero-based indexing and one-based indexing must occur at the TecUtil boundary.

This type can be treated exactly like a Python native int and is only meaningful internally to the tecplot Python module.

class tecplot.tecutil.IndexRange(min, max, step)

Index range specification along some axis.

This is similar to Python’s slice object except that max is included in the evaluated indexes. Here are some things to note:

  • All indices start with 0 and go to some maximum index m.
  • Negative values represent the indexes starting with the maximum at -1 and continuing back to the beginning of the range.
  • A step of None, 0 and 1 are all equivalent and mean that no elements are skipped.
  • A negative step indicates a skip less than the maximum.