STL Volume Weight CalculatorIn two lines:
Vital stats for 3D printing objects. Quickly estimate the cost of printing your 3D object!
What is STL ?
.STL is a file format that is popularly used for representing 3D object information for 3D printing applications.
So what ?
It is useful to know the volume and hence the weight of the material that may go into making an object on a 3D printer before one prints it. This may aid calculating the cost of printing that particular object.
What math ?
This software uses a tetrahedron volume counting algorithm to determine the volume contributed by each of the tiny triangles that constitute the 3D model represented in a STL file. Each volume is a signed value and a sum of all of these values gives you the total volume of the 3D object.
class STLStats is cool because…
The volume counting math is wrapped inside an easy to use PHP class that exposes getter functions (i.e. getVolume, getWeight, etc) to calculate common statistics of a 3D object. This class will be useful to a website which deals in web based 3D printing applications.
The PHP code has been commented extensively. Example usage has been given at the end of this documentation as well as at the end of the class and should be commented out when the class is deployed on your server.
Happy coding !
- Minor re-factoring.
- Auto-detect ASCII / Binary STL file
- Extract ASCII & Binary data
- Calculate volume from ASCII & Binary STL files