Issue with retrieving X-Coordinates from Contour Source using a Python Script

Hello, I am encoutering issues with retrieving the X coordinates from a Contour Source. I have realized a Contour source using the following commands :

“contour1 = Contour(registrationName=‘Contour1’, Input=my_input)
contour1.ContourBy = [‘POINTS’, ‘my_variable’]
contour1.Isosurfaces = [0.5]
contour1.PointMergeMethod = ‘Uniform Binning’”

I know that these commands succeded in creating a contour as the SaveData command works fine :

“SaveData(‘my_output_file_name’, proxy=contour1, PointDataArrays=[‘Normals’,‘my_variable’], FieldDataArrays=[ispatch’])”

It creates a csv that I can properly read and from which I can retrieve the X coordinates of the contour.
I wish to retrieve the X coordinates dataset without passing through the generation of a CSV file.
For this I have relentlessly been trying to descend through the “contour1” data structure to retrieve the X coordinates.

After multiple attempts I have finished by giving up after encountering the following situation :

  • contour1.GetClientSideObject().GetOutputDataObject(0).GetPointData().GetArray(‘X_Coordinates’) with no success. The error it raises is : ‘vtkmodules.vtkCommonDataModel.vtkMultiBlockDataSet’ has no attribute GetPointData.

  • Since it is a MultiBlockDataSet, I have tried to descend into a “block”. But when I do contour1.GetClientSideObject().GetOutputDataObject(0).GetNumberOfBlocks it tells me that the number of block to descend into is 0. Which means that it is not “working” MultiBlockDataSet.

I have also tried other things that I do not remember anymore sadly. I wish to understand what it is that I am doing wrong.I have actually succeeded in retrieving the Area of the contour and the volume under the contour by using the threshold treatment. I just need to understand how I can possibly get the X coordinates of the points on the Contour.

It goes without saying that I am quite a newbie to vtk and python paraview.

Tank you very much for you attention.

I am not sure this would help, but I used the following to get the XYZ coordinates of the bounding box (only min/max values) for a VTK object (e.g. contour or threhsold) within a Programmable filter.

input0 = inputs[0]
f = vtk.vtkThreshold()
f.SetInputData(input0.VTKObject)
input1 = f.GetOutput()
[xmin,xmax,ymin,ymax,zmin,zmax] = input1.GetBounds()