mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 22:20:35 +05:00
Automatically distinguish between ASCII and binary stl files
This commit is contained in:
parent
f6f4976402
commit
5cfb449d7a
@ -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<STLReadTriangle> readtrigs;
|
||||
|
Loading…
Reference in New Issue
Block a user