PDA

View Full Version : Getting Shape Nodes


ajk48n
10-17-2003, 07:51 PM
I'm trying to create an array of shape nodes from selected objects.

This is what I have so far:

string $curves[] = `ls -sl`;
//string curvesShapes[];
int $i;

for ($i = 0; $i<size($curves); $i++) {

//PROBLEM:$curveShapes[$i] = `pickWalk -d down $curves[$i]`;
$curveShapes = `pickWalk -d down $curves[$i]`;

print $curveShapes;

}


The problem comes when doing the pickWalk. I want curvesShapes to be an array, however when I declare it to be one originally, and run the PROBLEM line, it says that I can't convert a string[] to string.

However, if I let it automatically assign, as in the next line, things seem to work fine. When I type:

print $curveShapes

it gives me a list like I expect. However, all shape nodes that have been inserted into the array are put into $curveShapes[0].

Does anyone know how I can get the pickWalk command to put the objects in separate elements of an array?

GDC
10-17-2003, 08:12 PM
I would blow off the pickWalk command. To me it's one of those commands that works great as a hotKey, but not so good in a script. Here's what I would do:

string $curves[]=`ls -sl`;
string $curveShapes[];
for($i=0;$i<size($curves);$i++)
{
string $shape[]=`listRelatives -s -ni $curves[$i]`;
$cuveShapes[size($curveShapes)]=$shape[0];
}

--g

ajk48n
10-17-2003, 09:06 PM
Ahh, beautiful, thanks. I forgot about listRelatives.

CGTalk Moderation
01-16-2006, 09:00 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.