Select faces inside selected edges?

How could I do this with bmesh maybe? I need to select faces inside selected edges. This works only 50% of the time and I need it to work 100%.

I’m currently selecting the weighted edges then doing this.


Sometimes the selection is inverted and it has to be


or it even selects random parts.

Well, blender has no idea of knowing what is “inside” and what is “outside” since those are abstract concepts that only make sense to you the user, so it’s basically flipping a coin (which is why you’re seeing it work 50% of the time). If you want to use the mouse cursor to define what is “inside” by hovering over a face, you could just use a flood-fill selection algorithm to achieve your result. Personally, I’d start with the face under the cursor and add all connected faces to a Queue- checking each face in the queue and adding connected faces except when a selected edge is reached. When the queue is finished you should have a list of faces that need to be selected.

I usually select the outermost faces I want, hide them, select the interior faces with L and unhide. Not what you want, but another way to get the result. You could hide the edges, too, but you have to enable vertex selection first or the islands will still be connected by the edges running the other way. Then press L to select linked geometry.

But if you want to use bmesh for this, testure is right- you’ll run into an ambiguity that needs a heuristic to solve. And heuristics can be wrong! You might be able to write a better heuristic that’s wrong a lot less often, though.