You could also just create a curve based on the joints (each CV matching 
position with each joint's world position using a decomposeMatrix) and then 
do an arclen of that curve.

On Monday, May 26, 2014 11:09:03 PM UTC-4, Eduardo Grana wrote:
>
> Hello People,
>
> If you want to get the distance in world space,
> you may have to query he world position of the joints,
> instead of taking the translate values, since there may
> be scales in the hierarchy that will distort the result.
> You can use the joint command on query mode with the -p flag,
> to get world position.
> If you want to use the api to do the math, you can use MPoint's
>  distanceTo method
>
> import maya.OpenMaya as om
>
>
> def distance (scrVec, targetVec):
> '''
> get the distance of two vectors
>  scrVec -> is a vector
> targetVec -> is a vector
> '''
>  scr = om.MPoint(scrVec[0], scrVec[1], scrVec[2],1.0)
> tgt = om.MPoint(targetVec[0], targetVec[1], targetVec[2], 1.0)
>  return scr.distanceTo(tgt)
>
> Other thing you can do, is draw a degree 1 curve through the joints,
> and use the curve nfo node to get the lenght.
>
> Hope this is usefull!
> Cheers,
> Eduardo
>
>
> On Mon, May 26, 2014 at 7:49 PM, Todd Widup <[email protected]<javascript:>
> > wrote:
>
>> its not a valued that is stored anyplace.  the common practice is to 
>> check the position of the children.  this will help to determine what it is 
>> as most should be offset on only 1 axis
>>  
>>
>> On Mon, May 26, 2014 at 12:25 PM, flaye <[email protected] 
>> <javascript:>>wrote:
>>
>>>
>>>
>>> The reason I want to do this is to be able to measure the overall length 
>>> of a joint chain. As far as I can tell, if the absolute values of the 
>>> primary axis are all added up in a joint chain, regardless of how bent it 
>>> is, you'll get the full chain length. I'm trying to automatically figure 
>>> that out, rather than have the user enter the primary axis manually through 
>>> a GUI or command.
>>>
>>> If there's a better way to do so, maybe even through some API nodes, 
>>> I'll be happy to hear about it. 
>>>
>>> Thanks.
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Python Programming for Autodesk Maya" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected]<javascript:>
>>> .
>>>  To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/python_inside_maya/7834a76c-3cda-4aad-a394-15a729daed3d%40googlegroups.com<https://groups.google.com/d/msgid/python_inside_maya/7834a76c-3cda-4aad-a394-15a729daed3d%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Todd Widup
>> Creature TD / Technical Artist
>> [email protected] <javascript:>
>> [email protected] <javascript:>
>> www.toddwidup.com 
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>>  To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/CABBPk37HiCpsvzgCi8QDFnRn-Pgyg%3Dpupj%2BxC6X7cW5G54Lbiw%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CABBPk37HiCpsvzgCi8QDFnRn-Pgyg%3Dpupj%2BxC6X7cW5G54Lbiw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Eduardo GraƱa
> www.eduardograna.com.ar 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/4df5702a-0697-403f-9ea2-76e6fffd4316%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to