XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

View Full Version : selecting shape nodes

03-10-2009, 08:25 PM
How can I select the shape nodes from the list of selected objects? The selected objects are curves.

I am getting the transform nodes by:

string $selected[]=`ls -sl`;

I have my script working by using the pickWalk down but is there a way to read the shape nodes of the selected curves into an array?


Edit: Never mind, figured it out.

string $selected[]=`ls -dag -g -sl`;

03-10-2009, 10:38 PM
I`m also doing it with :

string $shape = `pickwalk -d down`;

03-11-2009, 12:21 AM
That seems to work just as well. Thanks.

03-11-2009, 02:45 PM
listRelatives -s will get you there too.


03-11-2009, 02:49 PM
pickwalk will physically change your selection and will slow your script down. I suggest using something like this: it will give you the most control over your selections (IE: only transform objects and only transforms that have a specific shape type (meshes, nurbscurves, whatever you want)

string $list[] = `ls -long -type "transform" -sl`; //get the selected transforms.
string $sel[] = `listRelatives -typ "mesh" -f $list`; //of the transforms selected, get the shapes that are polymeshes.

you will need to change the -type flag to "nurbsCurve" and maybe add another -type flag for "nurbsSurface" if you need those too.

Also, I use the -long flag to get full paths of nodes to avoid name clashes. you may or may not need it for your purposes.

03-11-2009, 04:48 PM
Thanks thematt and DOor. I did not know about listRelatives, so that is very good to know. It is great to have this kind of flexibility from a simple user selection.

CGTalk Moderation
03-11-2009, 04:48 PM
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.