<div dir="ltr"><p class="MsoNormal">Hi,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span lang="EN-US">I have a
problem with the export of vtk meshes using vtkXMLWriter class. Indeed, my
project builds without any problem, but during the run, the call of the
vtkXMLWriter method Write() generates a segmentation fault.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">I works on
Windows and uses qtcreator and qmake. I uses the version 6.2 of vtk. I've
already build tutorial vtk projects using qmake to learn how to well linked
projects to vtk dlls, and it worked well.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Here is the
projet I tried to run without success (.pro and main.cpp file)</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">TEMPLATE =
app</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">CONFIG +=
console</span></p>
<p class="MsoNormal"><span lang="EN-US">CONFIG -=
app_bundle</span></p>
<p class="MsoNormal"><span lang="EN-US">CONFIG -=
qt</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">SOURCES +=
main.cpp</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">INCLUDEPATH
+= "C:\Program Files (x86)\VTK\include\vtk-6.2"</span></p>
<p class="MsoNormal"><span lang="EN-US">LIBS +=
"-LC:\Program Files (x86)\VTK\lib"</span></p>
<p class="MsoNormal"><span lang="EN-US">LIBS +=
-lvtkCommonDataModel-6.2.dll \</span></p>
<p class="MsoNormal"><span lang="EN-US">
-lvtkCommonCore-6.2.dll \</span></p>
<p class="MsoNormal"><span lang="EN-US">
-lvtkIOXML-6.2.dll</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">#include
<vtkVersion.h></span></p>
<p class="MsoNormal"><span lang="EN-US">#include
<vtkCellArray.h></span></p>
<p class="MsoNormal"><span lang="EN-US">#include
<vtkPoints.h></span></p>
<p class="MsoNormal"><span lang="EN-US">#include
<vtkXMLPolyDataWriter.h></span></p>
<p class="MsoNormal"><span lang="EN-US">#include
<vtkPolyData.h></span></p>
<p class="MsoNormal"><span lang="EN-US">#include
<vtkSmartPointer.h></span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">int main (
int, char *[] )</span></p>
<p class="MsoNormal"><span lang="EN-US">{</span></p>
<p class="MsoNormal"><span lang="EN-US"> //
Create 10 points.</span></p>
<p class="MsoNormal"><span lang="EN-US">
vtkSmartPointer<vtkPoints> points =</span></p>
<p class="MsoNormal"><span lang="EN-US">
vtkSmartPointer<vtkPoints>::New();</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> for
( unsigned int i = 0; i < 10; ++i )</span></p>
<p class="MsoNormal"><span lang="EN-US">
{</span></p>
<p class="MsoNormal"><span lang="EN-US">
points->InsertNextPoint ( i, i, i );</span></p>
<p class="MsoNormal"><span lang="EN-US">
}</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> //
Create a polydata object and add the points to it.</span></p>
<p class="MsoNormal"><span lang="EN-US"> vtkSmartPointer<vtkPolyData>
polydata =</span></p>
<p class="MsoNormal"><span lang="EN-US">
vtkSmartPointer<vtkPolyData>::New();</span></p>
<p class="MsoNormal"><span lang="EN-US">
polydata->SetPoints(points);</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> //
Write the file</span></p>
<p class="MsoNormal"><span lang="EN-US">
vtkSmartPointer<vtkXMLPolyDataWriter> writer =</span></p>
<p class="MsoNormal"><span lang="EN-US">
vtkSmartPointer<vtkXMLPolyDataWriter>::New();</span></p>
<p class="MsoNormal"><span lang="EN-US">
writer->SetFileName("test.vtp");</span></p>
<p class="MsoNormal"><span lang="EN-US">#if
VTK_MAJOR_VERSION <= 5</span></p>
<p class="MsoNormal"><span lang="EN-US">
writer->SetInput(polydata);</span></p>
<p class="MsoNormal"><span lang="EN-US">#else</span></p>
<p class="MsoNormal"><span lang="EN-US">
writer->SetInputData(polydata);</span></p>
<p class="MsoNormal"><span lang="EN-US">#endif</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> //
Optional - set the mode. The default is binary.</span></p>
<p class="MsoNormal"><span lang="EN-US">
//writer->SetDataModeToBinary();</span></p>
<p class="MsoNormal"><span lang="EN-US">
//writer->SetDataModeToAscii();</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">
writer->Write();</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">
return EXIT_SUCCESS;</span></p>
<p class="MsoNormal"><span lang="EN-US">}</span></p><p class="MsoNormal"><span lang="EN-US"><br></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks in
advance for any help.</span></p></div>