Hi @Krzym,
I wrote this little script that should solve your problem. Its commented well enough that you should be able to follow the basic logic. You can pass it a list off edges (one side of the mesh) or it can use your selection.
If this code doesn’t show up you can get it here:
from maya import cmds
def find_edges_between(input_edges=None, summery_axis='x'):
'''
Given an list of edges on one side of a mesh this function finds the edges on the same loop that are between
the input edge(s) and a symetrical set of edges. This function is not dependant on edge indices
:param input_edges A lsit of at least one edge on one side of a mesh.
:param summery_axis The symmerty axsis in object space NOT world space.
:returns List of the edges in between
'''
if not input_edges: # Get selection if no list is passed
edge_set_1 = cmds.ls(sl=True, fl=True)
else:
cmds.select(input_edges, r=True) # Select the list
edge_set_1 = cmds.ls(sl=True, fl=True) # Make sure the edge list is flat (every edge name listed)
cmds.symmetricModelling(about='object', axis=summery_axis, s=1) # Turn on object symmetry around the axis passed
cmds.select(edge_set_1, symmetry=True, r=True) # Replace the selection with a symmetrical selection
# Loop selection and keep a list of new edges aka symmetrical edges
edge_set_2 = [e for e in cmds.ls(sl=True, fl=True) if e not in edge_set_1]
cmds.symmetricModelling(s=0) # Turn off object symmetry
# Get the index of the first edge in the lists of edges and cast to int
edge_1 = int(edge_set_1[0].split('[')[-1].split(']')[0])
edge_2 = int(edge_set_2[0].split('[')[-1].split(']')[0])
# Find the shortest edge loop path between the above two indices
between_edges = [e for e in cmds.polySelect(edgeLoopPath=(edge_1, edge_2), ass=True, ns=True)
if e not in edge_set_1 and e not in edge_set_2]
print(between_edges) # Print the between edges for easy copy and paste
return between_edges