[vtkusers] vtkPolyDataWriter: comma decimal mark instead of dot decimal mark

Romain LEGUAY romain.leguay at gmail.com
Mon Aug 28 11:10:26 EDT 2017


Thank you David for your quick answer!

If I have some time I will do those fixes and send a patch.

Romain

> Le 28 août 2017 à 17:03, David Gobbi <david.gobbi at gmail.com> a écrit :
> 
> Hi Romain,
> 
> I suspect that VTK could be fixed if someone simply added a call to "imbue(std::locale::classic())" to vtkDataWriter::OpenVTKFile(), e.g.:
> 
>     fptr = new std::ostringstream;
>     fptr->imbue(std::locale::classic());
> 
> and
> 
>     fptr = new ofstream(this->FileName, ios::out);
>     fptr->imbue(std::locale::classic());
> 
> If you have built VTK from source, you can try making the above change to see if it fixes the issue (the vtkDataSetReader might also need to be fixed, as well as many other IO classes).
> 
>  - David
> 
> 
> On Mon, Aug 28, 2017 at 8:33 AM, Romain LEGUAY <romain.leguay at gmail.com <mailto:romain.leguay at gmail.com>> wrote:
> Hi everyone,
> 
> I have a little issue when I try to write then read a polydata.
> 
> This is the code I use to write  then read my polydata inside a string (not a file):
> 
> // Writing part
> vtkSmartPointer<vtkPolyDataWriter> writer = vtkSmartPointer<vtkPolyDataWriter>::New();
> writer->WriteToOutputStringOn();
> writer->SetInputData(myPolyData);
> writer->Update();
> 
> char * data = writer->GetOutputString();
> 
> 
> // Reading part
> vtkSmartPointer<vtkPolyDataReader> polyReader = vtkSmartPointer<vtkPolyDataReader>::New();
> polyReader->ReadFromInputStringOn();
> polyReader->SetInputString(data);
> polyReader->Update();
> vtkSmartPointer<vtkPolyData> polyData = polyReader->GetOutput();
> 
> 
> Unfortunately, when I try to read the data, I have some error indicating some Unrecognized symbols: the decimal mark is a comma instead of a dot.
> 
> Can we change easily this comportement or force VTK to write with dot decimal mark?
> 
> I know the command std::setlocale but I would like to know if there is another way to fix this problem.
> 
> Thank you!
> 
> Romain

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170828/48578fbe/attachment.html>


More information about the vtkusers mailing list