Message 1 of 3
Measure angle tool

Not applicable
10-18-2013
05:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Since there's no angle tool in Maya I've kind of built one myself using the MathNode that you can find on Autodesk Exchange.
There are two things I'd like some help with:
1. How do I make the distance arrows point directly at the locators?
2. How do I add a degree symbol (°) after the values in the corners of the triangle?
Here are the formulas inputted in the MathNodes if you want to build the tool yourself.
calcA: acos(((c*c)+(a*a)-(b*b))/(2*c*a))*(180/pi)
calcB: acos(((a*a)+(b*b)-(c*c))/(2*a*b))*(180/pi)
calcC: acos(((b*b)+(c*c)-(a*a))/(2*b*c))*(180/pi)
Since I know nothing about scripting and expressions I've made all this using nodes, so I'd like the answers to node based.
I've used this script for creating the annotations:
// campbell strong 5/05/03 // allows numeric display of attributes via numeric display on a single particle obj // select attribute in outliner, call script. global proc CSannoPart () { $object = `ls -ap -sl`; if (`size($object)`){ string $obj; for ($obj in $object){ if (`gmatch $obj "*.*" `){ // and a test whether that attrib is numeric? $part = `particle -p 0 0 0`; addAttr -ln annoNumber -at double $part[1] ; setAttr ($part[1]+".particleRenderType") 2; addAttr -is true -dt "string" -ln "attributeName" $part[1]; if (catch (`connectAttr $obj ($part[1]+".annoNumber")`)){ print "you have a non-numeric, or a compound attribute selected for annotation (thus the clash error above) - they will be skipped with no ill effect."; print "n"; delete $part; continue; } setAttr -type "string" ($part[1]+".attributeName") "annoNumber"; $owner = `listHistory $obj`; $trans = `listRelatives -f -p $owner[0]`; if (`nodeType $owner[0]` == "transform"){ $trans[0] = $owner[0]; } if (size($trans[0])){ if (`confirmDialog -title "annotatn arrow?" -message ("use an annotation arrow on ntransform closest to: n"+$obj+"?") -button "Yes" -button "No" -defaultButton "Yes" -cancelButton "No" -dismissString "No"` == "Yes") { // annotateNode.mel: $pos = `xform -q -ws -t $trans[0]`; $locator = `spaceLocator -n "annotationLocator#" `; xform -ws -t $pos[0] $pos[1] $pos[2]; parent $locator $trans[0]; select -r $locator; $annotationNode = `annotate -tx "" -p ($pos[0]+3) ($pos[1]+1) $pos[2]`; string $transform[] = `listRelatives -parent $annotationNode`; parent $transform[0] $locator; parent $part[0] $transform[0]; setAttr ($part[0]+".t") 0 0 0; setAttr ($part[0]+".overrideEnabled") 1; setAttr ($part[0]+".overrideDisplayType") 2; select -r $annotationNode; } } rename $part[0] annoPart; } else { print "need to select attributes in the outLiner for 'annotation display'."; print "n"; } } } else { print "need to select attributes in the outLiner for 'annotation display'."; print "n"; } }