Home Technical Talk

Select multiple object vertex by number (Maya MEL)

RS7
RS7
polycounter lvl 3
Offline / Send Message
RS7 polycounter lvl 3
Hi! I need to select multiple object vertices. They all share the same number of vertex, but the names are different.
I guess it should be pretty straight forward short MEL script - select vtx nr 5 for all selected objects, but my MEL skills are non existing.
Or maybe there's another way to do it?

Thanks!


Replies

  • sprunghunt
    Options
    Online / Send Message
    sprunghunt polycounter
    something like:

    select -r ($object + ".vtx[5]") ;

    doesn't work?
  • RS7
    Options
    Offline / Send Message
    RS7 polycounter lvl 3
    Hi sprunghunt!

    It seems to not work. yet

  • RS7
    Options
    Offline / Send Message
    RS7 polycounter lvl 3
    Alrighty.
    I did some corrections to the previous sprunghunt's line and i got something that works with one vertex

    select -r $obj.vtx[5] ;

    I could not get the multiple vertex selection with this one line, so i scrolled some forums and came up with this:

    string $sel[] = `ls -sl`;
    string $obj;
    for ($obj in $sel)
    {
    select -r $sel.vtx[10] ;
    select -add $sel.vtx[20] ;
    select -add $sel.vtx[70] ;
    //select -add $sel.vtx[addYourNumberOrDELETEme] ;
    }
    select -d $sel ;

    It does the job for now, but i'd like to bring it a bit further and learn how to mel 101.
    Few things right off the bat:
    1. after selecting vertex - deselect $obj, but keep vertex selection -edit- i just simply put select -d $sel ; in the end of the ecript and now it  does that. 

    2. If -add.vtx value is higher than number of vertices on object, then currently it selects the highest number there is. I'd like to keep that number unselected, if there is no such vertex or give a error message that the number added is too high.

    3. I can not manually deselect any vertex if needed


  • RS7
    Options
    Offline / Send Message
    RS7 polycounter lvl 3
    Something happened with my previous post and it seems to be missing. 

    corrected the sprunghunt's code a bit select -r $obj .vtx[5] ;
    i could not get multiple vertex selection with it so i did some searching.
    anyways, here's the script i did after a little bit of scrolling through the internet. mix and match 

    string $sel[] = `ls -sl`;
    string $obj;
    for ($obj in $sel)
    {
    select -r $sel.vtx[10] ;
    select -add $sel.vtx[20] ;
    select -add $sel.vtx[0] ;
    }

    select -d $sel ;

     it does the job, but it has some issues. 

Sign In or Register to comment.