Home Technical Talk

Toggle Convert Selectinon To...

maksoon
polycounter lvl 6
Offline / Send Message
maksoon polycounter lvl 6
Hey. I had the idea to combine 3 standard commands in one toggle. ConvertSelectionToContainedFaces ConvertSelectionToVertexPerimeter ConvertSelectionToEdgePerimeter Originally selected face. When you press one key is too much between the outer vertices, edges, and a return to the inner face or the face group. I think it's quite simple to implement with the help of programming and it will be a useful tool. I am hope for your help. Thank you!

Replies

  • [Deleted User]
    Options
    Offline / Send Message
    [Deleted User] insane polycounter
    The user and all related content has been deleted.
  • maksoon
    Options
    Offline / Send Message
    maksoon polycounter lvl 6
    Yes, Maya.

    I had the idea to combine 3 standard commands in one toggle.

    ConvertSelectionToContainedFaces
    ConvertSelectionToVertexPerimeter
    ConvertSelectionToEdgePerimeter

    Originally selected face. When you press one key is too much between the outer vertices, edges, and a return to the inner face or the face group.

    Perhaps I did not quite understand the meaning of your message in the subject. I do not speak very well in English.

  • [Deleted User]
    Options
    Offline / Send Message
    [Deleted User] insane polycounter
    The user and all related content has been deleted.
  • maksoon
    Options
    Offline / Send Message
    maksoon polycounter lvl 6
    That's what I mean. I want to assign these commands to a single key

  • JohnnyRaptor
    Options
    Offline / Send Message
    JohnnyRaptor polycounter lvl 15
    So had some spare time and wrote this up for you, gif demo below,



    To use it, load up your script editor, paste the code below in mel, and middle mouse drag it to a shelf.

    Every time you click the script, it will convert selection. Face -> Vertex -> Edge and repeat.

    string $cSel[] = `ls -sl`;
    string $wSel1[];
    string $wSel2[];
    
    $numTok = tokenize($cSel[0], ".", $wSel1);
    $numTok = tokenize($wSel1[1], "[", $wSel2);
    
    if ($wSel2[0] == "f")
    {
        ConvertSelectionToVertexPerimeter;
    } else if ($wSel2[0] == "e")
    {
        ConvertSelectionToContainedFaces;
    } else if ($wSel2[0] == "vtx")
    {
        ConvertSelectionToEdgePerimeter;
    }
  • maksoon
    Options
    Offline / Send Message
    maksoon polycounter lvl 6
    So had some spare time and wrote this up for you, gif demo below,



    To use it, load up your script editor, paste the code below in mel, and middle mouse drag it to a shelf.

    Every time you click the script, it will convert selection. Face -> Vertex -> Edge and repeat.

    string $cSel[] = `ls -sl`;
    string $wSel1[];
    string $wSel2[];
    
    $numTok = tokenize($cSel[0], ".", $wSel1);
    $numTok = tokenize($wSel1[1], "[", $wSel2);
    
    if ($wSel2[0] == "f")
    {
        ConvertSelectionToVertexPerimeter;
    } else if ($wSel2[0] == "e")
    {
        ConvertSelectionToContainedFaces;
    } else if ($wSel2[0] == "vtx")
    {
        ConvertSelectionToEdgePerimeter;
    }
    Thx, but its dosnt work on more complex planes with many selected faces. Only if one polygon is on one side of the cube.

  • JohnnyRaptor
    Options
    Offline / Send Message
    JohnnyRaptor polycounter lvl 15
    Hm yeah i see the problem. It appears to be the limitation of convertSelectionToContainedFaces.

    Ok this should work. 
    Kudos to c.buliarca for the modified uv-to face code that i used.



    string $cSel[];
    string $wSel1[];
    string $wSel2[];
    string $selE[];
    string $ffObj = "";
    string $myFaces[];
    int $selTyp;
    int $fObj1[];
    
    clear($cSel);
    $numTok = "";
    $numTok = "";
    
    $cSel = `ls -sl`;
    $numTok = tokenize($cSel[0], ".", $wSel1);
    $numTok = tokenize($wSel1[1], "[", $wSel2);
    
    if ($wSel2[0] == "f")
    {
        ConvertSelectionToVertexPerimeter;
        SelectFacetMask;
        select -clear;
        SelectVertexMask;
    } else if ($wSel2[0] == "e")
    {
        clear($selE);
        $selE = `ls -sl -fl`;
        $selTyp = `selectType -q -meshComponents`;
        polyUVSet -create -uvSet "fSelUV" $wSel1[0];
        polyUVSet -currentUVSet -uvSet "fSelUV" $wSel1[0];
        clear $fObj1;
        $ffObj = "";
        $fObj1 = `polyEvaluate -f`;
        $ffObj = ($wSel1[0]+".f[0:"+$fObj1[0]+"]");
        select -r $wSel1[0];
        polyProjection -ch 1 -type Planar -ibd off -kir  -md z $ffObj;
        polyMapCut -ch 1 $selE;
        select -r ($wSel1[0]+".map["+$fObj1[0]+"]");
        polySelectBorderShell 0;
        $myFaces = `polyListComponentConversion -fuv -tf -in`;
        select -r $myFaces;
        polyUVSet -uvs "fSelUV" -delete;
        hilite -r $wSel1[0];
        InvertSelection;
        if($selTyp == 1){
          selectType -meshComponents true;  
        }else{
            selectType -pf true;
        }
        SelectEdgeMask;
        select -clear;
        SelectFacetMask;
    } else if ($wSel2[0] == "vtx")
    {
        ConvertSelectionToContainedEdges;
        SelectVertexMask;
        select -clear;
        SelectEdgeMask;
    }

  • maksoon
    Options
    Offline / Send Message
    maksoon polycounter lvl 6
    Thank you so much! Now it works perfectly. Thank you very much for your help.

  • Burpee
    Options
    Offline / Send Message
    Burpee polycounter lvl 9
    Hm yeah i see the problem. It appears to be the limitation of convertSelectionToContainedFaces.

    Ok this should work. 
    Kudos to c.buliarca for the modified uv-to face code that i used.



    string $cSel[];
    string $wSel1[];
    string $wSel2[];
    string $selE[];
    string $ffObj = "";
    string $myFaces[];
    int $selTyp;
    int $fObj1[];
    
    clear($cSel);
    $numTok = "";
    $numTok = "";
    
    $cSel = `ls -sl`;
    $numTok = tokenize($cSel[0], ".", $wSel1);
    $numTok = tokenize($wSel1[1], "[", $wSel2);
    
    if ($wSel2[0] == "f")
    {
        ConvertSelectionToVertexPerimeter;
        SelectFacetMask;
        select -clear;
        SelectVertexMask;
    } else if ($wSel2[0] == "e")
    {
        clear($selE);
        $selE = `ls -sl -fl`;
        $selTyp = `selectType -q -meshComponents`;
        polyUVSet -create -uvSet "fSelUV" $wSel1[0];
        polyUVSet -currentUVSet -uvSet "fSelUV" $wSel1[0];
        clear $fObj1;
        $ffObj = "";
        $fObj1 = `polyEvaluate -f`;
        $ffObj = ($wSel1[0]+".f[0:"+$fObj1[0]+"]");
        select -r $wSel1[0];
        polyProjection -ch 1 -type Planar -ibd off -kir  -md z $ffObj;
        polyMapCut -ch 1 $selE;
        select -r ($wSel1[0]+".map["+$fObj1[0]+"]");
        polySelectBorderShell 0;
        $myFaces = `polyListComponentConversion -fuv -tf -in`;
        select -r $myFaces;
        polyUVSet -uvs "fSelUV" -delete;
        hilite -r $wSel1[0];
        InvertSelection;
        if($selTyp == 1){
          selectType -meshComponents true;  
        }else{
            selectType -pf true;
        }
        SelectEdgeMask;
        select -clear;
        SelectFacetMask;
    } else if ($wSel2[0] == "vtx")
    {
        ConvertSelectionToContainedEdges;
        SelectVertexMask;
        select -clear;
        SelectEdgeMask;
    }



    This is awesome :-) Thanks for taking the time to do it mate ! 
Sign In or Register to comment.