script MeshToCurve for complex meshes?

Hi i’m totally new in working with python…and in blenderatist too
so hi everybody!:rolleyes:

i’m actually trying to get vertices from some complex meshes (metaballs converted to meshes) to do nurbs curves in X an Y (like a wireframe you can deform after).

i tried to write a script here but nothing happens:confused::confused::confused::

import Blender

from Blender import Mesh, Object, Scene, NMesh, Curve



ob = Blender.Object.GetSelected()[0]

me = NMesh.GetRawFromObject(ob.getName())

VertList= []

ListSameX = []

ListSameY = []





for v in me.verts:

    

    x = v.co[0]

    y = v.co[1]

    z = v.co[2]

    w = 2.0

    

    Vco = [x,y,z,w]

    VertList.append(Vco)

    

for coorda in VertList:

    

    SameX=[]

    SameY=[]

        

    for coordb in VertList:

        

        if coordb not in SameX:

            

            if coorda[0] == coordb[0]:

                

                SameX.append(coordb)

            

         if coordb not in SameY:

    

            if coorda[1] == coordb[1]:

                

                SameY.append(coordb)

        

    ListSameX.append(SameX)

    ListSameY.append(SameY)

    

for SameX in    ListSameX:

    

    c = Curve.New()

    

    for coordb in SameX:

        

        c.appendNurb(coordb)

        

    cur = Scene.GetCurrent()

    ob = Object.New('Curve')

    ob.link(c)

    cur.link(ob)

    

for SameY in    ListSameY:

        

    c = Curve.New()

    

    for coordb in SameY:

        

        c.appendNurb(coordb)

        

    cur = Scene.GetCurrent()

    ob = Object.New('Curve')

    ob.link(c)

    cur.link(ob)

    

    

Blender.Redraw()

i also tried a research in the forum archives but nothing for non-linear meshes