I need a programatic way to select every nth edge loop in a mesh, in a certain plane. (In the examples below I've shown a mesh with only 12 x/y subdivisions, but in practice my meshes have hundreds of divisions – far too many to select by hand.)

enter image description here

Is there a common solution for this? Or a script I could look at and learn from? I've tried using python – https://docs.blender.org/api/blender_python_api_2_67_1/bpy.ops.mesh.html – for this, but I'm not familiar enough with things to get any practical results. Would love to learn, though.

FWIW I've tried selecting all edge loops in a certain plane, and then using "checker deselect" to achieve the same result, but that doesn't do what I want.enter image description here

Thanks very much,


  • $\begingroup$ are your meshes always grids like this? $\endgroup$
    – zeffii
    May 9, 2017 at 20:22
  • $\begingroup$ They are, yes. The only difference between them is the number of subdivisions. (And thanks for helping!) $\endgroup$
    – Dunstan
    May 9, 2017 at 20:41

2 Answers 2


Following instructions from the related answer you can select them with UI as well.

  1. Select one edge perpendicular to the resulting edge loops. Run Edge Ring from the Edges menu (Ctrl+E) or press Ctrl+Alt while selecting the edge to select ring of edges based on the first selected edge.


  2. Run Checker Deselect.

    That's where you will adjust the selection pattern according to which you'd like to select (skip two loops, select the 3-rd, skip one, select the other one etc). The only difference is that you act on only one edge corresponding to each loop.


  3. Finally execute Edge Loops from the Select menu in the 3D Viewport header or press Ctrl+E to spread selection on the adjacent edge loops.


  • $\begingroup$ Well damnit, I can't believe that. I initially went through all those steps, but the very last part escaped me and I assumed I couldn't use that tool. Yes, that does seem to be a more practical solution. Thank you, WKG. $\endgroup$
    – Dunstan
    May 11, 2017 at 22:52

By assuming your grid will be parallel to the x-y axis and not rotated, I came up with this idea. It works fine for me and hope this helps.

import bpy, bmesh

# These are the parts that you can change, inputs
step_size =            5
first_selected_loop =   0
x_or_y_parallel =      "x"

# Switching to EDIT mode to read mesh data
bpy.ops.object.mode_set(mode = 'EDIT')

# Program will get the zeroth index or first index of vertices 
# (that is x or y coordintes) according to your choice
if x_or_y_parallel   == "x":
    x_y_index = 0
elif x_or_y_parallel == "y":
    x_y_index = 1

# Getting the mesh data
obj = bpy.context.scene.objects.active
bm  = bmesh.new()
bm  = bmesh.from_edit_mesh(obj.data)

# Getting all line coordinates that is parallel to selected axis

# I am assuming we don't know how many lines we got in x or y axis
line_x_or_y_cords = []
for vert in bm.verts:
    if vert.co[1-x_y_index] not in line_x_or_y_cords:
        line_x_or_y_cords += [vert.co[1-x_y_index]]

# I am sorting the line coordinates and
# eliminating unwanted coordinates (we need only the lines that are on 
# step size by starting first_selected_loop)
line_x_or_y_cords = line_x_or_y_cords[first_selected_loop::step_size]

# if the edge is not selected yet , if 2 vertex of that edge is 
#parallel to our expected axis and if one of its vertex is in our list 
# (that is arranged above) select that edge and do select loop 
for edge in bm.edges:
    if edge.select == False and (edge.verts[0].co[1-x_y_index] - edge.verts[1].co[1-x_y_index] == 0) and  edge.verts[0].co[1-x_y_index] in line_x_or_y_cords:
        edge.select = True
  • $\begingroup$ Hooray! Thanks so much, Alperen! That script runs perfectly when I put it in a txt file and click "Run Script", but cutting and pasting it into the console gives me a small error: File "<blender_console>", line 5 bm.free() ^ SyntaxError: invalid syntax Any thoughts on why that is? $\endgroup$
    – Dunstan
    May 11, 2017 at 19:35
  • $\begingroup$ That's really going to help my project advance. Thank you again for putting so much effort into helping me :) $\endgroup$
    – Dunstan
    May 11, 2017 at 19:37
  • $\begingroup$ I'm glad that I could help:) I have blender 2.78a and I don't get any errors. You can delete bm = bmesh.new() and bm.free() lines if you wish, it still works:) $\endgroup$ May 11, 2017 at 19:53
  • $\begingroup$ Also, sometimes blender just closes after I run the code and I don't know why:) $\endgroup$ May 11, 2017 at 20:01
  • $\begingroup$ Ah yes, my blender closed a few times too after running it :) Perhaps there's something in there that freaks it out. Well thank you so much for going to the trouble of writing all that code for me. I see that there's another solution posted here that's probably more practical since it uses built in tools, but I really appreciate your answer too! $\endgroup$
    – Dunstan
    May 11, 2017 at 22:55

You must log in to answer this question.

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