Select a vert

Hi,

Quite simple, how do I select a single vert


import bpy

objs = bpy.context.selected_objects
if len(objs) == 1:
    
    if bpy.context.mode != 'EDIT_MESH':
        bpy.ops.object.editmode_toggle()
    
    bpy.ops.mesh.select_all(action='DESELECT')
    

I feel like i’ve tried everything reasonable on here

I then will use:


bpy.ops.mesh.select_linked()

How do I then access that set of vertices?

Many thanks!

Here a few codes.

bpy.ops.object.mode_set(mode=‘EDIT’)
bpy.ops.object.mode_set(mode=‘OBJECT’)
current_mesh.vertices[index].select = True

Note some operate got be done in order. You have set your mesh in object mode to able to select your vertices. then set it to edit mode to see your select vertices.

Cheers Darknet!

Next, once a linked set has been selected, how do I find out which they are?


import bpy

objs = bpy.context.selected_objects
if len(objs) == 1:
    
    if bpy.context.mode != 'EDIT_MESH':
        bpy.ops.object.editmode_toggle()
    
    bpy.ops.mesh.select_all(action='DESELECT')
    
    bpy.ops.object.mode_set(mode='EDIT')
    bpy.ops.object.mode_set(mode='OBJECT')
    index=0
    objs[0].data.vertices[index].select = True
    
    bpy.ops.object.mode_set(mode='EDIT')
    bpy.ops.mesh.select_linked()


import bpy
objdataver = bpy.context.active_object.data.vertices
for el in objdataver:
    if el.select:
        print(el.index)

oooh, thankyou!