Problem cancelling vtkStlReader

I am running the vtkStlReader in a background thread to load a very large stl file. I would like to allow cancelling during the Update() call execution. I have tried calling the reader’s AbortExecuteOn() method, but that does not seem to cancel it. Is this the correct method of cancelling the execution of the Update() call? Can the call be cancelled or does it have to run to completion?

Hi @arey505

Your approach sounds correct to me as long as you call AbortExecuteOn() from a thread different than the one running vtkSTLReader::Update().

The thing is a vtkAlgorithm subclass must call CheckAbort() a few times to detect the need to abort. See this release note from v9.3.0 for details - 9.3 - VTK documentation

From a quick glance at the vtkSTLReader.cxx, it does not call CheckAbort at all. That is likely the reason why you cannot cancel it. Would you be interested in improving this?

Correct.

@arey505 please open an issue on VTK gitlab: https://gitlab.kitware.com/vtk/vtk/-/work_items?sort=created_date&state=closed&search=9.6.1&first_page_size=100

Yes, I would be interested in improving this. Can you tell me how I would go about it? It looks to be a minor change to add CheckAbort() calls to the vtkSTLReader class

Yes, the development happens on gitlab.kitware.com/vtk/vtk. Please see Develop - VTK documentation on how to get started.

entered issue #20007

https://gitlab.kitware.com/vtk/vtk/-/work_items/20007