}
Standard_IStream aStream (&aBuf);
- if (IsAscii (aStream))
- {
- // get length of file to feed progress indicator
- aStream.seekg (0, aStream.end);
- std::streampos theEnd = aStream.tellg();
- aStream.seekg (0, aStream.beg);
- return ReadAscii (aStream, theEnd, theProgress);
- }
- else
+
+ // get length of file to feed progress indicator in Ascii mode
+ aStream.seekg (0, aStream.end);
+ std::streampos theEnd = aStream.tellg();
+ aStream.seekg (0, aStream.beg);
+
+ while (!aStream.eof() && !aStream.bad())
{
- return ReadBinary (aStream, theProgress);
+ if (IsAscii (aStream))
+ {
+ if (!ReadAscii (aStream, theEnd, theProgress))
+ {
+ break;
+ }
+ }
+ else
+ {
+ if (!ReadBinary (aStream, theProgress))
+ {
+ break;
+ }
+ }
+ aStream >> std::ws; // skip any white spaces
}
+ return !aStream.bad();
}
//==============================================================================
public:
//! Reads data from STL file (either binary or Ascii).
+ //! This function supports reading multi-domain STL files formed by concatenation of several "plain" files.
+ //! The mesh nodes are not merged between domains.
//! Unicode paths can be given in UTF-8 encoding.
//! Format is recognized automatically by analysis of the file header.
//! Returns true if success, false on error or user break.
--- /dev/null
+readstl m [locate_data_file bug28680_sample01b.stl] triangulation
+
+# Number of triangles check
+checktrinfo m -tri 62075 -nod 31879
+
+# Visual check
+checkview -display m -3d -vdispmode 0 -path ${imagedir}/${test_image}_edges.png
+checkview -display m -3d -vdispmode 1 -path ${imagedir}/${test_image}_shading.png