How to find the surface area of a complicated mesh using Python code in Blender. The mesh can be .obj .ply or .stl .
Asked
Active
Viewed 3,648 times
1 Answers
8
One way is to sum bmesh face.calc_area() for all faces.
import bpy
import bmesh
obj = bpy.context.active_object
bm = bmesh.new()
bm.from_mesh(obj.data)
area = sum(f.calc_area() for f in bm.faces)
print(area)
bm.free()
Will give result in objects local space would need to allow for scale. eg if the object is scaled by (2, 2, 2) would need to multiple result by 2 x 2. Or apply scale before calculation.
ideasman42
- 47,387
- 10
- 141
- 223
batFINGER
- 84,216
- 10
- 108
- 233
area = sum(f.calc_area() for f in bm.faces if f.select)Examples of using bmesh on active edit mesh. http://blender.stackexchange.com/a/40979/15543 http://blender.stackexchange.com/a/41758/15543 – batFINGER Mar 02 '16 at 11:59