It doesn't work because the code is trying to pass a tuple atomPts (sample_atoms) to self.polyData.SetPoints. This function requires a vtkPoints object and not a tuple. Converting it is a possibility and can be done like this (add this in the AddBonds function):
<br><br>points = vtk.vtkPoints()<br>for i in range(len(atomPts)):<br> points.InsertPoint(i, atomPts[i][1][0], atomPts[i][1][1], atomPts[i][1][2])<br><br>However fixing this one error message will only lead to more. I think you're perhaps better of creating something more simple yourself first and then when you understand the VTK structure a bit better look at the code again and try to debug it.
<br><br>Regards - Geoframer<br><br><br><br><div><span class="gmail_quote">On 9/6/07, <b class="gmail_sendername">Eric Germaneau</b> <<a href="mailto:eric.germaneau@epfl.ch">eric.germaneau@epfl.ch</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ccccff" text="#000000">
Hello,<br>
<br>
I'm a nwe pyvtk user and I've found <a href="http://public.kitware.com/pipermail/vtkusers/2006-August/086395.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">this
example</a> code to display atoms with vtk but I get the following
error:<br>
<br>
<i><font color="#cc0000">Traceback (most recent call last):<br>
File "vtkex.py", line 127, in <module><br>
actorCreator.AddBonds(sample_atoms, sample_bonds)<br>
File "vtkex.py", line 38, in AddBonds<br>
self.polyData.SetPoints(atomPts)<br>
ValueError: method requires a VTK object<br>
<br>
</font></i><font color="#cc0000"><font color="#000000">Does someone can
tell why it doesn't work?<br>
I'm looking for more examples ....<br>
Thanks in advance,<br>
<br>
Regards,<br>
<br>
eric.<br>
</font></font>
<div>-- <br>
<center>
<em>
"Love, Gift from Life, is given naturally."<br>
</em>
<br>
<a href="http://lcr.epfl.ch/page37437.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Eric Germaneau</a>
<br>
<small>
Ecole polytechnique
fédérale de Lausanne (EPFL)
<br>
FSB - IPMC <br>
<a href="http://lcr.epfl.ch" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Laboratoire
de
Cristallographie(LCr)</a> <br>
BSP 518 <br>
CH-1015 Lausanne <br>
Switzerland <br>
<a href="mailto:eric.germaneau@epfl.ch" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">eric.germaneau@epfl.ch</a><br>
<em>Tel.</em>: +41 (0)21 / 693 06 36<br>
<em>Fax.</em>: +41 (0)21 / 693 05 04<br>
<em>msn</em>: <a href="mailto:aihaike@hotmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">aihaike@hotmail.com</a><br>
<em>skype</em>: aihaike<br>
<br>
<em><font style="color: green;" color="#008000" face="Times">Please
consider the environment before printing this email - Considérez
svp l'environnement avant d'imprimer cet email</font></em>
</small></center>
</div>
</div>
<br>_______________________________________________<br>This is the private VTK discussion list.<br>Please keep messages on-topic. Check the FAQ at: <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>Follow this link to subscribe/unsubscribe:<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers
</a><br><br></blockquote></div><br>