How to add a custom array to a polydata in paraview?

前端 未结 2 1942
南笙
南笙 2021-01-13 20:56

I know that I can use the Calculator filter for operations on arrays, but I want to perform some more complicated computations. I managed to do it in Paraview python shell,

2条回答
  •  攒了一身酷
    2021-01-13 21:20

    Better approach would be use the Programmable Filter to add the array to your input dataset. In ParaView 4.1, the following script can be added to the Script on Properties panel for the Programmager Filter

    polydata = output
    array = vtk.vtkIntArray()
    array.SetNumberOfComponents(0)
    array.SetName("regionsize")
    for i in range(polydata .GetNumberOfPoints()):
        array.InsertNextValue(somecomputedvalue)
    polydata.GetPointData().AddArray(array);
    

提交回复
热议问题