Hi i’m actually stuck with a short script that pick points from a mesh and organize them into lists of same X-coordinates to draw curves from those lists. The problem is:
1- curves are not closed and I don’t know how to close them (maybe “myCurve.isCyclic== True”?)
2-curves are disorganised because points inside the lists of same X-coordinates are not sorted well, and I don’t know how to do that.
here is the script (it was specially written for metaballs converted to mesh so maybe it may causes some error for other objects):
#IMPORTING MODULES#
import Blender
from Blender import Mesh, Object, Scene, NMesh, Curve, CurNurb
ob = Blender.Object.GetSelected()[0]# Selectionne le premier objet selectionne
me = NMesh.GetRawFromObject(ob.getName())# Recupere la geometrie du mesh selectionne
# declaration des listes
VertList= []# liste de vertex du mesh
ListSameX = []# liste de vertex du mesh qui ont meme abscisse
for v in me.verts: # recupere les coordonnees des vertex du mesh et rajoute une Quatrieme valeur correspondant aux futures points de la courbe
x = v.co[0]
y = v.co[1]
z = v.co[2]
w = 2.0
Vco = [x,y,z,w]
VertList.append(Vco)# la liste comprend un ensemble de listes de quatres elements chacun
for coorda in VertList:
SameX=[]
for coordb in VertList:
if coordb not in SameX:
if coorda[0] == coordb[0]:
SameX.append(coordb)
ListSameX.append(SameX)
for SameX in ListSameX:
cu = Curve.New()
cu.appendNurb(SameX[0])
cu_nurb = cu[0]
SameX.remove(SameX[0])
for coordb in SameX:
cu_nurb.append(coordb)
ob= Object.New('Curve')
ob.link(cu)
scn= Scene.GetCurrent()
scn.link(ob)
ob.layers= [6]
Blender.Redraw()
anybody for saving me:D;)?