Skip to content

Instantly share code, notes, and snippets.

@zeffii
Forked from anonymous/bmesh_testing.py
Last active August 29, 2015 13:57
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 zeffii/9789082 to your computer and use it in GitHub Desktop.
Save zeffii/9789082 to your computer and use it in GitHub Desktop.
import bpy
import bmesh
obj = bpy.context.active_object
me = obj.data
bm = bmesh.from_edit_mesh(me)
me.update()
edges = bm.edges
ok = lambda v: v.select and not v.hide
idxs = [v.index for v in edges if ok(v)]
ei = [bm.edges[i].verts for i in idxs]
ii = ei[0][0].index, ei[0][1].index, ei[1][0].index, ei[1][1].index
print(ii)
# polygon indices? must be nicer ways.
[[i.index for i in p] for p in [p.verts for p in bm.faces]]
[[i.index for i in p.verts] for p in bm.faces[:]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment