2
$\begingroup$

How do I change the Bevel Weight of the selected vertex using Python? I need to find the selected vertex, maybe as a list? and then change its bevel weight.

enter image description here

$\endgroup$

1 Answer 1

2
$\begingroup$

You have to be in Object Mode to set the Bevel Weight via Python. In the following example I set all vertices of my Default Cube or bpy.context.object to have bevel_weight = 0.77 and then override the vertex at index 0 to have a bevel_weight = 0.44.

import bpy

bpy.ops.object.mode_set(mode='OBJECT')

obj = bpy.context.object
vertices = obj.data.vertices

# change bevel weight for every vertex
for v in vertices:
    v.bevel_weight = 0.77

# change bevel weight for selected vertex
selected_verts = [v for v in vertices if v.select]
for v in selected_verts:
    v.bevel_weight = 0.55

vertices[0].bevel_weight = 0.44 # change bevel weight for vertex at index 0
$\endgroup$
2
  • 1
    $\begingroup$ Thanks! exactly what I needed. $\endgroup$
    – Spearhead
    Aug 4, 2023 at 17:11
  • $\begingroup$ you're welcome! $\endgroup$ Aug 4, 2023 at 18:16

You must log in to answer this question.

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