2
$\begingroup$

is there a way of being able to export an object's edge length and edge angles to a CSV file?

I have created an object with some 200 triangulated faces and I would like to export the information about its edge length and edge angle to a CSV file that can be used to build the object (not 3D print).

I'm relatively new to blender. I'm using Version 2.93.5 (2.93.5 2021-10-06) I have tried to find an answer unsuccessfully.

$\endgroup$

1 Answer 1

2
$\begingroup$

here's something using bmesh to calc edge and angle between faces, it should work in 2.93
angle is signed and in radians, it fallbacks to 10 if edge doesn’t have 2 faces, see I rounded values too...

you may want to change those things, see bmesh docs if you needed something else I didn't understand

import bpy, bmesh, csv
rows = []

bm = bmesh.new()
bm.from_mesh(bpy.context.object.data)

for i, e in enumerate(bm.edges):
    len = round(e.calc_length(), 5)
    ang = round(e.calc_face_angle_signed(10), 5) # use fallback=10 for Blender 3
    rows.append([i, len, ang])
bm.free()

with open('C:\\tmp\\egdes.csv', 'w') as f:
    writer = csv.writer(f)
    for r in rows: writer.writerow(r)
$\endgroup$
1
  • $\begingroup$ Thank you alambre, I'll try it out $\endgroup$
    – molmo
    Apr 5, 2022 at 22:05

You must log in to answer this question.

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