Extracting Selected Points To An Array (Python Scripting)

(Marlon Calvo) #1

I am trying to extract the selected point numbers (I think ParaView refers to them as indeces?), into some data structure: let’s say an array.

When I select any number of points, I wish to extract all selected notes into some array like so:

Node Selected
      1            
      3             
      5             
      306

How would I be able to achieve this with a VTK object in my Pipeline?

(EDIT)
Important to note that selection will be done through the GUI Selecting Points Options.

#2

Hi Marlon,
I may have problems understanding you correctly, but maybe some of this helps anyway.

Selection in scripting instead of via mouse can be done like this:
for i in range(306): selection = SelectCells(query="id==" +str(i))
This is only useful if you want to select all cells, like after a contour filter or such.
You can then use the selection for example:
plotSelectionOverTime = PlotSelectionOverTime(Input=contour1, Selection=selection)

As far as I know the ability to select via mouse and have paraview write that down in a trace is not implemented yet, but will be soon.

However if scripting is not needed you might just select your points and use Generate Ids. You then have an array that might fit your needs.

Greetings Terry