Ok, so first I'm not a Mel programmer, I usually do my script in Python so there might be syntax errors in my code.
Your problem:
Correct me if I'm wrong, but I think you are trying to get the distance
attribute of distanceDimensionShape1
into a variable and set it to scaleX
attribute from joint2
.
Your code:
string $Adistance = ("distanceDimensionShape1"+".distance");
expression -s (" $Bdistance = $Adistance; joint2.scaleX = $distance");
What you are doing in your 1st line: You are declaring a string variable containing "distanceDimensionShape1.distance"
, not getting the distance
attribute of distanceDimensionShape1
What you should be doing in your 1st line: Use the getAttr command provided in maya docs the retrieve the attribute of your shape.
What you are doing in your second line: You are trying to set joint2.scaleX
which is a float value with a string value. I guess... because I don't know what's $distance
as it appears only here in your code.
What you should be doing in your second line: Use setAttr to properly set your attribute.
My solution:
I hope this will help as we have only few informations on your current problem:
float $Adistance = `getAttr distanceDimensionShape1.distance`;
setAttr joint2.scaleX $Adistance;
1st line retrieves properly the selected attributes and storages it to a float
.
2nd line set your attribute with the retrieved value.
Note:
Hope this will help.