Get specific spreadsheet cell data from Integrate Variable generated spreadsheets

I would like to create a ParaView python script to compute volumes of specific sub regions of the mesh (obtained via Threshold), and then print the volume to a file.

Currently, I am able to use Threshold, followed by Integrate Variables to generate a spreadsheet, which can be exported using the ExportView function. However, this exports the entire spreadsheet generated by Integrate Variables, whereas I would like to only print out the ‘Volume’.

I attempted to use spreadSheetView1.GetCellData().GetArray(‘Volume’).GetValue(0), but it appears that the spreadSheetView class does not have those functions.

Any help in extracting the Volume directly data from the spreadsheet object without resorting to bash commands would be appreciated.


You can use the Pass Arrays filter to pass along specific arrays in the pipeline.

My understanding is that PassArrays extracts arrays, which one can than export to csv.

In my case, I want to be able to access the values extracted by the PassArrays in the python script itself.

Something along the lines of:
%% Create a pass array using integrate variables
passArrays1 = PassArrays(Input=integrateVariables1)

%% Extract the Volume array
passArrays1.CellDataArrays = [‘Volume’]

%% Get the Cell Data from the Volume array
passArrays1CellData = passArrays1.GetCellData()

%% Print the first element of the Cell Data array to screen

This doesnt work since the passArrays1 class has no member GetCellData.


You are looking for servermanager.Fetch.

Thanks Mathieu. I attempted to use the servermanager to extract the desired data, using the following code:

%%% Create the integrate variables object 
integrateVariables1 = IntegrateVariables(Input=threshold1)

%%% Create a server manager object
iv_data = paraview.servermanager.Fetch(integrateVariables1)

%%% Use the server manager object to extract the requisite data    

This kind of approach seems to have worked for another user, see here:

However, I get an error saying,

Traceback (most recent call last):
  File "", line 172, in <module>
AttributeError: 'NoneType' object has no attribute 'GetValue'

My apologies. The array ‘Volume’ did not exist in the integrateVariables1 object. In fact, it appears that it belongs to the spreadSheet object. A combination of passArrays and serverManager Fetch acting on the spreadSheet worked for me.

# create a new 'Integrate Variables'
integrateVariables1 = IntegrateVariables(Input=threshold1)   

# Create a new 'SpreadSheet View'
spreadSheetView1 = CreateView('SpreadSheetView')       

# create a new 'Pass Arrays'
passArrays1 = PassArrays(Input=integrateVariables1)
passArrays1.CellDataArrays = ['Volume', 'temperature(K)']

# Properties modified on passArrays1
passArrays1.CellDataArrays = ['Volume']    

# update the view to ensure updated data information

ss_data = paraview.servermanager.Fetch(passArrays1)    

Thank you for the help and response.

1 Like