diff --git a/libsrc/stlgeom/stltopology.cpp b/libsrc/stlgeom/stltopology.cpp index a1a1ef61..62f931b8 100644 --- a/libsrc/stlgeom/stltopology.cpp +++ b/libsrc/stlgeom/stltopology.cpp @@ -338,6 +338,18 @@ void STLTopology :: Save (const char* filename) const STLGeometry * STLTopology ::Load (istream & ist) { + // Check if the file starts with "solid". If not, the file is binary + { + char buf[5+1]; + FIOReadStringE(ist,buf,5); + if (strcmp(buf, "solid") != 0) + { + for (auto i : Range(5)) + ist.unget(); + return LoadBinary(ist); + } + } + STLGeometry * geom = new STLGeometry(); NgArray readtrigs;