I don't think this exists already.. but it may.
But if someone would be willing to script it, that would be very awesome

Basically what I am looking for is a way to select 2 edges, then loop/ring the edges only in-between those selected edges and not past them. This would allow me to isolate loops/rings and remove/adjust edges more quickly.
Thanks!
Matt
Replies
According to my memory, steps are these:
1. Get the two edges limiting the span
2. Choose one limit edge and get every sorted loop/ring staring from it in every possible direction
3. Look for the second edge limiting the span in each sorted edge list, if found store that list
4. For each list stored, count how many edges are between the two limiting span and pick the one with the lower number; if more than one share the same count pick all of them
5. Set the new edge selection
Unfortunately working with editable poly (tris/quads/n-gons) doesn't allow to make many assumption about topology. Between two edges there can be more than one or two ways to connect them legally via loop or ring, so you must test everything. In example think about a subdivided cube.
The trickier part of this script is making the functions to get sorted directional edge loops/rings. They must be optimized because involve the repeated use of many slow MaxScript methods, and even in that case, they are still much slower than coded through the SDK, which provides access directly to the geometry database at a lower level.
I don't have Max in front of me but doesn't this only work for a loop and not for a ring?
I just need to learn the language/math so I can do some of this stuff. I've done scripting before, but it was in Torque, so I keep typing in stuff from that and getting confused.
I found one good vid tutorial, but will search for more, and of course reference the help stuff. I'm more or less just wanting to learn about maxscript to make tools that I think of while working to help myself or others who might want them.
edit: So that step loop is cool, but it doesn't seem to work with rings
I setup a button to take 2 edges, and put them into a variable and print my selection in a pair, which was easy, but then I'm not sure how to choose 1 edge and do the ring/loop in every direction from that.
I found this
But have no idea how to use it. I'll checkout CGTalk and Academy. I go to CGTalk alot, but forgot to check there. thanks
Speaking about loops, when you got an edge by index, you then should start finding its neighbour along the loop if it exists. Since an edge has always two vertexes as extremities, you can use one of them to define the direction to start looking for the loop.
At this point is a matter of getting elements by elements, in other words you can query the geometry database asking what polygons share the edge you selected, or you can ask what edges start form the vertex defining the search direction. In the loop case I use this sequence:
1. get edges from direction vertex (call this edgeSet_1)
2. get faces from starting edge (call this faceSet_1)
3. get edges from faceSet_1 (call this edgeSet_2)
4. subtract edgeSet_2 from edgeSet_1 (call the result edgeSet_3)
5. if edgeSet_3 is made by a single edge then it is the one we are looking for, store it
6. get vertexes from edgeSet_3 and subtract the old starting vertex (call it vertSet_1)
7. repeat the sequence with the new edge as starting edge, and the vertSet_1 as direction vertex
This could give you an idea about the process. Edge data you found is another topic. Take a look at "Editable_Poly Methods" in the reference, in particular the paragraphs "Get A Using B" and "Get By Edge". You should have clear in mind how Arrays and BitArrays work in MaxScript, take a look at "Array Values" and "BitArray Values". If you need to know loop syntax "Controlling Program Flow in Scripts" and "For Loop". In this particular case I use a do...while, but a regular while can work too.
in 2010 at least there are stepring and steploop, I'm not sure if its called something else in Polyboost.
Stepring doesn't work on poly-selection rings, though. I'm guessing because of the way it determines a poly-selection ring - stepringing would change the direction of the ring each time.
I've been working on learning scripting most all day, and have alot better understanding of it now