python3dvtk

VTK retrieve a specific actor from a renderer


I have the following code:

my_renderer = vtkRenderer()
my_actor = vtkActor()

my_renderer.AddActor(my_actor)

Is there a way to recover a specific actor from the renderer? VtkRenderer has the following function GetActors() which returns a collection of actors but I cannot see how to identify any specific one, if say I only wanted to change the property of one of them.


Solution

  • How do you specific the wanted actor?

    One possible solution is: implement a selfActor which inherits from vtkActor. Then, record a name in selfActor. Then, you can use actor->GetName() to obtain the name. You can identify the actor by the name.