Selecting edges on the boundaries of a mesh in Blender

It is often necessary to select all the boundary edges of a mesh – edges that are on the outer perimeter of the mesh, or located around areas of the mesh that are not filled by polygons. This operation can be performed by the user from the 3D Viewport menu: Select – Select Loops – Select Boundary Loop.

When the user uses this menu item, the operator “region_to_loop()” is calling.

We can call this operator from the Python Console or programmatically in the code of our scripts or add-ons.

It should be noted that this operator only works on selection, so, to select all the boundaries of the mesh, all the mesh grid must be selected.

Also, we can select all the boundaries of the mesh without the help of this operator.

We can use the “is_boundary” property that all edges in bmesh have. This property indicates whether the edge is a boundary of the mesh (True) or not (False).

Let’s create a bmesh object, transfer the data from the currently active mesh to it and reindex the edges in the bmesh object. The original mesh in the scene must be in the “EDIT” mode.

Not to depend on the original selection, let’s reset the selection for all polygons.

Now we can loop through all the edges, and if an edge is a boundary, select it.

Next, all we have to do is return the data from bmesh back to the original mesh.

Now all the boundary edges on our mesh will be selected.

1 1 vote
Article Rating
Subscribe
Notify of
guest

2 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Felix
Felix
28 minutes ago

Mesh Updates: Before accessing properties like is_boundary, you may need to call
mesh.calc_edges () or
mesh.calc_loop_triangles() to
ensure the mesh data is up-to-date.