Home Technical Talk

Is there a Ring between edges Maxscript?

polycounter lvl 11
Offline / Send Message
Bigjohn polycounter lvl 11
Anyone knows if there's a maxscript out there that will select a ring that's the shortest distance between two edges?

I tried writing it myself, but it's going over my head. Can't figure out how to select the parallel edge of an edge selection.

Replies

  • miauu
    Options
    Offline / Send Message
    miauu polycounter lvl 14
    IC.Shape has this feature and it is free. Try it :)
  • Bigjohn
    Options
    Offline / Send Message
    Bigjohn polycounter lvl 11
    How would you iterate through the edges though?

    When you call ring and then get the current selection, it just gives you a list of edges sorted by the edge-number. So I have no way of knowing if one edge is the next one up in the ring, or just some random edge in that ring.
  • SpeCter
    Options
    Offline / Send Message
    SpeCter polycounter lvl 14
    I think it was something like:

    1.get all edges connected to the endpoints of first selected egde
    2.substract all edges which form the both surrounding polygons

    ->What you get is the first step in the ring between 2 selected edges

    if you continue till you hit the other selected edge you are done with the ring between the 2 edges.

    Like the normal ring tool, this won´t work if it has to run over a pole

    Edit:Like Perna said, you get 2 possible solutions if the ring can be completed. Then you have to use the one which has fewer edges involved.

    Edit2: You can(or rather have to) use the endverts of the edges to determine if 2 edges are connected.




    EDIT3: DON´T MIND ME I´M JUST TALKING SHIT, BECAUSE I MISREAD SOMETHING!
  • Bigjohn
    Options
    Offline / Send Message
    Bigjohn polycounter lvl 11
    miauu wrote: »
    IC.Shape has this feature and it is free. Try it :)

    This is cool. Their script does exactly what I want. The only problem is that you have to have their IC.Shape menu open in order to use those functions. Means that you can't just set a keyboard shortcut to it and forget about it.
  • SpeCter
    Options
    Offline / Send Message
    SpeCter polycounter lvl 14
    1. Get Endverts of 1 selected edge
    2. Get all edges connected to the endverts
    3. Get all endverts of this edges
    4. determine which of these verts form a new edge as a pair
    5. save the pair(you will most likely get 2 pairs, one in each direction)
    6. do the same procedure again for the edges between the vert-pairs, except that you look if one edge is already in your list.
    7. do that till you hit the other edge
    8. determine which edgelist is shorter
    9 good to go


    I hope that was clear enough and doesn´t contain any horrible errors produced by brainfarts.
  • Bigjohn
    Options
    Offline / Send Message
    Bigjohn polycounter lvl 11
    That sounds pretty clear Specter. Thanks for the info, I'll try that when I have some spare time.
  • SpeCter
    Options
    Offline / Send Message
    SpeCter polycounter lvl 14
    Just some pictures for clarification(i know it´s an artistic masterpiece):
    brainfart.png
  • Bigjohn
    Options
    Offline / Send Message
    Bigjohn polycounter lvl 11
    Thanks for that dude. I ended up writing it just for fun, but it's turning into a huge piece (~100 lines now) for something that the IC.shape script does better.

    The good news is that it actually does work pretty well. But only on a simple cylinder shape. If there are poles, then it throws the whole thing off. And I gotta add some checks for if the two edges the user selected are on the same ring. Which will make the whole thing bigger.

    Was fun writing it though, and it does work :)
  • SpeCter
    Options
    Offline / Send Message
    SpeCter polycounter lvl 14
    Actually i just thought of an easier way to achieve that(poles will(or can be) still be a problem i guess.

    The easier(and somewhat faster) method would be something like this:
    brainfart2.png

    That should make your code much smaller i guess.Simple but pretty :D
Sign In or Register to comment.