After googling around, I came up with this, but it is not working… any ideas? If I run the commands by hand in the console it works, but not if I run it from a text block.
To run it, I enter edit mode and select some edges. The object already has a bevel modifier activated, with the “Limit Method” set to weight – this works as expected.
import bpy
ob = bpy.context.object
ob.update_from_editmode()
ob.data.use_customdata_edge_bevel = True
edges = [e for e in ob.data.edges if e.select]
if str(ob.mode) == 'EDIT':
bpy.ops.object.mode_set(mode='OBJECT')
for edge in edges:
edge.bevel_weight=0.5
Apparently you have to be in Object mode to set the bevel weights?
I also saw bpy.context.object.is_editmode but that caused an error so I had to do the string compare…?