PDA

View Full Version : Query Number of objects in Selection....


mecha
01-03-2008, 07:39 PM
Hey All,

I want to create a "for" loop which will do its thing, no problem....

for ($i=1; $i<=10 ; $i++){
blah, blah, blah;
}

...but, how would I replace the number 10 with the number of objects I have selected?

Basically, I want to know how to return a integer representing the number of selected objects. Any ideas? The closest I got was using stringArrayCount, but its not what I need.

Any help would be greatly appreciated, im sure this is an easy one - im learning MEL.

mecha

scottiedoo
01-03-2008, 07:47 PM
very simple:

int $numObjs = size(`ls -sl`)

then just use the variable $numObjs in your loop instead of "10"

for ($i=1; $i<=$numObjs ; $i++){
blah, blah, blah;
}

mecha
01-03-2008, 08:56 PM
Thankyou so much....perfect!!

CGTalk Moderation
01-03-2008, 08:56 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.