bug fix in reading stl file
This commit is contained in:
commit
69909b3c01
|
@ -57,7 +57,7 @@ bool pFlow::stlFile::readSolid
|
||||||
{
|
{
|
||||||
|
|
||||||
token tok;
|
token tok;
|
||||||
is>> tok;
|
is >> tok;
|
||||||
if(!checkWordToken(is, tok, "solid")) return false;
|
if(!checkWordToken(is, tok, "solid")) return false;
|
||||||
|
|
||||||
// check if there is a name associated with solid
|
// check if there is a name associated with solid
|
||||||
|
@ -71,7 +71,6 @@ bool pFlow::stlFile::readSolid
|
||||||
while (nWords < 20 )
|
while (nWords < 20 )
|
||||||
{
|
{
|
||||||
if( badInput(is, tok) ) return false;
|
if( badInput(is, tok) ) return false;
|
||||||
//if(!tok.isWord()) return false;
|
|
||||||
nWords++;
|
nWords++;
|
||||||
if(tok.isWord() && tok.wordToken() != "facet" )
|
if(tok.isWord() && tok.wordToken() != "facet" )
|
||||||
{
|
{
|
||||||
|
@ -104,10 +103,49 @@ bool pFlow::stlFile::readSolid
|
||||||
vertecies.clear();
|
vertecies.clear();
|
||||||
while(true )
|
while(true )
|
||||||
{
|
{
|
||||||
is>>tok;
|
is >> tok;
|
||||||
if( badInput(is,tok) || !tok.isWord() )return false;
|
if( badInput(is,tok) || !tok.isWord() )return false;
|
||||||
word wTok = tok.wordToken();
|
word wTok = tok.wordToken();
|
||||||
if( wTok == "endsolid" ) return true; // end of solid
|
if( wTok == "endsolid" )// end of solid
|
||||||
|
{
|
||||||
|
// check if there is a name associated with endsolid
|
||||||
|
is >> tok;
|
||||||
|
if( !badInput(is, tok) && !is.eof())
|
||||||
|
{
|
||||||
|
word endName = "";
|
||||||
|
int32 nWords =0;
|
||||||
|
|
||||||
|
while (nWords < 20 )
|
||||||
|
{
|
||||||
|
if( badInput(is, tok) ) return false;
|
||||||
|
nWords++;
|
||||||
|
if(tok.isWord())
|
||||||
|
{
|
||||||
|
endName += tok.wordToken();
|
||||||
|
}
|
||||||
|
else if( tok.isNumber())
|
||||||
|
{
|
||||||
|
auto val = tok.number();
|
||||||
|
endName += real2Word(val);
|
||||||
|
}
|
||||||
|
else if( tok.isPunctuation())
|
||||||
|
{
|
||||||
|
endName += tok.pToken();
|
||||||
|
}
|
||||||
|
else if (tok.isWord())
|
||||||
|
{
|
||||||
|
is.putBack(tok);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if( wTok != "facet" ) return false;
|
if( wTok != "facet" ) return false;
|
||||||
|
|
||||||
// read facet
|
// read facet
|
||||||
|
|
Loading…
Reference in New Issue