If I want to select all the edges in a mesh which are over 10 units in length, or all faces with area > 10 units, can I do this via the API?

I've looked at bpy.ops.mesh.select_similar() which lets you select features which are similar to the currently-selected feature, so it feels like this should be possible, but I'm not sure how.


1 Answer 1


Using the bmesh module

This is quite simple with the bmesh module. Test script selects all faces with area > 10 and all edges with lengths > 10. Remember these are local coordinates.

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

# select faces with area > 10

for f in bm.faces:
    f.select = f.calc_area() > 10

# edges length > 10

for e in bm.edges:
    e.select = e.calc_length() > 10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .