Get edge lengths with python How can I get the length of an edge with a script? I want to identify a face by its vertex group and get the lengths of its edges. I've gotten as far as identifying the vertex group so I can select it or get the indices - what next? Do I have to do some complicated math to get distances between points in 3d space or is there a direct way to get the edge length as it is displayed in the overlay? The angle would be great too, but I'm trying to take small bites.
That was easier than I expected!

import bpy
import bmesh
obj=bpy.data.objects["Cube"]
obj.select_set(True)
i = 0
for mat_slot in obj.material_slots:
    #enter edit mode
    bpy.ops.object.mode_set(mode="EDIT")
    #deselect all
    bpy.ops.mesh.select_all(action='DESELECT')
    #choose the active slot based on the loop number
    bpy.context.object.active_material_index = i
    #select the faces of the active slot
    bpy.ops.object.material_slot_select()
    #make a bmesh from the mesh
    me = bpy.context.object.data
    bm = bmesh.from_edit_mesh(me)
    #list to populate with lengths
    edge_lengths = []
    #if edge is selected, get its length
    for e in bm.edges:
        if e.select:
            edge_lengths.append(e.calc_length())
    print(edge_lengths)
    i=i+1
bpy.ops.object.mode_set(mode="OBJECT")