support of binary files starting with "solid " in isASCIIFile #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are some binary stl files which start with "solid ". This breaks the assumption that files with "solid " are always ascii files.
An example is the very popular 3DBenchy.stl from https://www.thingiverse.com/thing:763622/files
To fix this I used this method:
https://stackoverflow.com/a/7394842/353337
-> validate if the lenght field matches the actual file
I am not fully happy about my solution because it now opens the file two times.
I did this because otherwise it would be much more complicated code as the first 84 bits are already read and they would need a special treat in ascii parsing (as we cannot go "back" using the reader).
I have added a test case for this.
Edit:
by the way: as you wrote this in your readme:
I am trying exactly this. (But I use your lib only for stl loading as I need full control over the datatypes.)