If an edge has more than 2 associated UVs for a given UV set, or 1 associated face, it is a UV border edge, so UV borders can be worked out pretty easily by counting the number of these components returned per edge with polyListComponentConversion.
Copy the following script into a shelf button or the Script Editor as python, select some mesh, and execute…
import maya.cmds as cmds
# Try to get edges from provided objects
mesh_edges = list()
for o in objects:
mesh_edges.extend(cmds.ls(cmds.polyListComponentConversion(o, te=True), fl=True, l=True))
# Error if no valid objects were found
if len(mesh_edges) <= 0:
raise RuntimeError('No valid mesh objects or components were provided.')
# Start progressWindow
cmds.progressWindow(t='Find UV Border Edges', pr=0, max=len(mesh_edges), ii=True)
# Find and return uv border edges
uv_border_edges = list()
for edge in mesh_edges: # Filter through the mesh(s) edges.
# Kill if progress window is cancelled
if cmds.progressWindow(q=True, ic=True):
cmds.progressWindow(ep=True) # End progressWindow
raise RuntimeError('Cancelled by user.')
# Update the progress window status
cmds.progressWindow(e=True, s=1, st=edge)
edge_uvs = cmds.ls(cmds.polyListComponentConversion(edge, tuv=True), fl=True)
edge_faces = cmds.ls(cmds.polyListComponentConversion(edge, tf=True), fl=True)
if len(edge_uvs) > 2: # If an edge has more than two uvs, it is a uv border edge.
elif len(edge_faces) < 2: # If an edge has less than 2 faces, it is a border edge.
# End progressWindow
selection = cmds.ls(sl=True, l=True)
border_uv_edges = get_uv_borders(selection)
This function will also work with multiple objects selected or a blend of components and meshes selected. If components are selected, it will only return border edges within the selected components.
FYI, because it is looping through each edge, it will be quite slow with very high poly objects. It would run much faster if rewritten using the OpenMaya API instead of maya.cmds, but it was quick to write up this way.