[vtkusers] vtkXMLUnstructuredGridWriter Problem

Brad King brad.king at kitware.com
Thu Jun 12 13:30:28 EDT 2003


> I was wondering if anyone has used vtkXMLUnstructuredGridWriter to write
> a XML file without missing the "NumberOfPoints" attribute of <Piece>,
> because in my case, that attribute was missing. If you did, then I was
> probably doing sth wrong. Thanks for any sharing and/or help!

I'm guessing you're using VTK 4.2.  This is a bug that has been fixed for
a few weeks in the CVS version.  The fix will be included in VTK 4.2.3.
For now, you can make the fix yourself:

In VTK/IO/vtkXMLUnstructuredGridWriter.cxx, make this change:

void vtkXMLUnstructuredGridWriter::WriteInlinePieceAttributes()
{
  vtkUnstructuredGrid* input = this->GetInput();
  this->WriteScalarAttribute("NumberOfCells", input->GetNumberOfCells());
}

becomes

void vtkXMLUnstructuredGridWriter::WriteInlinePieceAttributes()
{
  this->Superclass::WriteInlinePieceAttributes(); // <---- add this line
  vtkUnstructuredGrid* input = this->GetInput();
  this->WriteScalarAttribute("NumberOfCells", input->GetNumberOfCells());
}

-Brad




More information about the vtkusers mailing list