How to explode nested blocks till individual block in Rhino

I want to explode nested blocks till individual blocks, So how to explode nested blocks using Rhino API.

I posted these scripts recently, see if they work for you…

RemoveSelBlockNesting.py (1.2 KB)
RemoveAllBlockNesting.py (1.1 KB)