[python] getting block's parent block


(IVELIN PEYCHEV) #1

Is there a way to find the parent block of a nested block, programatically?


#2

rs.BlockContainers(block_name)

https://developer.rhino3d.com/api/RhinoScriptSyntax/#block-BlockContainers

If it returns None, the block is at top-level (no parent).


(IVELIN PEYCHEV) #3

Yeah, I just made a few tests with all the block methods in rhinoscriptsyntax :smiley:

it gets a list of all the parents of that particular block. If it is nested multiple times list[-1] gives the greatest grandparent.

I need to figure out if working inside the block is powerful enough or I should consider exploding instead.