Macro scripting for animation of concurrent frames

Hi all,

I had a quick question. Is there a Python scripting command list for macro creation in PV? I tried to find and follow the information from the user guide, but was not sure if that was the entire list of commands. I would think not but I am unfamiliar with Python at the moment. I ask as I have multiple files (named _1.case, _2.case, and so on) and wish to create a loop to read these successive data sets into the same save state file and generate an animation from the render frames I have setup. Namely, I know the commands from the Python interface in PV to setup the frames (from user guide), but was not sure if there were specific commands to read consecutive files in a given path by means of a successive loop.

I cannot load all of the files simultaneously as there are 200 files with each being multiple GBs in size.

If anyone has any slight pointers I would appreciate it. This was the approach I did in Tecplot and is something I am sure I can do here as I like PV much better and wish to use it fully. But my concern lies with if there was any specific PV commands to be used for such scripting in PV. Thank you.

I’m not really clear on what you want to do, but If you want to loop on the file in a directory to create a reader to open each file and closing it, a simple loop should work without issues.

Something like :

import os
import gc

for filename in os.listdir(directory):
    if filename.endswith(".case"): 
         reader=OpenDataFile(filename)
# do stuff
         Delete(reader)
         del reader
         gc.collect()
        continue
    else:
        continue

Hello,

Yes the idea is I want to setup a single .pvsm state file and successively load numbered files in order and calculate say the magnitude of the gradient of some field variable for each file and generate an animation of sorts/ export screenshots of each file. This sample script is very helpful so thank you. My idea is I want to make an animation with the exported screenshots (png). I saw the manual online after making the initial post and saw some sample scripts, but I am still new to the scripting and animation tools.

-Partth

In this case, you want to use the file series mechanism. Just number your file like file1.case, file2.case, and open file..case instead.

Yea I saw this can use the legacy format. Is it ok if the files are also having the syntax: file_1.case, file_2.case, etc?

If so I just need to use adjust the script for file export. Thanks.

-Partth

Yes it is ok.