[vtkusers] Picking questions
prabhu at aero.iitm.ernet.in
Wed Oct 23 13:07:36 EDT 2002
>>>>> "PS" == P Sherwood <Sherwood> writes:
PS> I am just experimenting with picking and I am unsure how to
PS> efficiently work out which atom was picked. I am working in
PS> I can identify the picked property (Actor) using
PS> picker.GetPath().GetFirstNode(), by I am not sure of the best
PS> way to find out which atom in my model was picked. Is there a
PS> user data component of an actor I could set when it is created
PS> and access to indicate what it represents when it is picked?
If you are using VTK 4.0+ then you can use observers to do this
easily. Here is a quick example using MayaVi's ivtk module (for
from mayavi import ivtk
cs = vtk.vtkConeSource()
m = vtk.vtkPolyDataMapper()
a = vtk.vtkActor()
v = ivtk.viewer()
def test(obj, event):
print "Event", event, "occured"
Now press 'p' on the viewer window near one of the vertices of the
cone and see your test function in action.
PS> Also, is there any way to pick multiple actors using something
PS> like the rubberband selection tools many programs use these
No clue if there is something to do this already but I guess you can
write some code to do this. However it might take some work.
More information about the vtkusers