// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // Procedure Name: // polySelectEdgesEveryN // // Description: // This procedure selects edge rings and loops // for selected edges and limits the selection to // every n'th edge. // // Input Arguments: // $method: the flag from the polySelect MEL command to use // "edgeLoop", "edgeRing", "edgeBorder" or "edgeLoopOrBorder" // $n: how many edges to skip over. // // Return Value: // None. global proc polySelectEdgesEveryN(string $method, int $n) { string $edges[] = `getEdges`; if (`size $edges`){ string $buffer[]; int $numTokens; $numTokens = `tokenize $edges[0] "[]" $buffer`; string $cmd = "polySelect -"; $cmd += $method; $cmd += " "; $cmd += $buffer[1]; if (`size $edges` > 1){ int $i; for ($i = 1;$i < `size $edges`;$i++){ $numTokens = `tokenize $edges[$i] "[]" $buffer`; $cmd += " -"; $cmd += $method; $cmd += " "; $cmd += $buffer[1]; } } $cmd += " "; $cmd += " -everyN "; $cmd += $n; $cmd += " "; eval($cmd); } }