<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:'Times New Roman',Times,serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi All,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">I tried to read an STL file using <span style="font-family: "Times New Roman", Times, serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
vtkSTLReader</span> from a directory as follows:</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">-------------------------</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div>QString fileName = QFileDialog::getOpenFileName( this, tr("Open File"), "C:\\", tr("Mesh (*.stl *.vtk)"));</div>
<div><span style="white-space:pre"></span>if (fileName.isNull()) //user cancelled</div>
<div><span style="white-space:pre"></span>return EXIT_FAILURE;</div>
<div><br>
</div>
<div><span style="white-space:pre"></span>m_imagePath = fileName;</div>
<div><span style="white-space:pre"></span>//Create an STL reader for reading the file</div>
<div><span style="white-space:pre"></span>vtkSmartPointer<vtkSTLReader> reader = vtkSmartPointer<vtkSTLReader>::New();</div>
<div><span style="white-space:pre"></span>//reader->SetFileName(pathName.c_str());</div>
<div><span style="white-space:pre"></span>reader->SetFileName(fileName.toStdString());</div>
<div><span style="white-space:pre"></span>reader->Update();</div>
-------------------------
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">But, I've got the following error :</p>
<p style="margin-top:0;margin-bottom:0"><span>'vtkAbstractPolyDataReader::SetFileName' : cannot convert parameter 1 from 'std::string' to 'const char *'</span><br>
</p>
<p style="margin-top:0;margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0;margin-bottom:0"><span>Could you please propose a solution for this issue?</span></p>
<p style="margin-top:0;margin-bottom:0"> </p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
</div>
</body>
</html>