Hi, everybody. Problems when using bmesh.ops in my scripts.
I need to, say, process each vertex of my model with bmesh.ops.bevel, but I can’t use individual vertices writing them as geom (the console displays the message “expected a bmesh sequence, list”). If you create a list with one element ([vertex]) - the program crashes. Please help me to solve this problem.
I solved a similar problem by replacing split from bmesh.ops on split from bpy.ops, but there was no need for variability. And in general, the solution is worse than ever and leads to a drop in performance.
You are adding geometry infinitely in that loop, that’s why it crashes. Do this instead:
for ob in bpy.context.selected_objects:
bm = bmesh.new()
verts = [v for v in bm.verts if len(v.link_edges) > 1]
bmesh.ops.bevel(bm, geom=verts, offset=0.1, segments=4, vertex_only=True)
It’s not currently possible to bevel with a different number of segments for each vertex. As you might imagine that raises a lot of issues about how to make the connections between vertices with different numbers of segments, and in my opinion it wouldn’t be worth the complexity.
Different values for offsets is a much simpler problem, although it’s not currently possible with the tool. If it works for you I might suggest using bevel vertex or edge weights and use the modifier.