View Full Version : Object Count
theGent 10-15-2007, 06:15 PM Anyone know an easy way to count the number of currently selected object using COFFEE?
|
|
JamesMK
10-15-2007, 08:19 PM
Something like this should do the trick:
countSelected(doc)
{
var count = 0;
var root = doc->GetFirstObject();
var found;
if(root)
{
if(root->GetBit(BIT_AOBJ)) count++;
found = root->SearchNext(BIT_AOBJ);
}
do
{
if(found)
{
root = found;
found = root->SearchNext(BIT_AOBJ);
count++;
}
}
while(found);
return count;
}
main(doc, op)
{
var c = countSelected(doc);
println("Found selected: ",c);
}
CGTalk Moderation
10-15-2007, 08:19 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.