Block nesting hierarchy data


Given a Block name, how would it be possible to get the block nesting hierarchy (and quantity of each hierarchy) of each instance of a certain block in a model?

For example, if we were looking for results for: Block01

We would get a list like this:

2- BlockA:BlockB:Block01 => Block01 is nested this exact way twice in your model
4 - BlockA:Block01 > Block01 is nested this exact way four times in your model
5 - BlockC:BlockA:Block01 > Block01 is nested this exact way five times in your model

I know there are RhinoScriptSyntax methods such as rs.BlockContainers and rs.BlockContainerCount but what I’m looking for here is a more detailed summary of nesting.

Ideally, I’d like to have a script that work in a GH Python node.



Hi Dan -

Perhaps you should post a (simplified) 3dm that illustrates what you want. The description can’t work. If “BlockA” is defined to contain both “BlockB”, and “BlockB” contains “Block01”, then, in your next line, the same “BlockA” cannot only contain “Block01”.