Menu

Detect if STL is binary or ASCII

Help
2020-03-02
2020-03-04
  • shine world

    shine world - 2020-03-02

    Hi all,
    attached the code that I use to detect if STL is in ASCII or BINARY format.
    I wrote for and old version of GLScene but can be converted to latest source code.
    The STL can also read colors when embedded in facet extra bytes.

     
  • Pavel Vassiliev

    Pavel Vassiliev - 2020-03-02

    Thnx shine world,
    I'll include it in the current repo version
    Pavel

     
  • shine world

    shine world - 2020-03-03

    Hi Jerome
    Unfortunately this rule:

       isBinary:=True;
       i:=0;
       while i<cFULL_HEADER_LEN-1 do
       begin
        if (headerBuf[i]<#32) and (headerBuf[i]<>#0)  then //then
        begin
             isBinary:=False;
             Break;
         end;
         Inc(i);
       end;
    

    don't cover all my cases.

    We receive a lot of binary STLs from a very etherogeneous group of CAD Systems.
    Seem none respect a common rule to content of Header part.
    I will collect all test versions in a zip and I will place here (BobCAD/CAM, Fusion 360, MeshLab, SolidWorks, DesignSpark Mechanincal, Catia, Hypermill, and so on....) a very mess of different header formats.....

     
    • Pavel Vassiliev

      Pavel Vassiliev - 2020-03-04

      shine world,
      I've included your update for GLFileSTL in current version
      Pavel

       
  • Jerome.D (BeanzMaster)

    Hi Shine it will be a great help to improve loader if you can place many various format of STL files ;)

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.