<html><head><style type="text/css">body{font:12px Arial;margin:3px;overflow-y:auto;overflow-x:auto}p{margin:0px;}blockquote, ol, ul{margin-top:0px;margin-bottom:0px;}</style></head>
<body><div style="display: block; font-family: Arial; font-size: 12px;">Hi,<br>
<br>
I am rather new to VTK and I am currently<br>
working on a molecular visualization programm.<br>
<br>
I am able to visualize the molecule using spheres<br>
and cylinders, pick spheres (atoms)<br>
in my scene and change their color (or other properties).<br>
<br>
Now I would like to get the position of the picked object<br>
in the loop used to create these objects. More precisely,<br>
I would like to get the value of "i" (see the example below) <br>
corresponding to the selected object so that I can use<br>
list[i] (list is a vector and len(list) is its length)<br>
<br>
part of the python code is:<br>
<br>
for i in range(len(list)):<br>
.....<br>
atom = vtk.vtkSphereSource()<br>
atom.SetRadius(radius)<br>
atom.SetThetaResolution(50)<br>
...<br>
atomMapper = vtk.vtkPolyDataMapper()<br>
atomMapper.SetInput(atom.GetOutput())<br>
atomActor = vtk.vtkActor()<br>
atomActor.SetMapper(atomMapper)<br>
atomActor.SetPosition(pos)<br>
...<br>
<br>
<br>
picker = vtk.vtkPropPicker()<br>
picker.AddObserver("EndPickEvent", aPick)<br>
...<br>
<br>
def aPick(object, event):<br>
if (picker.GetActor()):<br>
picker.GetActor().GetProperty().SetColor(0,2,2) #used to highlight the picked atom<br>
<br>
<br>
Could you please help me or suggest me how to solve this problem?<br>
<br>
Thank you very much<br>
Sam Wolfow<br>
<br></br><p style="margin-top:11px;padding-top:3px;background-image: url(http://mail.lycos.co.uk/Images/Mail/_content/dot.gif);background-repeat: repeat-x;background-position: 0px 0px;"><img src="http://premiummail.caramail.lycos.fr/Images/Mail/_icons/premium.gif"><font color="#CC0000"><b> 300 Mo gratuits sur CaraMail : </b></font><a href="http://secure.caramail.lycos.fr/services/signin/mail.jsp?TARGETCODE=FR_footermail_link" target="_blank">Cliquez ici pour en profiter!</a></div></body></html>