vtkHardwareSelector and Unstructured Grids

I’m in the midst of updating my python code to use vtkHardwareSelector instead of vtkCellPicker to select cells because of slowness with vtkCellPicker as my models get larger. With vtkCellPicker, it was easy to get the correct cell ID. With vtkHardwareSelector, I get a cell ID, but its not one that’s in the original unstructured grid. I assume this is because it’s returning the corresponding PolyData cell ID. How do I get back to the original unstructured grid cell ids?

It looks like this issue is similar to one that was asked without an answer here: How to select a hexahedral cell using HardwareSelector

Thanks for any help,
Robert

The basic idea is to ensure that you have an array of the cell/point ids that is preserved through the rendering process so that you can lookup the original cell/point id from the unstructured grid corresponding to the polydata’s id that you get from the selection process.

See: https://vtk.org/doc/nightly/html/classvtkDataSetSurfaceFilter.html#a3c5cbea7c4e1dbcc0978993149cc9e6f