Count No Of Parts In Stl File

Discussion in 'Shapeways API' started by piyushsinghal14, Apr 7, 2017.

  1. piyushsinghal14
    piyushsinghal14 New Member
    Hi Dev Team,

    I am an engineering student and doing my M.tech in computer science. And I am working in the area of STL file but I am facing problem in getting no of parts in stl file. I saw that in your website after uploading stl file, it calculates no of parts. Can you please help me how can I calculate those parts. As I am working on an educational non profit project so little help from your help will help whole developers community and eventually I am going to open source my research work.

    Looking forward for a positive response from your team.

    Thanks in advance !!
     
  2. stonysmith
    stonysmith Well-Known Member Moderator
    One incredibly cheap way to do this is to export the STL in ascii format.
    Then open it with an editor (or program) and count how many lines start with the word "solid".
    Each internal part should have it's own line that says "solid"

    as in this would be two parts:
    solid Mypart1
    facet normal 0.0 0.0 -1.0
    outer loop
    vertex 0 100 0
    vertex 50 100 0
    vertex 50 50 0
    endloop
    endfacet
    endsolid Mypart1
    solid Mypart2
    facet normal 0.0 0.0 -1.0
    outer loop
    vertex 0 100 0
    vertex 50 100 0
    vertex 50 50 0
    endloop
    endfacet
    endsolid Mypart2