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?