#------------------
# ME is supposed to be a mesh
#------------------
ME=Blender.Object.GetSelected()[0].getData()
#------------------
# for the example, get the two first vertices of ME
#------------------
A=ME.verts[0]
B=ME.verts[1]
#------------------
# for the example, a list of values for "percent"
# this will create 4 point on the edges [AB]
#------------------
for percent in [10,20,45,75] :
#------------------
# create a vertex to be added to the mesh
#------------------
C=Blender.NMesh.Vert()
#------------------
# Calculate the location of C between A and B, in x,y and z
axis .
# like that : C=A+(B-A)*percent
#------------------
for n in [0,1,2]:
C.co[n]=A.co[n]+(B.co[n]-A.co[n])*percent/100.0
#------------------
# have an echo in the console
#------------------
print C.co
#------------------
# Add new vertex to the list
#------------------
ME.verts.append(C)
#------------------
# insert the new data of ME in Blender daat base .
#------------------
ME.update() |