Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CGArtPython/61e208dfe0a1034c7dbb34824bbcce26 to your computer and use it in GitHub Desktop.
Save CGArtPython/61e208dfe0a1034c7dbb34824bbcce26 to your computer and use it in GitHub Desktop.
Blender Python get selected verts via list comprehension (video tutorial here: https://youtu.be/N3U2noAHgBo)
import bpy
import bmesh
# get a reference to the active object
mesh_obj = bpy.context.active_object
# create a new bmesh
bm = bmesh.from_edit_mesh(mesh_obj.data)
selected_verts = [vert for vert in bm.verts if vert.select]
print("selected vert")
for vert in selected_verts:
print(f"{vert.index}")
# clean up/free memory that was allocated for the bmesh
bm.free()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment