I'm new around here. I wanted to ask if there is any way to order the vertex index in this way? enter image description here


2 Answers 2


Bmesh version

enter image description here

Here is a bmesh version of @3fingeredfrog's answer using method suggested here https://blender.stackexchange.com/a/36619/15543

Orders based on distance from scene cursor.

import bpy
import bmesh

context = bpy.context
scene = context.scene
ob = context.edit_object
mw = ob.matrix_world
cloc = mw.inverted() @ scene.cursor.location
me = ob.data

bm = bmesh.from_edit_mesh(me)
verts = sorted(bm.verts, key=lambda v: (v.co - cloc).length)

for i, v in enumerate(verts):
    v.index = i

Could maually select all vertices in order (one by one) and retrieve from the select history

verts = [e for e in bm.select_history if isinstance(e, bmesh.types.BMVert)]

The order in question appears to be that next is furthest of all the connected verts if not visited.


In this particular case, yes, by ordering the index number of each vertex relative to its distance from the 3D cursor.

1: From the Viewport Overlays menu > Developer > enable the Indices option. The index number of each selected vertex will now be displayed in blue.

enter image description here

2: Position the 3D Cursor so that it is closest to "v1" and "v2" is the next closest ..........

3: In Edit mode and with the vertices selected: open the Mesh menu > Sort Elements > choose the Cursor Distance option.

now v1=0 v2=1 v3=2 v4=3 etc

enter image description here

  • $\begingroup$ Good answer, but the questions tag says scripting. Do you have any input on a scripting approach? E.g. how to position the 3D Cursor and call that operation with python? $\endgroup$
    – Leander
    May 14, 2020 at 10:15
  • $\begingroup$ oppps, I missed that @Dark -Z was looking for a scripting solution and have no idea how to do that with python. $\endgroup$ May 14, 2020 at 10:21
  • $\begingroup$ thanks for the information, I work by doing it manually but do not know of the existence of any python script that does this job? $\endgroup$
    – Dark -Z
    May 15, 2020 at 19:10
  • $\begingroup$ I need a script because there are many mesh that I need to order the index $\endgroup$
    – Dark -Z
    May 15, 2020 at 19:11

You must log in to answer this question.

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