STL (file Format) - Binary STL

Binary STL

Because ASCII STL files can become very large, a binary version of STL exists. A binary STL file has an 80 character header (which is generally ignored – but which should never begin with 'solid' because that will lead most software to assume that this is an ASCII STL file). Following the header is a 4 byte unsigned integer indicating the number of triangular facets in the file. Following that is data describing each triangle in turn. The file simply ends after the last triangle.

Each triangle is described by twelve 32-bit-floating point numbers: three for the normal and then three for the X/Y/Z coordinate of each vertex – just as with the ASCII version of STL. After the twelve floats there is a two byte unsigned 'short' integer that is the 'attribute byte count' – in the standard format, this should be zero because most software does not understand anything else.

Floating point numbers are represented as IEEE floating point numbers and are assumed to be little endian, although this is not stated in documentation.

UINT8 – Header UINT32 – Number of triangles
foreach triangle REAL32 – Normal vector REAL32 – Vertex 1 REAL32 – Vertex 2 REAL32 – Vertex 3 UINT16 – Attribute byte count end

Read more about this topic:  STL (file Format)