Please, how do I compute the surface & volume of a large amount of STL files ?

I have over 3000 STL files, and I want to know their respective volumes and surfaces. I will use this data to be able to identify the biggest part, the one with the biggest surface, etc.

I found that the fine Admesh (included in openscad, as far as I know) software that can compute the volume via command-line (powershell) and with some text editing I can get the volumes for all of these parts (needing some patience), but I didn't find any similar tool for the surface.

The best tool would output such thing as:

input.stl - 75.554mm2 - 45.547mm3

I'm not sure this post is adequate in here, but anyway, thanks.

  • 2
    $\begingroup$ Depending on how comfortable you are with programming, calculating the surface is pretty easy. Simply sum the area of all the triangles in the file. $\endgroup$ – Tom van der Zanden Apr 23 '18 at 13:41
  • $\begingroup$ Well, the fact is that I am not comfortable with programming. I am learning a lot in computer science in general, but my programming skills are limited to (very) simple scripts like $ cp -r \some\folder \some\destination\ ; shutdown. Not that I wouldn't like to learn about, but I don't really have the time… yet, at least. $\endgroup$ – 42Z0GqNNz Apr 24 '18 at 8:12
  • $\begingroup$ if you can find the weight (aka filament use estimate) and the volume, can you computer surface? idk $\endgroup$ – dandavis Apr 28 '18 at 10:25
  • $\begingroup$ @dandavis I don't understand what do you mean. I am searching for the surface of the parts, which is independent from the volume (volume and weight being proportionals, tighten by density). i.e.: these parts have a much higher surface over volume ratio than this one. $\endgroup$ – 42Z0GqNNz May 11 '18 at 12:41
  • 1
    $\begingroup$ admesh -c will give you a summary that includes volume, you colud grep for the line/value after "volume : " $\endgroup$ – esoterik Jun 26 '18 at 0:09

You could use the Python console of FreeCAD. Issuing the following commands


will output the area and the volume of the object, respectively.

I don't know how to access the console output from outside FreeCAD, but there is an option in FreeCAD called Redirect internal Python output to report view which I think is what you are looking for.

You might want to look into the Scripting documentation of FreeCAD for further instructions.

Using the Python console of FreeCAD to calcaulate area and volume of an object

  • $\begingroup$ I am quite sure, that Python also could be used to automate this fully, if one is good with it. $\endgroup$ – Trish Aug 11 '18 at 11:27
  • $\begingroup$ Am I wrong assuming that this would require me to import STL file to FreeCAD and process the volume/surface as described, unload the file, reload the next STL file? Would your answer implies me to do so file by file for the 3000+ files mentionned in the post? $\endgroup$ – 42Z0GqNNz Nov 29 '18 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.