[vtkusers] Removing al actors from a Renderer (I get multiple XYPlots in one renderer)

John Hunter jdhunter at ace.bsd.uchicago.edu
Fri Apr 4 07:24:40 EST 2003

>>>>> "Nico" == Nico Vermaas <vermaas at astron.nl> writes:

    Nico> Hi, I want to draw and update an XYPlotActor, but when I
    Nico> draw a new one (by addingAddActor2D(xyplot)) then the old
    Nico> one just also stays in there. So I need to delete the old
    Nico> one first.

    Nico> I tried this... and I do get the right count that increases
    Nico> every time I add an actor. But the Removing part does not
    Nico> work.

    Nico> Q: How do I delete all actors from a renderer?

Perhaps you need to call InitTraversal first... And are you calling
Render after you remove the actors?

  vtkActorCollection *actors = vtkActorCollection::New();
  int NumberOfActors = renderer->VisibleActorCount();

  for (int i=0; i<NumberOfActors; i++) {

John Hunter

More information about the vtkusers mailing list