Skip to main content
1 of 2
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. Will have a default of local avge if not passed a matrix.

def mid_edge(e, matrix=mathutils.Matrix()):       
    return matrix * (e.verts[0].co + e.verts[1].co) / 2
    
batFINGER
  • 85.2k
  • 10
  • 114
  • 244