Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import bpy
import bmesh
from mathutils import Matrix, Vector
def getDupliEdges(edges):
dupEdges = []
for e in edges:
retOneEdge = bmesh.ops.duplicate(bm, geom=[e])
dupGeom = retOneEdge["geom"]
dupEdge = [j for j in dupGeom if isinstance(j, bmesh.types.BMEdge)]
# now we're done with the original edges, we can deselect
for edge in edges: = False
# select the new ones.
for edge in dupEdges: = True
return dupEdges
def scaleEdges(dupEdges,factor):
for e in dupEdges:
mid_invert = (e.verts[0].co + e.verts[1].co) * -0.5
edge_matrix = Matrix()
edge_matrix[0][3] = mid_invert[0]
edge_matrix[1][3] = mid_invert[1]
edge_matrix[2][3] = mid_invert[2]
bmesh.ops.scale(bm, vec=factor, space=edge_matrix, verts=e.verts)
obj = bpy.context.edit_object
mesh =
bm = bmesh.from_edit_mesh(mesh) = None
edges = [e for e in bm.edges if]
dupEdges = getDupliEdges(edges)
scaleEdges(dupEdges, factor=[2.0, 2.0, 2.0])
bmesh.update_edit_mesh(mesh, True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.