Volume and area from print 3D ToolBox

Hi all,

This is a request about python scripting with print 3D ToolBox.

Is anybody could advise me to collecte in a variable the volume and area
calculated by 3D print ToolBox?

bpy.ops.mesh.print3d_info_volume() only update the processing, and
i have found the volume variable used in operators.py empty, when i’m calling
it from the console.



the python console in blender does not list all the operator’s linked through weak references in the assembled binary eg: dir(object); you will need to look at the source loaded because the object’s held do not give you a mean’s of referencing objects that are so often reassigned, unless you use the ctypes module.

simply use the bmesh module:

import bmesh

bm = bmesh.new()
bm.from_object(bpy.context.object, bpy.context.scene) # could also use from_mesh() if you don't care about deformation etc.

print(sum(f.calc_area() for f in bm.faces))

Hello CoDEmanX, I was wondering which are the units for calc_volume and calc_area?

I was testing the code and the std output doesn’t change when I change the unities of the scene. So, with different units delivers the same values.


I guess it’s unitless, i.e. Blender units. Vertex coordinates do not have a unit either nor do they change in any way if you change the unit settings for the scene. A face with the following vertex coordinates:

<Vector (1.0000, 1.0000, -1.0000)>
<Vector (1.0000, -1.0000, -1.0000)>
<Vector (1.0000, 1.0000, 1.0000)>
<Vector (1.0000, -1.0000, 1.0000)>

… will have an area of 4 (because it is a 2.0 x 2.0 area).