Distancedimension With Mel

Hi,

When I create a distance dimension node along with its locators I am left with, depending on the order of creation, either an extra locator that I didn’t create and have to delete or one of my created locators plugged in to both the worldspace start and end points.

Can someone suggest a better approach to scripting the  distance dimension nodes?

Btw, the manual tells very little about the distance  nodes.

CODE
   distanceDimension -sp 0 0 0 -ep 0 0 0;
   spaceLocator -n 01_l_legLen01_loc;
   spaceLocator -n 01_l_legLen02_loc;
   rename |distanceDimension1 “01_l_legIk01_dist”;
   pointConstraint -n 01_l_legLen01_pCon 01_l_leg01_ik 01_l_legLen01_loc;
   pointConstraint -n 01_l_legLen02_pCon 01_l_leg04_ik 01_l_legLen02_loc;
   connectAttr -f 01_l_legLen01_locShape.worldPosition[0] 01_l_legIk01_distShape.startPoint;
   connectAttr -f 01_l_legLen02_locShape.worldPosition[0] 01_l_legIk01_distShape.endPoint;
   select -r locator3; delete;

Thanks,
Ron

Do you want to actually use the nodes or do you just want the distance between to points?

If it’s the latter, you can use a distance formula to calculate the distance.