PDA

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


JohnP10
09-10-2010, 10: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?

Thanks

NaughtyNathan
09-11-2010, 01: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..

:nathaN

JohnP10
09-11-2010, 01: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.

ewerybody
09-13-2010, 01:29 PM
There is also the mighty polyListComponentConversion (http://download.autodesk.com/us/maya/2009help/Commands/polyListComponentConversion.html) 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 (http://download.autodesk.com/us/maya/2009help/Commands/filterExpand.html) does)

CGTalk Moderation
09-13-2010, 01: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.