cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Grow and shrink Curve CV selection

Grow and shrink Curve CV selection

like grow and shrink component selection. Make it so that it will work for curve cvs as well please.

1 Comment
Anonymous
Not applicable
import i maya.cmds as cmds
def grow_selection ():
    """
    grow selection of cv's on a curve
    ====================================================================================================================
    :return:
    ====================================================================================================================
    """

    def get_object_verts(selection_vertex=''):
        extract_object = selection_vertex.split('.')[0]
        return cmds.ls(extract_object + '.cv[*]', flatten=True)


    sel = cmds.ls(selection=True, flatten=True)
    total_selection = []
    for i in sel:
        verts =  get_object_verts(selection_vertex = i)
        if not i in verts[0]:
            cmds.select(i)
            add_selection_up = cmds.pickWalk(i, direction='up')
            total_selection.extend (add_selection_up)

        if not i in verts[-1]:
            cmds.select(i)
            add_selection_down = cmds.pickWalk(i, direction='down')
            total_selection.extend (add_selection_down)

    cmds.select(sel, total_selection)

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea