I’m writing a viewer with python 3.5 and Qt5, using PySide2.
How do I completely wipe or unload the existing mesh from a rendering window? I just want the existing mesh to disappear when I click a button.
I’m rendering into a QVTKRenderWindowInteractor widget, I tried setting the actor to None, and other things that frankly I can’t remember, and nothing worked: either the last loaded mesh stayed stubbornly in the window, or else the window went black and I couldn’t load a new mesh.
It sounds like you might need to remove the actor from the renderer with vtkRenderer.RemoveActor(actor)
and pass in your actor object before setting it to None
. Just deleting the actor isn’t sufficient because the renderer will hold a reference to the actor object.
To completely clear the renderer, you can call vtkRenderer.RemoveAllViewProps()
.
@cory.quammen, RemoveAllViewProps is exactly what I was looking for, thanks!