Home Technical Talk

Mel script edit cvs of maya curve.

polycounter lvl 5
Offline / Send Message
deohboeh polycounter lvl 5
Mel Noob: I want make a script to delete the first cv of a maya curve. Any help is much appreciated.

Replies

  • deohboeh
    Offline / Send Message
    deohboeh polycounter lvl 5
    Got it. Leaving this here for someone who needs it.
    SelectAllNURBSCurves;
    
    string $c[] = `ls -sl`;
    
    for ($i in $c)
    {
        delete ($i + ".cv[0]");
    }
    
  • Bartalon
    Offline / Send Message
    Bartalon polycounter lvl 12
    Assuming you always want the very first CV, it will always be position [0]. So curve1.cv[0].

    If you want your script to work on any curve selection, you can store your selection first
    {
        // stores current selection
        string $curve[] = `ls -sl`; 
        // for loop allows script to work on any number of curves at one time
        for ($i=0; $i<`size $curve`; ++$i) {
            // skips anything that doesn't have CVs
            if (objExists ($curve[$i] + ".cv[0]")) {
                delete ($curve[$i] + ".cv[0]" );
            }
        }
    }
    
Sign In or Register to comment.