Skip to content

Instantly share code, notes, and snippets.

@CGArtPython
Created July 6, 2022 15:05
Show Gist options
  • Save CGArtPython/c5fb05aab9cc84bff5a73058df3315c0 to your computer and use it in GitHub Desktop.
Save CGArtPython/c5fb05aab9cc84bff5a73058df3315c0 to your computer and use it in GitHub Desktop.
Blender Python script to deselect verts using thier index
# give Python access to Blender's mesh manipulation functionality
import bmesh
# give Python access to Blender's functionality
import bpy
# add cube
bpy.ops.mesh.primitive_cube_add()
obj = bpy.context.active_object
# enable edit mode
bpy.ops.object.editmode_toggle()
# create a BMesh object to manipulate geometry data (must be done in edit mode)
bm = bmesh.from_edit_mesh(obj.data)
# make sure we can use the square brackets to access verts
bm.verts.ensure_lookup_table()
# deselect vert with index 0
bm.verts[0].select = False
# deselect vert with index 1
bm.verts[1].select = False
# deselect vert with index 2
bm.verts[2].select = False
# disable edit mode
# bpy.ops.object.editmode_toggle()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment