Li, I don't know of a way to add a name or other identifier to a vtkObject.
It might be easier to have an auxiliary data structure that stores references to the vtkActors and lets you set the visibility by accessing the vtkActor through that data structure. I tend to find this easier than working with the VTK structures directly. For example, you might just use a map from your program-specific data structure to the vtkActor that represents it. Hope that helps, Cory On Fri, May 11, 2012 at 3:49 PM, Li Guan <li.9...@gmail.com> wrote: > Dear all, > > I would like to change the visibility property of a specific actor in > the renderer. Right now, I need to remember which orderly ID my actor > is in the actor list and iterate through the following to get to the > actor, > > vtkPropCollection* props = renderer->GetViewProps(); > props->InitTraversal(); > for(int i = 0; i < props->GetNumberOfItems(); i++){...} > > This is quite complicated, and once one actor in the list is removed, > the ID may change. > Is there a way to set a name to an actor, and just traverse though the > list to search for the actor with the specific name? > > Or there is a correct way to do so that I do not know of yet. > > Thanks in advance, > > Li > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the ParaView Wiki at: > http://paraview.org/Wiki/ParaView > > Follow this link to subscribe/unsubscribe: > http://www.paraview.org/mailman/listinfo/paraview -- Cory Quammen Research Associate Department of Computer Science The University of North Carolina at Chapel Hill _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview