Hi this command is not working properly Actually when I run this command it is adding two suffixes to the group like this (polycube_high_high). It should add the only add 1 suffix ( polycube_high). How can I fix it?
Command
<div><span class="post-color-orange">global proc High() //Final procedure</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> </span></div><span class="post-color-orange"> </span><div><span class="post-color-orange">{ </span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> high(); </span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> GrpH(); </span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> inViewMessage -smg "Think And Done " -pos topCenter -bkc 0x00000000 -fade;</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange">}</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> </span></div><span class="post-color-orange"> </span><div><span class="post-color-orange">//It will add high suffix to an object</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> </span></div><span class="post-color-orange"> </span><div><span class="post-color-orange">proc high()</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange">{</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> string $sel[] = `ls -sl`;</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> int $sSize = size($sel);</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> string $suffix = "_high";</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> for($eo in $sel)</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> if(endString($eo, 5)!="_high")</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> {</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> rename $eo ($eo + $suffix);</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> } </span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> </span></div><span class="post-color-orange"> </span><div><span class="post-color-orange">//It will group your object</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> </span></div><span class="post-color-orange"> </span><div><span class="post-color-orange">proc GrpH()</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> </span></div><span class="post-color-orange"> </span><div><span class="post-color-orange">{</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> string $selObjs[] = `ls -sl`;</span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> group -name ( $selObjs[0] + "_high" ) $selObjs; </span></div><span class="post-color-orange"> </span><div><span class="post-color-orange"> }</span></div> <p> </p>
Replies
Hi, I got the code but, that -sm 12 commands will only work with polygon objects. So, It's not going to work with NURBS curve and surfaces. To avoid that I added this kind of method or string. Do you think this is fine?
GrpH();
string $selection[] = `ls -sl`;
string $polyGons[] = `filterExpand -sm 12 $selection`;
string $polyGons[] = `filterExpand -sm 9 $selection`;
string $polyGons[] = `filterExpand -sm 10 $selection`;
string $polyGons[] = `filterExpand -sm 10 $selection`;
select -r $polyGons;
high();
For more info refer to this blog.
https://help.autodesk.com/cloudhelp/2017/CHS/Maya-Tech-Docs/Commands/filterExpand.html