PDA

View Full Version : Maintaining selection order in an Array


trancor
07-31-2008, 11:51 PM
Hey, I've been getting pissed at maya when it comes to connecting a string of verts or edges on different sides of a hole together. I have no problem with setting up a script to merge verts together or to bridge edges sequentially. But I'm looking for a way to maintain the order I select components in an array.

I don't especially want to have scriptJobs running to update an array every time the selection changes due to there being a lot of things that could have me run into my same problem. Like if I use the border edge selection tool to select the edges I want to connect together. That will return the new selection in the same manor as I'm getting right now.

Heres the order I select something --
select -r caveMouth.e[1192] ;
select -tgl caveMouth.e[1148] ;
select -tgl caveMouth.e[1227] ;
select -tgl caveMouth.e[974] ;
select -tgl caveMouth.e[1365] ;
select -tgl caveMouth.e[1330] ;
select -tgl caveMouth.e[1295] ;
select -tgl caveMouth.e[1758] ;
select -tgl caveMouth.e[1703] ;
select -tgl caveMouth.e[1714] ;
select -tgl caveMouth.e[1725] ;
select -tgl caveMouth.e[1736] ;
select -tgl caveMouth.e[1747] ;
select -tgl caveMouth.e[1702] ;

Heres how the array `ls -sl -flatten` returns that --
caveMouth.e[974]
caveMouth.e[1148]
caveMouth.e[1192]
caveMouth.e[1227]
caveMouth.e[1295]
caveMouth.e[1330]
caveMouth.e[1365]
caveMouth.e[1702]
caveMouth.e[1703]
caveMouth.e[1714]
caveMouth.e[1725]
caveMouth.e[1736]
caveMouth.e[1747]
caveMouth.e[1758]

I tried using lsThroughFilter, thinkin -sort "byTime" might be what I want. But I keep getting errors with that command.

sp0rk3d
08-01-2008, 01:18 AM
may not be the most efficient thing to do but i guess you could run your array through a for loop and re order it into a new array that is the same order as the original selection....

you could tokenize the array so you are just looking at the number then compare the flattened array with the original, you would have to add in som logic so it could figure out where to put the flattened value of say 102 when it is compaired to a value like 100:106 but that does seem to hard...

just a thought... hope that it helps

ashishdantu
08-01-2008, 03:02 AM
ahhh ! i got the link .. and here it is >

highend3d post (http://www.highend3d.com/boards/index.php?showtopic=130529&st=0&p=130801&#entry130801)

and check this thread (http://forums.cgsociety.org/showthread.php?t=455797) ... lots of ideas for the same.

:thumbsup:

trancor
08-01-2008, 07:17 AM
sp0rk3d-
I wouldn't know how to reorder it tho. Could find neighboring faces and find which edge is the start and end edges.

ashishdantu-
Oh my, I didn't think about it that way, doing undo commands. That is certainly one way to do it. This will get me started. I'll still need to figure out how to do something like border edge select tool tho.

Thanks.

CGTalk Moderation
08-01-2008, 07:17 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.