[vtkusers] VTK and molecules

Geoframer geoframer at gmail.com
Thu Sep 6 06:20:20 EDT 2007


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):

points = vtk.vtkPoints()
for i in range(len(atomPts)):
    points.InsertPoint(i, atomPts[i][1][0], atomPts[i][1][1],
atomPts[i][1][2])

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.

Regards - Geoframer



On 9/6/07, Eric Germaneau <eric.germaneau at epfl.ch> wrote:
>
>  Hello,
>
> I'm a nwe pyvtk user and I've found this example<http://public.kitware.com/pipermail/vtkusers/2006-August/086395.html>code to display atoms with vtk but I get the following error:
>
> *Traceback (most recent call last):
>   File "vtkex.py", line 127, in <module>
>     actorCreator.AddBonds(sample_atoms, sample_bonds)
>   File "vtkex.py", line 38, in AddBonds
>     self.polyData.SetPoints(atomPts)
> ValueError: method requires a VTK object
>
> *Does someone can tell why it doesn't work?
> I'm looking for more examples  ....
> Thanks in advance,
>
> Regards,
>
>                      eric.
>  --
>  * "Love, Gift from Life, is given naturally."
> *
> Eric Germaneau <http://lcr.epfl.ch/page37437.html>
>  Ecole polytechnique fédérale de Lausanne (EPFL)
> FSB - IPMC
> Laboratoire de Cristallographie(LCr) <http://lcr.epfl.ch>
> BSP 518
> CH-1015 Lausanne
> Switzerland
> eric.germaneau at epfl.ch
> *Tel.*: +41 (0)21 / 693 06 36
> *Fax.*: +41 (0)21 / 693 05 04
> *msn*: aihaike at hotmail.com
> *skype*: aihaike
>
> *Please consider the environment before printing this email - Considérez
> svp l'environnement avant d'imprimer cet email*
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070906/49a3f15c/attachment.htm>


More information about the vtkusers mailing list