How to count outermost groups of grouped obects

Lets say I make a circle with a circle inside it and then group them into one object. I then make 10 copies of that group. Is there a way to count the groups. If you select the objects it shows the count of all the objects.

Lets take it a step further. I select 3 objects: 1 is just an object; another is a group 2 objects and the third is a group of 2 groups- is there a way to count only the outermost objects / groups i.e. 3 objects.

The problem is this: I do a lot of laser cutting and I often set panels up with lots of things but each “thing” (bear, cat, dog, star…whatever) is a grouped object. There just doesn’t seem to be an easy way to tally up the number of “things” (or groups) without having to deal with all the objects within the “things”

Hi Adrian - there isn’t a way that I know of in plain Rhino. It would be possible in a script without, and maybe with, nested grouping. Is this simple, top-level only grouping in your case?


I look at it from a data perspective. Surely Rhino must keep a database internally to know what objects form part of what group. Isn’t there a way to query the outermost set? Like finding the grandparents of groups of parents and children in a database?

Hello - the problem is grouping is not hierarchical - an object can be part of any number of groups and these can criss-cross



Ah… I see the problem. I suppose one would have to create markers and include them on purpose in each group. Then count the markers.

I posted a script in this thread today for a similar question… Main thing to note as (as Pascal also mentioned) - I do not know how the algorithm figures out which is the “top level group”, so I’m not sure it will always get it right.

Another plan of attack here would be to perhaps modify your habits or those of your users and use something like layers, which are definitely hierarchical, to “group” objects rather than groups themselves. Another possibility would be to name your objects according to their “group” and then do by-name selections.


I have a layer tree that has ofter 3 and more levels.
I am highly structured dealing with large amount of data. I have developed my own naming system where each child layer takes the prefix name from it’s parents initials, also marked with 2D, 3D etc.
These groups just help to control the content and make the design process more fluid.
You have also remember that object, copied from a group, becomes a group itself, even if it is a single instance, it doesn’t help to keep it in order.
I would love to see some more advanced group tool but I have no idea how it might look or work yet.

Yes, that’s something to watch out for. It is actually quite easy to script a tool which would remove the group from all objects that have themselves as a single-object group as a result of this procedure.

Again as groups span object layers, layer states, visibility and locked-ness, they are a very powerful tool as long as you know what you are doing with them, but they can come back to bite you if you are not careful.

I have ug as a an alias to ungroup objects and I use it a lot…

ctrl+G - group
UG - ungroup
AG - add to group
RG - remove from group
:slight_smile: I am really organised…

G for Group, GG for UnGroup…

BTW, these can go on the delayed context menu as well. (Options > Context Menu > Object menu)