<p>You could use the <strong>Python console of FreeCAD</strong>. Issuing the following commands</p>

<pre><code>FreeCAD.ActiveDocument.ActiveObject.Shape.Area
FreeCAD.ActiveDocument.ActiveObject.Shape.Volume
</code></pre>

<p>will output the area and the volume of the object, respectively.</p>

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

<p>You might want to look into the Scripting documentation of FreeCAD for further instructions.</p>

<p><a href="https://i.sstatic.net/bA3in.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bA3in.png" alt="Using the Python console of FreeCAD to calcaulate area and volume of an object"></a></p>

CC BY-SA 4.0
2018-08-11T11:27:15.053Z
I am quite sure, that Python also could be used to automate this fully, if one is good with it.
Trish
CC BY-SA 4.0
2018-11-29T20:53:44.203Z
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?
42Z0GqNNz
CC BY-SA 4.0
2018-08-11T00:06:41.027Z
2018-08-11T00:13:01.090Z
2018-08-11T00:13:01.090Z
typo
<p>Please, how do I compute the surface &amp; volume of a large amount of <a href="https://en.wikipedia.org/wiki/STL_(file_format)" rel="nofollow noreferrer">STL files</a> ?</p>

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

<p>I found that the fine <a href="https://github.com/admesh/admesh/releases" rel="nofollow noreferrer" title="Admesh Github&#39; page">Admesh</a> (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.</p>

<p>The best tool would output such thing as:</p>

<blockquote>
  <p><code>input.stl - 75.554mm2 - 45.547mm3</code></p>
</blockquote>

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

CC BY-SA 3.0
2018-04-23T13:41:13.863Z
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.
Tom van der Zanden
CC BY-SA 3.0
2018-04-24T08:12:42.570Z
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.
42Z0GqNNz
CC BY-SA 3.0
2018-04-28T10:25:52.360Z
if you can find the weight (aka filament use estimate) and the volume, can you computer surface? idk
dandavis
CC BY-SA 4.0
2018-05-11T12:41:30.810Z
@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](https://en.wikipedia.org/wiki/Density)). i.e.: [these parts](https://www.netfabb.com/sites/default/files/blog/SilverStructures002.jpg) have a much higher surface over volume ratio than [this one](https://upload.wikimedia.org/wikipedia/commons/thumb/3/31/Pallo_valmiina.jpg/800px-Pallo_valmiina.jpg).
42Z0GqNNz
CC BY-SA 4.0
2018-06-26T00:09:16.500Z
[admesh -c](https://admesh.readthedocs.io/en/latest/cli.html) will give you a summary that includes volume, you colud grep for the line/value after "volume : "
esoterik
CC BY-SA 4.0
2018-11-29T20:51:28.857Z
@esoterik I already talked about it in my post.
42Z0GqNNz
<3d-models><3d-design><software><cad><stl>
How do I compute the surface & volume of a large amount of STL files?
42Z0GqNNz
# How do I compute the surface & volume of a large amount of STL files?

(Asked by: username_0 on 2018-04-23)

Please, how do I compute the surface & volume of a large amount of [STL files](https://en.wikipedia.org/wiki/STL_(file_format)) ?

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](https://github.com/admesh/admesh/releases "Admesh Github' page") (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.

**Tags:** 3d-models, 3d-design, software, cad, stl
> **Comments:**
> **username_1**: 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.  
> **username_0**: 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.  
> **username_2**: if you can find the weight (aka filament use estimate) and the volume, can you computer surface? idk  
> **username_0**: @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](https://en.wikipedia.org/wiki/Density)). i.e.: [these parts](https://www.netfabb.com/sites/default/files/blog/SilverStructures002.jpg) have a much higher surface over volume ratio than [this one](https://upload.wikimedia.org/wikipedia/commons/thumb/3/31/Pallo_valmiina.jpg/800px-Pallo_valmiina.jpg).  
> **username_3**: [admesh -c](https://admesh.readthedocs.io/en/latest/cli.html) will give you a summary that includes volume, you colud grep for the line/value after "volume : "  
> **username_0**: @esoterik I already talked about it in my post.  

---

## 1 answers

### Answer by username_4 on 2018-08-11. Score: 2

You could use the Python console of FreeCAD. Issuing the following commands
FreeCAD.ActiveDocument.ActiveObject.Shape.Area
FreeCAD.ActiveDocument.ActiveObject.Shape.Volume

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.

> **Comments:**
> **username_5**: I am quite sure, that Python also could be used to automate this fully, if one is good with it.  
> **username_0**: 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?  

---

