[vtkusers] Get actors and volumes from vtkRenderer in Tcl

Johanna pettersson.johanna at home.se
Fri Aug 1 06:54:45 EDT 2003


Hi

I am attaching a tcl proc called RemoveActors in which I access all rendered actors and put them in a collection, allActors. Then I traverse this collection and remove the actors recursively.

proc RemoveActors {} {
    set allActors [ren1 GetActors]
    $allActors InitTraversal

    set nrOfItems [$allActors GetNumberOfItems]

    for {set i 0} {$i<$nrOfItems} {incr i} {
        ren1 RemoveActor [$allActors GetNextActor]
    }
    renWin Render
}

Maybe this can be of some help. I had the same trouble a while ago so check the vtkusers mailinglist for subject "Help with vtkActorCollection" or something like that. Maybe you can find more answers there.

Sincerely
Johanna



Hi,

Is there a way to get information on which actors/volumes are added to a
vtkRenderer (using Tcl)?

I need to remove actors/volumes added to a vtkRenderer, but since I
don't keep track which actors/volumes I have added I cannot just use
"RemoveActor/RemoveVolume".

"GetActors/GetVolumes" looks like the way to go, but how do I extract
the actors/volumes from the returned collections?

This only seems to print the name of the returned collection (vtkTemp0).
$renderer is a vtkRenderer with some actors attached to it:
----------------------------------------
set renderActors [$renderer GetActors]

foreach actor $renderActors {
   puts $actor	
}

=> vtkTemp0
----------------------------------------


Regards

Magnus Gedda,
Sidec Technologies


_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers






More information about the vtkusers mailing list