The ASCII STL import was made more tolerant to non-standard input format,
namely: 1) Whitespaces are allowed at the end of lines 2) A freeform is allowed after "endloop", "endfacet" and "endsolid", if separated from the keyword by a whitespace. Some ASCII STL exporters likely add their annotations in there. Fixes "Error on importing stl" #2813
This commit is contained in:
parent
1096dff0f6
commit
9abef2241d
1 changed files with 9 additions and 9 deletions
|
@ -175,10 +175,10 @@ static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first)
|
|||
assert(res_vertex2 == 3);
|
||||
int res_vertex3 = fscanf(fp, " vertex %f %f %f ", &facet.vertex[2](0), &facet.vertex[2](1), &facet.vertex[2](2));
|
||||
assert(res_vertex3 == 3);
|
||||
int res_endloop = fscanf(fp, " endloop");
|
||||
int res_endloop = fscanf(fp, " endloop %*[^\n]\n");
|
||||
assert(res_endloop == 0);
|
||||
// There is a leading and trailing white space around endfacet to eat up all leading and trailing white spaces including numerous tabs and new lines.
|
||||
int res_endfacet = fscanf(fp, " endfacet ");
|
||||
int res_endfacet = fscanf(fp, " endfacet %*[^\n]\n");
|
||||
if (res_normal != 3 || res_outer_loop != 0 || res_vertex1 != 3 || res_vertex2 != 3 || res_vertex3 != 3 || res_endloop != 0 || res_endfacet != 0) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Something is syntactically very wrong with this ASCII STL! ";
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue