Dear all,
I am trying to remove points from a dataset based on geometrical conditions. In order to do so I have to get the coordinates of the dataset, select which ones fulfill my conditions and then generate a new dataset with different number of pointData. I tried an approach like this one:
import vtk
from vtkmodules.vtkCommonDataModel import vtkDataSet
import vtk.numpy_interface.dataset_adapter as dsa
import numpy as np
x_old = inputs[0].GetPointData().GetArray('x')
z_old = inputs[0].GetPointData().GetArray('z')
x_new=[]
z_new=[]
cont=0
for i in range(len(x_old)) :
if x_old[i]>0.12 :
x_new.append(x_old[i])
z_new.append(z_old[i])
cont=cont+1
output.PointData.append(x_new, 'x_new')
output.PointData.append(z_new, 'z_new')
However I think that I am having errors because the length of x_new is not the same as the initial one (x_old). How could I generate a new dataset with some of the previous data points with their respective arrays? Thank you in advance!