EgtExchange 1.5d3 :

- miglioria in funzione riconoscimento STL ASCII e binari
- ricompilazione per modifiche a GeomKernel.
This commit is contained in:
Dario Sassi
2014-04-14 15:59:10 +00:00
parent 54f9271333
commit 449cb6d8d5
2 changed files with 10 additions and 6 deletions
+10 -6
View File
@@ -55,18 +55,22 @@ ImportStl::StlType( const std::string& sFile)
if ( InFile.fail())
return STL_ERROR ;
// lettura dei primi ottanta byte
char cBuff[81] ;
InFile.read( cBuff, 80) ;
// lettura dei primi 256 byte
char cBuff[256] ;
InFile.read( cBuff, 255) ;
cBuff[InFile.gcount()] = '\0' ;
// chiusura del file
InFile.close() ;
// verifico se iniziano con "solid"
// verifico se iniziano con "solid" e poi "facet" e "normal"
string sBuff = cBuff ;
size_t nPos = sBuff.find( "solid") ;
if ( nPos != string::npos && nPos < 10)
size_t nPosS = sBuff.find( "solid") ;
size_t nPosF = sBuff.find( "facet") ;
size_t nPosN = sBuff.find( "normal") ;
if ( nPosS != string::npos && nPosS < 10 &&
nPosF != string::npos &&
nPosN != string::npos)
return STL_ASCII ;
else
return STL_BINARY ;