simple text exporter of vertices for Blender Python

After executing main(), you can easily make use of the output on gnuplot.
e.g.
gnuplot> splot "file.dat"

import bpy
import bmesh

def up(v, f):
    for e in v.link_edges:
        ov = e.other_vert(v)
        if ov not in verts:
            verts.append(ov)
            up(ov, f)
    f.write("%f %f %f\n"% (v.co.x, v.co.y, v.co.z))
    
def down(v, f):
    f.write("%f %f %f\n"% (v.co.x, v.co.y, v.co.z))
    for e in v.link_edges:
        ov = e.other_vert(v)
        if ov not in verts:
            verts.append(ov)
            down(ov, f)
    
obj = bpy.context.active_object
bm = bmesh.from_edit_mesh(obj.data)

verts = []

def main():
    f = open("file.dat", "w")
    v0 = bm.verts[0]
    verts.append(v0)
    e0 = v0.link_edges
    u = e0[0].other_vert(v0)
    verts.append(u)
    up(u, f)
    f.write("%f %f %f\n"% (v0.co.x, v0.co.y, v0.co.z))
    if len(e0)>1:
        d = e0[1].other_vert(v0)
        verts.append(d)
        down(d, f)
    f.close()