Desperately trying to extract data from point list

Hello

I am trying to Extract a selection of points (along a line) from a vtk block. The first part went relatively easy identifying the indices of the points I want to extract. This is what I did

YToFind = 50.
ZToFind = 0.

plx_path=r"C:\Users…"

phaseNb = 5
nameFile = plx_path+r"\1_"+str(phaseNb+1)+“0_Phase”+str(phaseNb)+"[Phase_"+str(phaseNb)+"]_nodal.pvd"

nodalPvd = PVDReader(FileName=nameFile)
GetactiveSource = GetActiveSource()
vtkBlock = paraview.servermanager.Fetch(activeSource)
vtkSource = vtkBlock.GetBlock(1).GetBlock(0)
pointsData = vtkSource.GetPointData()
nPoints = vtkSource.GetNumberOfPoints()

  •   *
    

IDSelection = []

for i in range(0, nPoints):
point = vtkSource.GetPoint(i)
if ((point[1] - YToFind)**2) < 1e-12 and ((point[2] - ZToFind)**2) < 1e-12:
IDSelection.append(i)

But then it became problematic as the FindData s does not issue the complete set of command in combination with Tracing

For instance I tried this

Qstring = '((id == ‘+str(IDSelection[0])
for i in IDSelection[1:]: Qstring = Qstring + ’ | ( id == ’ +str(i)+ ’ )’
Qstring = Qstring + ‘)’
QuerySelect(QueryString=id, FieldType=‘POINT’, InsideOut=0)

But this is not working as there are two blocks in my data and only block 2 should be considered and despite me specifying block 2 in the Find data dialog box, it does not generate the corresponding command and I am no clue on how to code it myself?

Any clue?

Thank you

I guess I finally found how to do it

ids=[]
block_id = 4
for iEntity in IDSelection:
ids.append(block_id)
ids.append(0)
ids.append(iEntity)

SelectCompositeDataIDs(IDs=ids, FieldType=‘POINT’, Source=activeSource)

using the IDSelection generation from previous posted code.

But I would really wish the FindData to be less buggy

1 Like

Great that you found a solution!

If you have suggestion on how to improve the FindData, please feel free to open an issue and to contribute to it in any way you can.