how do i manipulate a randomly selected vertices in an object in blender python?

Viewed 266

enter image description here I'm using blender 2.79, and i'm having some difficulties in writing my code. here is what i am planning to do. I'm using a simple plane in this example. i have selected 2 of it's vertices. what i want to do is activate the 2 selected vertices and print it using for loop. this was the code that i used

import bpy
import bmesh

p = [i.index for i in bmesh.from_edit_mesh(bpy.context.active.data).verts if i.select]
ob = bpy.context.object
me = ob.data
bm = bmesh.from_edit_mesh(me)

for g in p:
    bm.select_history.add(bm.verts[g])
    print(bm.select_history.active)

as you can see, this is a combined code that i have founded in this site and it was a fail. what i can found was either activating a single vertex or finding an entire vertices if an object. i do not want that, all i need is just to edit the 2 selected vertices. i could not find a code that i can use for a multiple selected vertices. please help me solve this.

0 Answers
Related