Menu

#422 Import of cylinder from OpenSCAD fails

v1.0_(example)
open
nobody
1
2015-02-21
2015-02-07
No

Hello,

importing in meshlab 1.3.3 (32 bits version on Linux) a STL of a simple cylinder genrated from openscad fails.

The openscad code I use is simply the following, with fn varying, starting from 3:
cylinder(10, 10, 10, $fn=3);

With any number of faces different from 4, the import fails with the error message "Premature End of file". With $fn = 4, the import "succeeds" but only the top and bottom square are imported (4 faces as each square consists of 2 triangles).

Using admesh to attempt to fix the STL from openscad produces an STL that meshlab manage to import but the resulting mesh has no vertice nor face.

Regards,
Colin

I attach the STL produced for $fn=3, 4 and 5.

1 Attachments

Discussion

  • Colin Pitrat

    Colin Pitrat - 2015-02-07

    Here is the file for $fn=3 "fixed" by admesh. As said in initial post, it is imported but the result is empty.

     
  • Colin Pitrat

    Colin Pitrat - 2015-02-07

    And here are the files for $fn=4 and $fn=5. Sorry, I only found now how to attach multiple files at once :-)

     
  • Colin Pitrat

    Colin Pitrat - 2015-02-20

    I found what the issue is !
    It's a problem of locale.

    I'm french and therefore the locale makes scanf interpret numbers using ',' as decimal separator, not '.'.

    When running meshlab with LANG=en_US environment variable instead of LANG=fr_FR.utf8 this works well.

    The thing that is funny is that when I call ImporterSTL from a test program, it works well, ignoring my locale. I don't understand why this works differently when running meshlab.

    I'll continue to dig into this.

    Regards,
    Colin

     
  • Colin Pitrat

    Colin Pitrat - 2015-02-21

    I don't find any call to setlocale in the code.
    In main.cpp of meshlab, I find the line:
    QLocale::setDefault(QLocale::C);
    but from the doc, I understand it only impacts QT objects and methods.

    Calling setlocale in ImporterSTL::OpenAscii to query the values of LC_ALL and LC_NUMERIC:

    In my test program, I have:
    OpenAscii(/home/colin/Navlab/Cylinder3.stl): LC_ALL=C, LC_NUMERIC=C

    Whereas in meshlab, I have:
    OpenAscii(/home/colin/Navlab/Cylinder3.stl): LC_ALL=fr_FR.utf8, LC_NUMERIC=fr_FR.utf8

    Maybe it's QT or another external library that set the locales based on LANG environment variable ?

     
  • Colin Pitrat

    Colin Pitrat - 2015-02-21

    Similar issue reported previously: https://sourceforge.net/p/meshlab/bugs/127/

     

Log in to post a comment.