I’m experimenting with various strategies to support rubber band picking and I’ve been successful when using vtkExtractGeometry to do the picking, but I see some advantages if I can switch to using vtkExtractSelection, vtkSelection and vtkSelectionNode.
Unfortunately, when I follow the most relevant examples I can find, I’m getting a hard crash. (VTK 8.2, Python on WIndows 10)
The relevant code fragment is below, and I suspect that the problem is how I’m populating the vtkSelectionNode SelectionList with the frustum data…
self.Mesh is a vtkUnstructuredGrid
frustum = self.GetInteractor().GetPicker().GetFrustum()
selectionNode = vtk.vtkSelectionNode()
selectionNode.SetFieldType(1) # Points
# CELL_DATA = 0
# POINT_DATA = 1
# FIELD_DATA = 2
# VERTEX_DATA = 3
# EDGE_DATA = 4
selectionNode.SetContentType(5) # FRUSTUM
# SELECTIONS = 0
# GLOBALIDS = 1
# PEDIGREEIDS = 2
# VALUES = 3
# INDICES = 4
# FRUSTUM = 5
# LOCATIONS = 6
# THRESHOLDS = 7
# BLOCKS = 8
# This is where I think think things are wrong....
selectionNode.SetSelectionList(frustum.GetPoints().GetData())
selection = vtk.vtkSelection()
selection.AddNode(selectionNode)
extractSelection = vtk.vtkExtractSelection()
extractSelection.SetInputData(0, self.Mesh)
extractSelection.SetInputData(1, selection)
extractSelection.Update()
Any help will be gratefully received…
Doug