squancy / stl-parser

Convert between ASCII and binary STL files, calculate volume, surface area and estimated price for 3D printing.
10 stars 0 forks source link

Volume not working for STLs with holes/floating parts #1

Open ToofastTurnip opened 2 years ago

ToofastTurnip commented 2 years ago

Like the title says, I was trying to use stl-parser to measure the volume of an stl file that was generated from a milling simulation (meaning we're talking about a part with rough edges and many imperfections, not a perfect file for 3d printing) and I'm getting Volume: 0.000cm^3 for the volume measurement.

squancy commented 2 years ago

Could you send me the STL file that you are trying to use as an input to the parser? It may be corrupted or does not determine a closed form.

As it is written in the description:

The volume is calculated as the sum of the signed volumes of the tetrahedrons from a given point in space, thus it returns a correct value for STL files with arbitrary complexity. There may be certain edge cases when a few triangles overlap or the STL does determine a closed form in space. In this case an incorrect result may be returned since there is no error checking on triangles.

Also, note that the volume calculation is dependent on the order of the vertices listed in the file (right-hand rule) and no error checking is done when it's not the case. When an STL is given as a parameter such that the order of the vertices does not follow the specification an incorrect volume (and perhaps price) may be returned without any warning.

ToofastTurnip commented 2 years ago

Sure, but github doesn't allow me to attach an STL file to an issue. Can I send it to the email listed on your github? mark@pearscom.com

squancy commented 2 years ago

Sure, you can send me an email.

On 2022. Sep 22., at 18:54, Mitch Taylor @.***> wrote:

 Sure, but github doesn't allow me to attach an STL file to an issue. Can I send it to the email listed on your github? @.***

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.