Adding a new attribute (data array )

Hi all,
(Paraview V 4.3.1 )

I am trying to add a new Attribute (data array of scalar values) associated to the points of a Delaunay Mesh I have in Paraview. I would like that once it is selected from the GUI, it would show the associated colors and the range of values bar.

I have tried using the methods: .GetPointData().AddArray(array) and other methods available online, which did not work for me.

I would really appreciate if you could help me with this subject.

Thanks in advance for your help!



First I would suggest upgrading to ParaView 5.5 if possible.
It is not clear where you want to add the array ? in a VTK C++ code ? In this case do not forget to set a name to your array.

Hi Mathieu,

Thanks for your answer. I was able to finally install the V. 5.5.2.

I have a mesh of type: multiblock dataset, and I want to add the array by using pvpython in Paraview. I have noticed that it is possible to create these arrays by using the programmable filter. I checked the examples here, and also the associated links:

However, I haven’t been able to create the array of scalars I want because the information I have found so far is mainly for meshes which are not multiblock dataset. From the mesh I have I would like to do:

pdo.GetPointData().SetScalars(vals1) like in the example of the helix:

However, this methods work for non multiblock datasets,


Where do vals come from ? Can you share your multiblock dataset ?

Vals1 comme from an array of scalars (type: vtk.vtkDoubleArray()) I calculate using pvpython.

No, I can’t, but here is the specific mesh type I work with:



You should indeed use a Python Programmable Filter, iterate over your multiblock dataset, and add your vals in each leaf dataset.

iter = mb.NewTreeIterator()
while not iter.IsDoneWithTraversal():
  obj = iter.GetCurrentDataObject()
  pd = obj.GetPointData()

Thank you so much!

The code worked just fine :slight_smile: