Checking Selection Set Contents

Checking Selection Set Contents

Anonymous
Not applicable
428 Views
3 Replies
Message 1 of 4

Checking Selection Set Contents

Anonymous
Not applicable
This is an extremely simple question but I'm working on making some scripts I've written more robust. What is an efficient way to determine if a set of objects selected via code is empty or not. I'm sort of assuming it's some variation on checking whether or not the selection set is null?

Many thanks in advance.
0 Likes
429 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
This is an extremely simple question but I'm working on making some scripts if written more robust. What is an efficient way to determine if a set of objects selected via code is empty or not. I'm sort of assuming it's some variation on checking whether or not the selection set is null?

Many thanks in advance.


if selection.count == 0 do ...
0 Likes
Message 3 of 4

Anonymous
Not applicable
Thanks so much Borislav. Much appreciated.
0 Likes
Message 4 of 4

Anonymous
Not applicable
Do you mean checking if named selection sets are empty? You can do it like this:

if selectionsets == undefined or selectionsets.count == 0 then
print "empty or non-existent."


If you're using a numeric index into the selection sets, you can check it versus selectionsets.count instead of checking if selectionsets is undefined.
0 Likes