How to scale unconnected edges using individual origins in python? I want to scale each selected edge individually along it. To do it I first duplicate each selected edge and then try to scale it using bmesh.ops.scale. Unfortunately it scales using origin/median pivot point. How to do it in python so that edges are scaled using individual origins? How can I use different pivot types from python?
Here is my script:
import bpy
import bmesh

def getDupliEdges(edges):
    dupEdges = []
    for e in edges:
        retOneEdge = bmesh.ops.duplicate(
                bm,
                geom=[e])

        dupGeom = retOneEdge[&quot;geom&quot;]
        dupEdge = [ ele for ele in dupGeom if isinstance(ele, bmesh.types.BMEdge)]
        dupEdges.append(dupEdge[0])
    return dupEdges

def scaleEdges(dupEdges,factor):
    for e in dupEdges:
        verts = e.verts
        bmesh.ops.scale(
            bm,
            vec = factor,
            verts = verts)

obj = bpy.context.edit_object
mesh = obj.data
bm = bmesh.from_edit_mesh(mesh)
bm.faces.active = None

edges = [e for e in bm.edges if e.select == True]

view3dList = [ele for ele in bpy.context.screen.areas if isinstance(ele.spaces[0],bpy.types.SpaceView3D)]
view3d = view3dList[0]
view3d.spaces[0].pivot_point='INDIVIDUAL_ORIGINS'
    
dupEdges = getDupliEdges(edges)

scaleEdges(dupEdges, [2.0, 2.0, 2.0])

bmesh.update_edit_mesh(mesh, True)

Here is an image to illustrate the question.
On the left - initial selection - 3 edges;
In the middle - effect of my script;
On the right - how I would like it to work.

Thanks for any tips on that :)
You might do something like:

import bpy
import bmesh

obj = bpy.context.edit_object
bm = bmesh.from_edit_mesh(obj.data)

# current selection
edges = [e for e in bm.edges if e.select]

for e in edges:
    v1 = e.verts[0].co
    v2 = e.verts[1].co
    origin = (v1+v2) * 0.5  # edge origin
    bmv1 = bm.verts.new(((v1-origin) * 2) + origin)
    bmv2 = bm.verts.new(((v2-origin) * 2) + origin)
    bme = bm.edges.new([bmv1, bmv2])

bmesh.update_edit_mesh(obj.data, True)


I may be mistaken but I don't think at present the pivot point has any influence on bmesh.ops. So a slight modification of your original code gives a matrix to each new edge to scale: https://gist.github.com/zeffii/71862f5b1cad1bf1d2c1