The bmesh
module
Suggest for working with a mesh use the bmesh
module.
Test script. Assumes a face is selected and active in edit mode. For each edge in a face, look at its linked faces, and select if other face.
import bpy
import bmesh
ob = bpy.context.edit_object
me = ob.data
bm = bmesh.from_edit_mesh(me)
# have a face selcted and active
face = bm.select_history.active
link_faces = [f for e in face.edges
for f in e.link_faces if f is not face]
# select them
for f in link_faces:
f.select = True
# update mesh
bmesh.update_edit_mesh(me)
me.update()
Growing face selection by verts, (uses a set, includes original)
# from verts instead.
link_faces = set(f for v in face.verts
for f in v.link_faces)
# select them
for f in link_faces:
f.select = True
To find vert with lowest global z in linked faces. Could grab the minimum. I have started to lean towards sorting, since all or any of the rest may have same min as first.
verts = set(v for f in link_faces for v in f.verts)
# order by global z
mw = ob.matrix_world
sorted_verts = sorted(verts, key=lambda v: (mw * v.co).z)