Beveling edges with varying number of segments (preferably programatically) So I wrote a script to select a certain set of edges that I'd like to bevel. I save the edges inside of a dictionary with the key being the indices of the vertices on that edge and the value being the weight of the beveling. The edges are guaranteed to be separate. Which mean they don't share any common vertex. But some of them need more segment and width, some of them need less depending on the angle between the faces it lays on. I tried using the bevel modifier but it only either bevel by weight OR by angle and not both. I also tried manually beveling each edge but after one bevel, the indices are all messed up and the algorithm can't find the edges anymore.
Is there a way to achieve this?
As the index of an item changes as edits are made to the mesh you need to get each edge object before making any changes, then refer to each edge as you do the bevel. You can use the edges verts property to get the vertices at each end.

import bpy, bmesh

bpy.ops.object.mode_set(mode='EDIT')
me = bpy.context.edit_object.data

# edge_bevel_data
ebd = [
{'idx': 13, 'edge': None, 'offset': 0.05, 'segments': 3},
{'idx': 32, 'edge': None, 'offset': 0.04, 'segments': 2},
{'idx': 89, 'edge': None, 'offset': 0.06, 'segments': 3},
]

bm = bmesh.from_edit_mesh(me)

# first get the edges
for i in range(len(ebd)):
    ebd[i]['edge'] = bm.edges[ebd[i]['idx']]

# bevel each edge
for i in range(len(ebd)):
    e = ebd[i]['edge']
    bev_geom = [e.verts[0], e.verts[1], e]
    o = ebd[i]['offset']
    s = ebd[i]['segments']
    bmesh.ops.bevel(bm, geom=bev_geom, offset=o, segments=s)

bmesh.update_edit_mesh(me, True)