Help using a string variable on polyChipOff


#1

Hello! I’ve been working on my MEL skills by doing little scripts to help on my workflow, but I’ve come to a halt with this particular problem

I’m trying to call on the polyChipOff command using a string to dictate the faces at the end of the command, but I can’t seem to get it working and just receive an Invalid attribute name error.

I don’t know if it’s syntax related and can’t find an answer on the internet :frowning:

Here’s the script as of right now

completeDetach();

global proc completeDetach() {

string $facesList[] = `ls -sl`;
string $facesString;

int $strSize = size($facesList);

for( $i=0; $i<($strSize-1); ++$i ) {

   $facesString = ($facesString + $facesList[$i] + " ");

}

$facesString = ($facesString + $facesList[$strSize-1]);


polyChipOff -ch 1 -kft 1 -dup 0 -off 0 ($facesString);
polyPerformAction ("polySeparate -rs 1", "o", 0);


SelectToggleMode;

string $objName[] = `ls -sl`;
select -cl;
select -r pCube1;
DeleteHistory;
ungroup;	}

the problem it’s located at this line:

polyChipOff -ch 1 -kft 1 -dup 0 -off 0 ($facesString);