Skip to content

Instantly share code, notes, and snippets.

/Text

Created February 25, 2015 10:34
Show Gist options
  • Save anonymous/457ffc35e0e2def9df68 to your computer and use it in GitHub Desktop.
Save anonymous/457ffc35e0e2def9df68 to your computer and use it in GitHub Desktop.
fancy.py_2015_02_25_11-33
import bpy
import bmesh
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)]
dupEdges.append(dupEdge[0])
# now we're done with the original edges, we can deselect
for edge in edges:
edge.select = False
# select the new ones.
for edge in dupEdges:
edge.select = True
return dupEdges
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]
dupEdges = getDupliEdges(edges)
bmesh.update_edit_mesh(mesh, True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment