[vtkusers] Access first actor of vtkActorCollection

David Doria daviddoria at gmail.com
Wed Nov 20 14:33:49 EST 2013


On Wed, Nov 20, 2013 at 2:02 PM, Girault, Alexis <girault at email.unc.edu> wrote:
> Hi,
>
> I use vtkRenderWindows in which I'll use multiple actors ( for me : a
> surface and glyphs to visualize the vectors, stored in the point data of the
> surface)
>
> I need to access those actors from the renderwindow and by using
> GetRenderers()->GetFirstRenderer()->GetActors(), I am able to get  a
> vtkActorCollection *.
>
> No problem to get the last one, using vtkActorCollection::GetLastActor(),
> but what about the first one? Or the intermediate ones if I had more than
> two actors?
>
> I tried to use GetNextActor() but it always gives me a NULL pointer.
> So basically I need something like GetFirstActor() or actorList[0].
>
> I found a LOT of people on Google looking for a solution to this problem,
> but no answers.
>
> Thank you for your help,
>
> Alexis


This example demonstrates GetNextActor:

http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/DetermineActorType

If after looking at the example you don't see what you've done wrong,
if you could provide a small, compilable example of your problem,
perhaps someone can take a look.

David


More information about the vtkusers mailing list