# Reveal underlying codes when executing commands in the paraView GUI

**URL:** https://discourse.paraview.org/t/reveal-underlying-codes-when-executing-commands-in-the-paraview-gui/7878
**Category:** Development
**Tags:** python
**Created:** [August 27, 2021, 10:58am UTC](https://discourse.paraview.org/t/reveal-underlying-codes-when-executing-commands-in-the-paraview-gui/7878 "2021-08-27T10:58:36Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![massisenergy](https://discourse.paraview.org/user_avatar/discourse.paraview.org/massisenergy/32/6229_2.png) [@massisenergy](https://discourse.paraview.org/u/massisenergy)
#### Post date: [August 27, 2021, 3:24pm UTC](https://discourse.paraview.org/t/reveal-underlying-codes-when-executing-commands-in-the-paraview-gui/7878/6 "2021-08-27T15:24:31Z")

</div>

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](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:

```auto
>>> # 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:

```auto
# 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](https://docs.paraview.org/en/v5.8/UsersGuide/savingResults.html#saving-datasets)  
This saves my fingers from 3or4 clicks each for 60 time-steps 😂

The code with description can be found here: [particleFraction\_numPCell\_sSMag\_UMag.ProgrammableFilter\_script](https://gitlab.com/massisenergy/paraview_scripts/-/blob/main/particleFraction_numPCell_sSMag_UMag.ProgrammableFilter_script)

---

_[View the full topic](https://discourse.paraview.org/t/reveal-underlying-codes-when-executing-commands-in-the-paraview-gui/7878)._
