Notifications
Clear all

[Closed] How to count the number of Groups in selection

Hi all,

I have a script as below, but I don’t know that how can I count the number of Groups.
Actually, I want to count the Groups and make the length of the Keyframe.

My code :

– Set length of the Keyframe by Counting of Groups

(
head_group = #()
for grp in (selection as array) where (isgrouphead grp) and not (isGroupMember grp) do (print (append head_group grp).count)

)

grpcount = ???
framelength = 2*grpcount

animationRange = interval 0 framelength
sliderTime = 0f
)

2 Replies

I’m not sure I understood you correctly, but are you looking for something like this?

groupHeads = (for obj in Helpers where (isGroupHead obj == true) collect obj)
animationRange = interval 0 groupHeads.count

Prefect,
Thank you so much for your help