Closed major-mayer closed 3 years ago
Can you link to relates .stl
description page in your issue description and provide zipped example data @major-mayer?
Hmm I attached a few sample stl files, but there seems to be no magic number for the binary stl files.
At least i can't find a description page where one is specified.
Only for the ASCII .stl file type there seems to be the standard, that the file must start with solid
which translates to 73 6F 6C 69 64
in hex.
Here is more information about the .stl
file extension : https://www.digipres.org/formats/sources/fdd/formats/#fdd000505
testmeshes.zip
I opened #405 to add support for ASCII STL files by detecting the string solid
in the first line.
Unfortunately, binary STL files start with an 80-character header that could contain anything (except the string "solid", of course). Following that is an unsigned int for the number of triangle in the file, then the list of triangles begins - so, just a bunch of numbers.
Here is a simple example of a cube in binary stl fixture-binary.stl.zip. Examination of the file (xxd fixture-binary.stl
) reveals the header is all spaces.
Binary files are the most common as they are more compact, so not sure how useful this change is. I just wanted to get started on this project so I figured I would jump in!
Great work! Thank you very much for the effort. Nevertheless, for me the patch is not sufficient, because I need to detect a uploaded binary stl file too.
If I understand the problem correctly, the issue is, that we can't expect something random like a 80 char header, because it could be every other file too? That's a pity.
But anyway, still great to see some progress here 😋
Hi, I need to make sure, that the user uploaded a valid .stl file that contains a mesh. It would be great if you could add the detection for this file-type to this library. According to this site the magic bytes would be
73 6F 6C 69 64
. Thanks in advance :)