View Full Version : getting the locatornames from the distanceDimension tool?
Leffler 01-17-2009, 05:03 PM Hi there! I have another problem where I need to pick up the names with MEL
I want to get the names of the locators created by the command "distanceDimension" like this ...
distanceDimension -sp -1.0 4.0 1.0 -ep -1.0 -0.0 1.0
But if I look in the MEL commands help for distancedimension it only has 2 flags, startpoint and endpoint.
I also did an "echo all commands" but I canīt see that it handles the locators anywhere there. It doesnt even select the locators anywhere it seems .....
Any ideas? Thanks!
// Otto
|
|
greatPumpkin
01-17-2009, 06:08 PM
You can capture the output with a bit of mel:
string $myDistanceDim[] = `distanceDimension -sp -1.0 4.0 1.0 -ep -1.0 -0.0 1.0`;
I can't remember the output exactly, but you should get the distance dimension node, and two locators as a result of this command, so... lets say you wanted to select the two locators after running the above:
select -r $myDistanceDim[1];
select -r $myDistanceDim[2];
if that doesn't work lemme know, if it doesn't return the locators you can also find them using the distance dimension node itself-
Leffler
01-17-2009, 07:59 PM
You can capture the output with a bit of mel:
string $myDistanceDim[] = `distanceDimension -sp -1.0 4.0 1.0 -ep -1.0 -0.0 1.0`;
I can't remember the output exactly, but you should get the distance dimension node, and two locators as a result of this command, so... lets say you wanted to select the two locators after running the above:
select -r $myDistanceDim[1];
select -r $myDistanceDim[2];
if that doesn't work lemme know, if it doesn't return the locators you can also find them using the distance dimension node itself-
No it doesnīt work, the output from the distDim is not an array
Return value:
string- the shape name of the DAG node created.
YourDaftPunk
01-18-2009, 07:11 AM
If you graph the connections to the distanceShape node that is created by the distanceDimension command, you'll see that it has two incoming connections from the locators. These connections feed the distance node worldPosition for the distance calc.
In code, the way to see a node's connections is the listConnections command. So, the solution:
string $distanceShape = `distanceDimension -sp -1.0 4.0 1.0 -ep -1.0 -0.0 1.0`;
string $locators[] = `listConnections $distanceShape`;
print("Start Locator: " + $locators[0] + "\n");
print("End Locator: " + $locators[1] + "\n");
Another incredibly useful mel command is listRelatives; say you're trying to find a shape node and you only know the transform (pSphere1 to pSphereShape1).
Leffler
01-18-2009, 09:11 AM
Thanks Shawn, I wasnīt familiar with these commands at all. Great stuff.
CGTalk Moderation
01-18-2009, 09:11 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.