Skip to content
Snippets Groups Projects
Commit 3280aca9 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

allow uppercase labels in STL (fixes #204)

parent c68180e3
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,7 @@ int GModel::readSTL(const std::string &name, double tolerance) ...@@ -29,7 +29,7 @@ int GModel::readSTL(const std::string &name, double tolerance)
char buffer[256]; char buffer[256];
if(!fgets(buffer, sizeof(buffer), fp)){ fclose(fp); return 0; } if(!fgets(buffer, sizeof(buffer), fp)){ fclose(fp); return 0; }
bool binary = strncmp(buffer, "solid", 5); bool binary = strncmp(buffer, "solid", 5) && strncmp(buffer, "SOLID", 5);
// ASCII STL // ASCII STL
if(!binary){ if(!binary){
...@@ -37,10 +37,12 @@ int GModel::readSTL(const std::string &name, double tolerance) ...@@ -37,10 +37,12 @@ int GModel::readSTL(const std::string &name, double tolerance)
while(!feof(fp)) { while(!feof(fp)) {
// "facet normal x y z" or "endsolid" // "facet normal x y z" or "endsolid"
if(!fgets(buffer, sizeof(buffer), fp)) break; if(!fgets(buffer, sizeof(buffer), fp)) break;
if(!strncmp(buffer, "endsolid", 8)){ if(!strncmp(buffer, "endsolid", 8) ||
!strncmp(buffer, "ENDSOLID", 8)){
// "solid" // "solid"
if(!fgets(buffer, sizeof(buffer), fp)) break; if(!fgets(buffer, sizeof(buffer), fp)) break;
if(!strncmp(buffer, "solid", 5)){ if(!strncmp(buffer, "solid", 5) ||
!strncmp(buffer, "SOLID", 5)){
points.resize(points.size() + 1); points.resize(points.size() + 1);
// "facet normal x y z" // "facet normal x y z"
if(!fgets(buffer, sizeof(buffer), fp)) break; if(!fgets(buffer, sizeof(buffer), fp)) break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment