View Full Version : Edge selections return false results in size($edge) command.

09 September 2010, 09:39 PM
I'm trying to count the # of edges selected and Maya is giving me some funny results. It seems to group some edges as into one, causing the size($edge) to give false results.

(To reproduce, try it on a cube, select 8 of the 12 edges and it returns a result of 4.)

string $edge[] = `ls -sl`;
print $edge;
print (size($edge));

Anyone know a way around this?


09 September 2010, 12:08 AM
this is the expected (and, in terms of efficiency, desired behaviour!). If you want the components separated for looping over individually, add the -flatten (-fl) flag to ls.

However, if you just want to list specific component types I would use filterExpand rather than ls.... with ls, you may get back other selected items along with your desired components..


09 September 2010, 12:40 AM
Thanks again Nathan.

I have a filterExpand script that I reference first and only if the selection there is edges, this script is called.

09 September 2010, 12:29 PM
There is also the mighty polyListComponentConversion ( that I always recommend :] $edges[] = ls("-fl", `polyListComponentConversion -toEdge`);for example returns all edges no matter how you selected it.

(however.. all commands that return components should have a built in option to expand the list like filterExpand ( does)

CGTalk Moderation
09 September 2010, 12:29 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.