<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<P>>>idx = 0<BR>>>for i in range(0,2*nz):<BR>>> for j in range(0,2*ny):<BR>>> for i in range(0,2*nx):<BR>^^^^^^^<BR>>> pts.SetPoint(idx, nanna[0,idx], nanna[1,idx], nanna<BR>[2,idx])<BR>>> idx = idx + 1 <BR><BR>>you realize you're using the 'i' as an index twice, right? I'm not<BR>>a python expert but you should be sure this is what you want.<BR><BR>Thanks Tom, it was my mistake... the results didn't change, anyway. It is still <BR>slow...<BR></P></BLOCKQUOTE>
<P>I had exactly the same problem. It's slow because each call to SetPoint from Python calls SetPoint from vtk c++ code through vtk python wrapper code (which does parameters checks, etc...), so 99% of the time is spent in the wrapper code. That's why it is so slow.</P>
<P>So I moved my code to C++ and wrapped it with swig in order to use it from Python. I wrote this article which explains how to deals with vtk, python and swig :</P>
<P><A href="http://coding.bug.free.fr/lib/vtk/vtkpythoncpp.htm">http://coding.bug.free.fr/lib/vtk/vtkpythoncpp.htm</A></P>
<P>If you plan to use this solution, be aware that this code has memory leaks, I have to update the example and add calls to Delete() for each object allocated before returning.</P>
<P> </P><BR><BR>Aurélien REGAT-BARREL<p>
                <hr size=1>
Créez gratuitement votre Yahoo! Mail avec <font color="red"><b>100 Mo de stockage !</b></font>
<br><a href="http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/mail/mail_taglines_100/default/*http://fr.benefits.yahoo.com/">Créez votre Yahoo! Mail</a>
<br><br>
Dialoguez en direct avec vos amis grâce à <a href="http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.messenger.yahoo.com/">Yahoo! Messenger !</a>