Retreiving element face number in binary .ply file I have a binary .ply file of a model, is there a way with blender to retrieve the number (i.e. their position in the file) of the faces corresponding to a set of vertices that I select in edit mode.

The header of my .ply file is the following:

ply
format binary_big_endian 1.0
comment CREATED BY FPLY_BMSH_RX01
element vertex    1572866
property float x
property float y
property float z
element face    3145728
property list int   int vertex_index
end_header


I've tried to do that with the following script (from Getting the number of faces a certain vertex is part of):

import bpy
import bmesh

me = bpy.context.object.data

# Get a BMesh representation
bm = bmesh.new()   # create an empty BMesh
bm.from_mesh(me)   # fill it in from a Mesh

for f in bm.faces:
    for v in f.verts:
        lf = v.link_faces
        print('num faces:', len(lf), 'faces: ', lf[:])
    break


But despite the vertices I have selected I always get the same list of faces as output.
Ok so here is the script that worked for me:

import bmesh
me = bpy.context.object.data
bm = bmesh.from_edit_mesh(me)

for v in bm.verts:
    if v.select:
        lf = v.link_faces
        face_indices = [f.index for f in lf]
        print(face_indices)