How to select all UV Shell border edges?


#1

Hey,
[MAYA 2016 SP6]

How do you easily select all the border edges of a models UV shells? I know you can display them in the editor, so Maya knows how to detect them… I just cannot find any way to easily select them.

I can select border edges per shell by double clicking one… but this gets very tedious when you are making many iterations and you have many shells.

None of the selection constraints seem to give me what i want.

The convert selections menu in both the UV editor and the main menu either straight up don’t work or appear to be broken.

Anyone know how i could go about this seemingly simple task?

any help would be greatly appreciated.

cheers


#2

select all edges in uveditor… RMB —> select --> shell border


#3

Hey,

Thanks for the reply.

Unfortunately that doesn’t work. Like I say, the tools seem to be broken in my opinion.
What that tool appears to be doing is selecting the border edges of the geometry… not the border edges of the UV shells / islands.

I would fully expect the tool you mentioned to do the job I am trying to do… however… it doesn’t :frowning:

cheers


#4

are you using the select tool in the uv editor…? cause it does work here…


#5

Hey,

Yeah. I have tried all the select options. both in the UV editor and the Main menu.
If a UV border edge lies on a geometry edge that is welded, it just will not select that as a UV border edge with those tools. for it to work i would have to separate the edges in the actual geometry … which i don’t want to do.


#6

it does work here in maya 2017


#7

Hey,

I just ran onto the same issue. I’m on maya 2016, extension 1, service pack 5. It looks like this might be a bug.

I know this is over half a year old, but if it helps as a workaround you can select the shell border using uvs instead (which works) and convert that to vertices and then edges, like so:

  1. Select all uvs
  2. Hotbox > To Shell Border
  3. Hotbox > To Vertex
  4. Hotbox > To Edges > To Contained Edges (This step has to be done in the viewport, as the option doesn’t show up in the UV editor)

Or you can just run this script:
cmds.select(“polySurface5.map[li]”); mel.eval(“polySelectBorderShell 1”); cmds.ConvertSelectionToVertices(); cmds.ConvertSelectionToContainedEdges()
[/li]
I found these steps in a 12 year old thread from 2006 here: http://forums.cgsociety.org/showthread.php?t=349015, so credit goes to cgtriguy. :slight_smile:

Hope this helps,

Yannick


#8

Spent two days on this. Here’s a solution that wont fail when your mesh has tiny geo with low vert counts

import maya.cmds as cmd

def selectBorderEdges(object):
    cmd.select('%s.e[*]' % object)
    mel.eval('PolySelectTraverse 2')
    cmd.select('%s.e[*]' % object, tgl=True)

object = cmd.ls(sl=True)[0]
selectBorderEdges(object)

#9

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

def get_uv_borders(objects):
    
    # Try to get edges from provided objects
    mesh_edges = list()
    for o in objects:
        try:
            mesh_edges.extend(cmds.ls(cmds.polyListComponentConversion(o, te=True), fl=True, l=True))
        except:
            pass
    
    # 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.
            uv_border_edges.append(edge)
        elif len(edge_faces) < 2:  # If an edge has less than 2 faces, it is a border edge.
            uv_border_edges.append(edge)
            
    # End progressWindow
    cmds.progressWindow(ep=True)
    
    return(uv_border_edges)

selection = cmds.ls(sl=True, l=True)
border_uv_edges = get_uv_borders(selection)
cmds.select(border_uv_edges)

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.

-Cheers