[vtkusers] Picking questions

Sherwood, P (Paul) P.Sherwood at dl.ac.uk
Wed Oct 23 11:29:10 EDT 2002


Hi All,

I am a just starting with vtk and I am using it to 
represent molecules as atoms and spheres.

I am just experimenting with picking and I am unsure how
to efficiently work out which atom was picked. I am
working in Python.

I can identify the picked property (Actor) using
picker.GetPath().GetFirstNode(), by I am not sure of the best
way to find out which atom in my model was picked. Is
there a user data component of an actor I could set
when it is created and access to indicate what it
represents when it is picked?

I notice the document to SetPickMethod for a property
indicates that a function and an argument can be stored for
each actor, this would enable me to use the argument as 
a way to work back from the actor to the originating object.
However, it seems that in the python binding SetPickMethod
only takes a single argument (the method itself).

As far as I can see I would otherwise need to implement some
look up process ( e.g. keep a dictionary relating each actor
address to the chemical object that it relates to),
but for a very long list of actors this seems rather
inelegant and maybe slow.

Also,  is there any way to pick multiple actors using something
like the rubberband selection tools many programs use these days?

Is there another way?

thanks
Paul Sherwood



More information about the vtkusers mailing list