Reveal underlying codes when executing commands in the paraView GUI

Solved, thanks to @mwestphal, and @mohammad_faghih for this post discussion: https://discourse.paraview.org/t/writing-a-pyhon-script-to-semi-automate-generation-of-csv-file-for-streamlines/6827.

For future reference, I am already using paraView in remoteServer-localClient mode, there are two ways to do it:

  1. Exported into local client disk:

Use GUI menu option view > Python Shell, run the code below:

>>> # get animation scene
animationScene1 = GetAnimationScene()

# Properties modified on animationScene1
animationScene1.AnimationTime = 9.0

# get the time-keeper and the active view
timeKeeper1 = GetTimeKeeper()
spreadSheetView1=GetActiveView()
# export view
ExportView('/Users/massisenergy/Downloads/22GBQC_particleFoam_mT250duration_pPS2500_T10sec.csv', view=spreadSheetView1, RealNumberNotation='Mixed',
    RealNumberPrecision=8)
>>> # get animation scene
animationScene1 = GetAnimationScene()
# Properties modified on animationScene1
animationScene1.AnimationTime = 9.0
# get the time-keeper 
timeKeeper1 = GetTimeKeeper()
# get the active view
spreadSheetView1=GetActiveView()
# export view
ExportView('/Users/massisenergy/Downloads/22GBQC_particleFoam_mT250duration_pPS2500_T9sec.csv', view=spreadSheetView1, RealNumberNotation='Mixed',
    RealNumberPrecision=8)

the resulting .csv file will be for single time step and written in the specified local directory.

  1. Exported into remote server disk:
  • this can be revealed done via the GUI like this: Select the data in the GUI to be exported, in my case, ProgrammableFilter1 > File > Save Data (⌘S) > Choose csv > CSVWriter pops up.

  • the reproducible way is to use the Trace tool mentioned before, from where the code can be copy-pasted into the Python Shell & fine-tuned more:

# save data
SaveData('/home/massisenergy/autoMount/Data_Documents/Dox_ownCloud/openFoamDataSR/E3DBP_Nozzle/ResTimeDistribution/22G_blunted/22GBQuarterCyl_simpleFoam/22GBQC_particleFoam/VTK_22GBQC_particleFoam_mT250duration_pPS2500/22GBQC_particleFoam_mT250duration_pPS2500.csv', proxy=programmableFilter1, WriteTimeSteps=1,
    Filenamesuffix='_%d',
    ChooseArraysToWrite=0,
    PointDataArrays=[],
    CellDataArrays=['U', 'cellID', 'kinematicCloudTheta', 'numPCell', 'shearStress', 'volCellP', 'volFracP'],
    FieldDataArrays=[],
    VertexDataArrays=[],
    EdgeDataArrays=[],
    RowDataArrays=[],
    Precision=5,
    UseScientificNotation=1,
    FieldAssociation='Cell Data',
    AddMetaData=1,
    AddTime=1)

Documentation for saving data is here: https://docs.paraview.org/en/v5.8/UsersGuide/savingResults.html#saving-datasets
This saves my fingers from 3or4 clicks each for 60 time-steps :joy:

The code with description can be found here: particleFraction_numPCell_sSMag_UMag.ProgrammableFilter_script

1 Like