View Full Version : Need Help in MEL Script

12 December 2010, 11:42 PM
Hi all,
I created a poly sphere and a poly cylinder and assigned those names into a variable

//This is my script

string $test= "pSphere1";
string $testb= "pCube1";

connectAttr -f $test.rotate $testb.rotate;


But I couldn't successfully connect the attributes and error is coming up..

//Error: Invalid object or value: pCube1 //

can any one please tell how can I connect attributes of of objects assigned through variables.

The variables are working with all the other set of commands like e.g. select

but when used in connectAttr its not working. Thanks in advance....:cool:

12 December 2010, 06:34 PM
.rotate is a literal "string". $test is a variable. you cannot inline catenate variables and strings directly in MEL without using + and brackets (braces):

connectAttr -f ($test + ".rotate") ($testb + ".rotate");

12 December 2010, 07:40 PM
Thanks u very much worked :thumbsup:

CGTalk Moderation
12 December 2010, 07:40 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.