I have a mesh with particular vertex groups that form a circle around different sections of the mesh. I want to be able to call those vertex groups using a single variable name (radius 1, radius 2). I've been using bpy.ops.object.vertex_group_select() to select vertex group (but vertex group name must already be highlighted under "Vertex Groups" header. Is there a way to code a variable, that will select an individual Vertex Group when called?
This is a python script which will select all the vertices in a vertex group with weight>0.5
import bpy import bmesh def selvg(obj, name): bm = bmesh.from_edit_mesh(obj.data) for i in range(len(obj.data.vertices)): try: s = obj.vertex_groups[name].weight(i) >0.5 s=True # or maybe you don't care what the weight is, and even weight 0 is acceptable except: s=False bm.verts[i].select = s bmesh.update_edit_mesh(obj.data) selvg(bpy.context.active_object, "Group")