On Sun, Dec 12, 2010 at 6:39 AM, Jim Peterson <span dir="ltr">&lt;<a href="mailto:jimcp@cox.net">jimcp@cox.net</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Paulo,<br>
I am no Python expert, but if I understand the sequence of events, you should create the polydata object before writing the file.<br>
<br>
Hope that helps,<br>
Jim</blockquote><div><br>What Jim said.  Also, the id list is never filled in.  The following code is wrong:<br>
<br>
ids = vtkIdList()<br>
ids.SetNumberOfIds(3)<br>
<br>
for i in xrange(3):<br>
    ids.SetId(i, i)<br>
    points.InsertNextPoint(X[i],Y[i],Z[i])<br><div id=":y1">

    vertices.InsertNextCell(ids)<br><br>To fix it, you have two choices.  You can have all three verts in the same cell:<br><br>ids = vtkIdList()<br>

ids.SetNumberOfIds(3)<br>

<br>

for i in xrange(3):<br>

    ids.SetId(i, i)<br>

    points.InsertNextPoint(X[i],Y[i],Z[i])<br><br>
<div id=":y1">vertices.InsertNextCell(ids)</div><br>Or you can have each vert in its own cell:<br><br>ids = vtkIdList()<br>


ids.SetNumberOfIds(1)<br>


<br>


for i in xrange(3):<br>


    ids.SetId(0, i)<br>


    points.InsertNextPoint(X[i],Y[i],Z[i])<br>
    vertices.InsertNextCell(ids)<br><br>In the &quot;for&quot; loop, you were calling vertices.InsertNextCell(ids)<br>when &quot;ids&quot; still had some unititialized values, since the three<br>ids values were not filled in until the third loop iteration.<br>

<br>  - David<br></div>
</div></div>