I have this mesh:
I need to find all faces linked to the selected edges. How can I find that using BMesh? I know this way:
for e in edges:
for f in e.link_faces:
print("Link Faces:", f)
normals.append(f.normal.copy())
but for some reason this isn't good for me. Is there any other? Thank you.
EDIT: I need to be more specific, so to highlight the problem. The object I need to check:
Now I need to know if the edges from a selection lies on the same plane. So I check for those edges face normals. The script:
me = ob.data
if me.is_editmode:
# Gain direct access to the mesh
bm = bmesh.from_edit_mesh(me)
else:
# Create a bmesh from mesh
# (won't affect mesh, unless explicitly written back)
bm = bmesh.new()
bm.from_mesh(me)
# get all selected edges
edges = [e for e in bm.edges if e.select]
# check if all connected face normals are
# on the same plane. the check is strict
faces=[]
normals=[]
for e in edges:
for f in e.link_faces:
faces.append(f)
print("Link Faces:", f)
print("Normal: ",f.normal)
print("Normal copy: ",f.normal.copy())
normals.append(f.normal.copy())
# check they're all the same vector
coplanarity = all(x==normals[0] for x in normals)
print("Coplanar: ", coplanarity)
First selection:
results:
Link Faces: <BMFace(0x11f892818), index=311, totverts=4>
Normal: <Vector (0.0000, -0.0000, 1.0000)>
Normal copy: <Vector (0.0000, -0.0000, 1.0000)>
Link Faces: <BMFace(0x11f8927e0), index=310, totverts=4>
Normal: <Vector (0.0000, -0.0000, 1.0000)>
Normal copy: <Vector (0.0000, -0.0000, 1.0000)>
Coplanar: True
Second selection:
Results:
Link Faces: <BMFace(0x109d47b80), index=226, totverts=4>
Normal: <Vector (0.0000, 0.0000, 0.0000)>
Normal copy: <Vector (0.0000, 0.0000, 0.0000)>
Coplanar: True
The two edges are selected to be on the same face; as you can see, the normals result being different while they're obviously the same. Looks like a non-manifold kind-of bug. So I need to take another route...
EDIT2:
No it's not a bug. I did more tests, there's st. I don't get here...



