# Unfold a set of edges

I have a long curve of 425 vertices where there is two round parts :

I would like to unfold this curve to have a straight line where all edges length are the same than the initial curve.

Thanks !

• ...it could work adding an armature of 425 bones, each snapped to move single segments... :D I can't think of any other way... – m.ardito Oct 11 '16 at 14:14

I have created a script to do it.
There is probably a native way so I do not accept my own answer.

Here is the script :

import bpy
import bmesh

obj = bpy.context.edit_object
mesh = obj.data
bm = bmesh.from_edit_mesh(mesh)

previous = 0
current = bm.verts[399] #index of one of the two extremity

points = [0]

flag = False
while flag is False:
flag = True
nei = edge.other_vert(current)
if nei is not previous:
previous = current
current = nei
flag = False
len = (previous.co-current.co).length
points.append(points[-1]+len)
break

for v in points:
bm.verts.new((v,0,0))

bmesh.update_edit_mesh(mesh)

• Nice one. For ends, could look for verts that have only one link edge and put them in a list. [v for v in bm.verts if len(v.link_edges) == 1] Pop one and walk edges till you find the other end, pop the end and repeat till ends list is empty. Could also use BMEdge.calc_length(). – batFINGER Nov 8 '17 at 9:22