How to create a binary STL file containing more than one solid?

1.4k views Asked by At

Including more than one solid in an ASCII STL file has been well described.

solid name1
    facet normal N.x N.y N.z
        outer loop
            vertex V1.x V1.y V1.z
            vertex V2.x V2.y V2.z
            vertex V3.x V3.y V3.z
        endloop
    endfacet
    facet …
        …
    endfacet
    …
endsolid name1
solid name2
    …
endsolid name2
…

However, the format described for a binary STL file does not say anything about including multiple solid objects.

       80 Bytes  string   Header
        4 Bytes  uint32   Facets count

      | 4 Bytes  float    N.x
      | 4 Bytes  float    N.y
      | 4 Bytes  float    N.z
      | 4 Bytes  float    V1.x
      | 4 Bytes  float    V1.y
      | 4 Bytes  float    V1.z
facet1| 4 Bytes  float    V2.x
      | 4 Bytes  float    V2.y
      | 4 Bytes  float    V2.z
      | 4 Bytes  float    V3.x
      | 4 Bytes  float    V3.y
      | 4 Bytes  float    V3.z
      | 2 Bytes  uint16   Attrib

facet2| …

facet3| …

…
1

There are 1 answers

0
Mehdi On BEST ANSWER

In the binary format each facet has got an attribute (attrib). The facets whose attrib are the same will be considered part of the same solid.