Merging Edges in Maya

Its always fun when something you’ve been trying to do for a couple of hours turns out to be a one line command! That was my experience today trying to merge border edges through Maya python. I guess you can tell its been a while for Maya python and I…

I’m working on some modular character related scripts at the moment and wanted to make sure my characters were sewn together properly. All I needed was:

cmds.polySewEdge(t = 10)

Its not perfect, but if character pieces are modeled to a rig with the same amount of loops in border edges, it should work as expected.

I thought I’d share some interesting commands I looked at while looking for this one line command!

Choose all border edges in selection, where mode is which selections to apply to, type is edge, vertex etc and where is borders, inside, all etc:

cmds.polySelectConstraint(mode = 3, type = 0x8000, where = 1)

This returns a string of edges, so to get edge id integers:

edge = int(edge.split(“]”)[0][-1]

To merge selected edges, specifying first and second edge by id:

cmds.polyMergeEdge(fe = border_nums[0], se = border_nums[1])