Skip to main content
2 of 2
added 45 characters in body
batFINGER
  • 85.2k
  • 10
  • 114
  • 244

Some improvements.

  • Use list comprehension
  • Only need to multiply the local average edge coord by matrix world once.
  • Multiply / divide a vector by a scalar, rather than on a per component basis.

Test script

import bpy
import bmesh

ob = bpy.context.edit_object
me = ob.data
bm = bmesh.from_edit_mesh(me)

mw = ob.matrix_world
elist = [(e, mw * (e.verts[0].co + e.verts[1].co) / 2) 
        for e in bm.edges if e.select]

could make a little helper routine.

def mid_edge(e):       
    return (e.verts[0].co + e.verts[1].co) / 2

elist = [(e, mw * mid_edge(e)) 
        for e in bm.edges if e.select]        
batFINGER
  • 85.2k
  • 10
  • 114
  • 244