PDA

View Full Version : Query a measurement?


PozestStar
11-08-2011, 10:50 PM
Is this possible?

I know with the Distance tool or distanceDimension command you can see the distance between two points, but I don't know if you can capture that result in anyway. If you can, how do you do it? If you can't, is there a way to do so?

Thanks.

NaughtyNathan
11-08-2011, 11:23 PM
just select a distanceDimension node and open the Attribute Editor..? You'll see the distance attribute of the distanceDimension node holds the distance.
float $dist = `getAttr distanceDimension1.distance`;
even without access to this node, to calculate distance you simply subtract one coordinate from another to get a vector. You then get the magnitude of this vector and you have your distance.
vector $P1 = `pointPosition -w locator1`;
vector $P2 = `pointPosition -w locator2`;
float $dist = `mag ($P2-$P1)`;
is this what you're after?
:nathaN

PozestStar
11-09-2011, 12:35 AM
Yep, that's it. I didn't even see the Distance attribute in the attribute editor, I feel silly but oh well. At least now I know! And thanks so much for telling me how to calculate the distance. I didn't know about the mag command. That's REALLY going to come in handy!

Thanks again!

CGTalk Moderation
11-09-2011, 12:35 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.