1
$\begingroup$

Somewhere knows how to store the area from each triangle/quad from a mesh into a txt file or something like that in Blender instead of simply showing it? (It is possible to show all the areas doing Display -> Face info Area, but I dont know how to save all the measurements it provides)

Thanks a lot!!!

B.

$\endgroup$
2
  • $\begingroup$ so you are trying to get a list with the area of each face? $\endgroup$
    – David
    Commented Apr 13, 2018 at 13:44
  • $\begingroup$ Yes, that is it ! also the angles of each face ....but I dunno how to do it $\endgroup$
    – Bruna Grc
    Commented Apr 23, 2018 at 13:44

1 Answer 1

0
$\begingroup$

To output the areas of each face to a file, you would need to use a python script. It is easy to use python to create and write to a file. You can use str.format() to control how the data looks in the file.

The area is a property of each face in the objects mesh data, faces are called polygons here.

import bpy

with open('face_data.txt','w') as out_file:
    for f in bpy.context.object.data.polygons:
        out_file.write('{}, {}\n'.format(f.index, f.area))
$\endgroup$
3
  • $\begingroup$ Oh, yes,thanks! it works but once I create something similar just changing the format it gives me this kind of error: AttributeError _ Restrict Context has no attribute object and my data is not stored inside the txt file any suggestion? I dont have any idea in how it works in blender.... $\endgroup$
    – Bruna Grc
    Commented Apr 23, 2018 at 13:45
  • $\begingroup$ The restricted context sounds like you are trying to enable an addon and have the code run before the addon is registered. You can find some info here. Probably best to ask another question with your script to get help. $\endgroup$
    – sambler
    Commented Apr 23, 2018 at 14:50
  • $\begingroup$ Thank you Sambler for your prompt answer, gonna check it out! $\endgroup$
    – Bruna Grc
    Commented Apr 24, 2018 at 10:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .