PDA

View Full Version : Get the distance-attribute with MEL?


Leffler
08-07-2008, 03:46 PM
Hello,

I´m trying to get a hold of the number generated by the DistanceDimension tool. I´m doing a stretchy leg.

The distance should be like this to access:
L_stretchyLeg_distance.distance

And, I can get it in an expression that looks like this:
if(R_stretchyLeg_distanceShape.distance >=5)
but now I want to store it in an variable to put the value of that variable into the input1X of a Multiply/divide node

So I was thinking something like this should do it:
$getDistance = L_stretchyLeg_distance.Distance;
divNode..input1X = $getDistance;

but it doesn´t work. Maya tells me "// Error: Line 1.50: Invalid use of Maya object "L_stretchyLeg_distance.Distance". // "

Any ideas?

// Otto

NaughtyNathan
08-07-2008, 04:09 PM
you want to get the attribute value.. so you have to use the getAttr command:

$getDistance = `getAttr L_stretchyLeg_distance.Distance`;

b.t.w. the attribute name "Distance" is probably lowercase D (.distance)

:nathaN

Leffler
08-08-2008, 07:51 AM
Oh...hehe, bad mistake by me I must have been tired :) Thanks for the help!

CGTalk Moderation
08-08-2008, 07:51 AM
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.