mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0028680: Data Exchange - allow reading of multi-domain STL files
Method RWStl::Read() is improved to support reading multi-domain STL files. Test added: bugs stlvrml bug28680
This commit is contained in:
parent
4178b3531b
commit
1d949423b7
@ -132,18 +132,31 @@ Standard_Boolean RWStl_Reader::Read (const char* theFile,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Standard_IStream aStream (&aBuf);
|
Standard_IStream aStream (&aBuf);
|
||||||
if (IsAscii (aStream))
|
|
||||||
|
// 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())
|
||||||
{
|
{
|
||||||
// get length of file to feed progress indicator
|
if (IsAscii (aStream))
|
||||||
aStream.seekg (0, aStream.end);
|
{
|
||||||
std::streampos theEnd = aStream.tellg();
|
if (!ReadAscii (aStream, theEnd, theProgress))
|
||||||
aStream.seekg (0, aStream.beg);
|
{
|
||||||
return ReadAscii (aStream, theEnd, theProgress);
|
break;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
return ReadBinary (aStream, theProgress);
|
{
|
||||||
|
if (!ReadBinary (aStream, theProgress))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aStream >> std::ws; // skip any white spaces
|
||||||
}
|
}
|
||||||
|
return !aStream.bad();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
@ -33,6 +33,8 @@ class RWStl_Reader : public Standard_Transient
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//! Reads data from STL file (either binary or Ascii).
|
//! 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.
|
//! Unicode paths can be given in UTF-8 encoding.
|
||||||
//! Format is recognized automatically by analysis of the file header.
|
//! Format is recognized automatically by analysis of the file header.
|
||||||
//! Returns true if success, false on error or user break.
|
//! Returns true if success, false on error or user break.
|
||||||
|
8
tests/bugs/stlvrml/bug28680
Normal file
8
tests/bugs/stlvrml/bug28680
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
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
|
Loading…
x
Reference in New Issue
Block a user