# reading ascii stl files with QVTK

**URL:** https://discourse.vtk.org/t/reading-ascii-stl-files-with-qvtk/3622
**Category:** Support
**Created:** [June 23, 2020, 8:05am UTC](https://discourse.vtk.org/t/reading-ascii-stl-files-with-qvtk/3622 "2020-06-23T08:05:55Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![mat](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mat](https://discourse.vtk.org/u/mat)
#### Post date: [June 23, 2020, 8:05am UTC](https://discourse.vtk.org/t/reading-ascii-stl-files-with-qvtk/3622/1 "2020-06-23T08:05:55Z")

</div>

Hello,  
I am trying to make a script work on ubuntu 18.04, with python 3.6, vtk 9.0.0 and Pyside2.

vtkSTLReader can read both binary and ascii files when used with a **vtkRenderWindowInteractor**. But, when I use a **QVTKRenderWindowInteractor** , it can only read binary stl files, it makes an error when reading a ascii file.

Unfortunatly I am not allowed to upload files here. But the script and the stl files are avalaible here : [https://gitlab.kitware.com/vtk/vtk/-/issues/17939](https://gitlab.kitware.com/vtk/vtk/-/issues/17939)

If you have any idea why, I’d appriciate your help 😉

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [June 23, 2020, 8:11pm UTC](https://discourse.vtk.org/t/reading-ascii-stl-files-with-qvtk/3622/2 "2020-06-23T20:11:00Z")

</div>

vtkSTLReader works the same way, regardless how its output is used (if it is rendered at all or if it is used with a particular render window interactor class).

If you do see a difference only because you use Qt or not then it might be because some global application settings are changed. For example, if you use non-ASCII characters in the STL filename or content then you may get different results depending on the application’s code page.

---

<div class="post-metadata">

### Author: ![mat](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mat](https://discourse.vtk.org/u/mat)
#### Post date: [June 24, 2020, 8:56am UTC](https://discourse.vtk.org/t/reading-ascii-stl-files-with-qvtk/3622/3 "2020-06-24T08:56:43Z")

</div>

Thank you Andras, you pointed me in the right direction.  
It was not non-ascii characters, it was the decimal character. I am french and we use the coma as a decimal marker rather than a dot. (An american would write 0.1 and a french 0,1)

When I was using QTVK the stlReader somehow was expecting the french format for decimals instead of the usual one (I tested replacing all dots by comas in the file and it can now be read). So I ll try to find a way for QTVK to not inherit regional settings.

It could be good maybe to change the stlReader in future versions to not be affected by this.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [June 25, 2020, 9:34pm UTC](https://discourse.vtk.org/t/reading-ascii-stl-files-with-qvtk/3622/4 "2020-06-25T21:34:06Z")

</div>

Thanks for the update, I’ve filed a bug report: [https://gitlab.kitware.com/vtk/vtk/-/issues/17951](https://gitlab.kitware.com/vtk/vtk/-/issues/17951)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [June 26, 2020, 2:01am UTC](https://discourse.vtk.org/t/reading-ascii-stl-files-with-qvtk/3622/5 "2020-06-26T02:01:44Z")

</div>

Not a vtk issue imo.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [June 26, 2020, 2:48am UTC](https://discourse.vtk.org/t/reading-ascii-stl-files-with-qvtk/3622/6 "2020-06-26T02:48:04Z")

</div>

VTK’s STL reader/writer does not work correctly when used in an application configured with a non-US locale. This has come up a many times before, just google for `vtk decimal comma`. This can be quite easily fixed in VTK and really hard to work around at application level.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [June 26, 2020, 2:53am UTC](https://discourse.vtk.org/t/reading-ascii-stl-files-with-qvtk/3622/7 "2020-06-26T02:53:44Z")

</div>

VTK is respecting the locale asked by the application. See the link in the issue.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [June 26, 2020, 3:40am UTC](https://discourse.vtk.org/t/reading-ascii-stl-files-with-qvtk/3622/8 "2020-06-26T03:40:58Z")

</div>

OK, let’s [continue the discussion in the bugtracker](https://gitlab.kitware.com/vtk/vtk/-/issues/17951).
