[vtkusers] picking actor

John Hunter jdhunter at ace.bsd.uchicago.edu
Wed Apr 2 15:17:53 EST 2003


I have a class Marker that is derived from vtk.vtkActor in python, and
a scene that is populated with a number of these markers and some
other actors that I don't want to pick.  I pick a marker with

    picker = vtk.vtkPropPicker()
    picker.PickProp(x, y, renderer, markers)
    actor = picker.GetActor()
    if actor is None: return

where markers is a vtkActorCollection of the actors I'm interested in.
This code successfully picks the actor under point; eg, if I call
actor.SetVisibility(0), it becomes invisible.

However, when I get the string representation of the actor, it reports
itself as a vtkOpenGLActor, and does not have the attributes of my
derived class.  I need to be able to get the instance of my derived
class.  I can imagine a way to hack this out, eg by comparing some
attribute of the vtkOpenGLActor with the instances of my Marker class
(like the center, which will be unique for my markers), but I suspect
there is an elegant, right way to do it.

Thanks,
John Hunter



More information about the vtkusers mailing list