Hi Pierre,<div><br></div><div>This fixes has been merged into VTK. Thank you for fixing this bug.<br><br><div class="gmail_quote">On Mon, Dec 6, 2010 at 8:35 AM, Pierre Fillard <span dir="ltr"><<a href="mailto:pierre.fillard@gmail.com">pierre.fillard@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello,<br><br><br>I was trying to write a vtkMultiBlockDataSet using <b>vtkXMLMultiBlockDataWriter</b>.<br><br><br>My vtkMultiBlockDataSet is composed with multiple vtkPolyData by calling:<br>

<br><b>vtkMultiBlockDataSet *dataset = vtkMultiBlockDataSet::New();<br>

dataset->SetBlock( id, some_vtk_polydata);</b><br><br><br>Using the vtkXMLMultiBlockDataWriter to save it creates the xml file, but the <DataSet> tag remains empty (and the vtkPolyData is not saved).<br><br><br>


I tracked this problem down to the method:<br>
<br><b>vtkStdString vtkXMLCompositeDataWriter::CreatePieceFileName(int piece)</b><br><br>whose role is to return a valid filename given the block number to be written. However, I noticed that the method starts by this check:<br>



<br><b>if(this->Internal->DataTypes[piece] <= 0)<br>    {<br>    return fname;<br>    }<br></b><br><br>The array DataTypes is filled in the method:<br><br><b>void vtkXMLCompositeDataWriter::FillDataTypes(vtkCompositeDataSet* hdInput)</b><br>



<br>and contains the vtk type of each block dataset (e.g., VTK_POLY_DATA, VTK_UNSTRUCTED_GRID, etc.) such that the writer knows what extension to use, and which writer to instanciate. If the vtkDataSet is not recognized, <b>-1</b> is passed to the array.<br>



<br><br>Now, going back to <b>vtkXMLCompositeDataWriter::CreatePieceFileName()</b>, the check: <b>if(this->Internal->DataTypes[piece] <= 0)</b> invalidates data whose type is 0 (and less than 0 of course). It appears that VTK_POLY_DATA is defined as 0! So with this check, it becomes impossible to write vtkPolyData using vtkXMLMultiBlockDataWriter.<br>



<br><br>Changing the check to:<br><b><br>if(this->Internal->DataTypes[piece] <u>< 0</u>)</b><br><br>solved the problem.<br><br><br>Maybe I am missing something obvious, but in case this is a bug, I attached a patch to this mail (file IO/vtkXMLCompositeDataWriter.cxx).<br>



<br><br>Hope this will be useful.<br><br>Pierre.<br><font color="#888888"><br><br clear="all"><br>-- <br>Pierre Fillard, Ph.D.,<br>Research Scientist<br>INRIA Parietal - Neurospin<br>Bāt 145, Point Courrier 156<br>91191 Gif/Yvette, France<br>


tel: +33 1 69 08 79 92<br>

</font><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Robert Maynard<br>
</div>