PyTecplot, a Python-Tecplot interface, was introduced in Tecplot 360 2017 R1. In Tecplot 360 2017 R3 these Python scripts can now be recorded and played back directly in Tecplot 360. This video will cover the basics of how and when to use this new capability, and how they compare to Tecplot Macros.
Getting started with the PyTecplot interface is now much easier. “Recording” PyTecplot is performed in a similar manner to Recording Tecplot Macros. Select Scripting > Record PyTecplot to begin recording the proper PyTecplot commands.
For this video, we will record the setting of specific contour levels, which we have demonstrated in a previous video of the transient series (Frame Linking).
Perform the Actions
Once the necessary actions have been performed, we will select “Stop recording” and open the Python file in a text editor or Python IDE. In this example we can see that most of the calls have been recorded as PyTecplot commands, however a handful are using direct Macro commands. Either can be used in most cases, while the PyTecplot commands tend to be more powerful and easier to work with.
Playback Using PyTecplot
Using the PyTecplot playback is different than the familiar method of playing macros as they are executed directly from Python and “connect” to a running instance of Tecplot 360. To prepare this script for play back in Tecplot 360 we need to uncomment or insert the tecplot.session.connect() command. We also need to instruct Tecplot 360 to allow incoming connections. We do this via Scripting > PyTecplot Connections toggle on Accept connections.
Run the Script
Now we’re ready to run our script. We’ll begin with the same state that Tecplot 360 was in prior to starting the recording, then we run the Python script. This can be done from the command line, double-clicking on the file, or even run from an IDE.
PyTecplot gives you a flexible and powerful way to utilize Tecplot 360. The 2017 R3 release makes getting started with PyTecplot easy with the ability to record scripts and to interact with the results directly in Tecplot 360 using the connections capability.
Thanks for watching!