edge 2 face python script ?

is there any python script for transforming edges to faces ?

This may be a naïve response, but what do you need it for? If you select a closed group of linked edges (or vertexes) and hit shift+F, they’ll fill up.

i know but this will be messy

this will be good for hair
transform the particle hair in faces to be use in game engine

Below is a short script which does what you want - from 2 edges selected --> to construct a face :wink:

from Blender import Mesh,Window
import bpy

editmode = Window.EditMode()
scn = bpy.data.scenes.active
ob = scn.objects.active
me = ob.getData(mesh=1)
if editmode: Window.EditMode(0)    
lst_ed = []
for ed in me.edges:
    if (ed.sel == 1):
        lst_ed.append(ed.index)
if (len(lst_ed) == 2):  # exactly 2 edges are selected
    lst_v = []
    for i in lst_ed:
        vi = me.edges[i].v1.index
        if not (vi in lst_v):
            lst_v.append(vi)
        vi = me.edges[i].v2.index
        if not (vi in lst_v):
            lst_v.append(vi)
    if (len(lst_v) >= 3):  # 3 or 4 verts are in the list
        me.faces.extend(lst_v)
#print lst_v
if editmode: Window.EditMode(1)

There are some restrictions though:

  1. Script supposes that your 2 edges selected are in one and the same object/mesh
  2. A face is constructed without checking if it is twisted in which case the order of verts to construct the face should be re-organised…

Regards,

ill give it a try

Thank You

You might have a look at Mesh->Scripts->Solid Wireframe
(it does not seem to work for edges that are not part of a face though)