Blender API vertices select/deselect
from pprint import pprint
import bpy
import bmesh
# get the active object
for obj in bpy.data.objects:
if obj.type == 'MESH':
me = obj.data
if me.is_editmode:
current_selection = [i.index for i in bmesh.from_edit_mesh(bpy.context.active_object.data).faces if i.select]
bpy.ops.mesh.select_more()
new_selection = [i.index for i in bmesh.from_edit_mesh(bpy.context.active_object.data).faces if i.select]
deselect = []
for face in new_selection:
if face in current_selection:
deselect.append(face)
# deselect
for face in deselect:
test = bmesh.from_edit_mesh(bpy.context.active_object.data)
test.faces[face].select_set(False)