[Python] getting the name of sub-blocks

this doesn’t work. I get just the name of the master-block

import rhinoscriptsyntax as rs

block_uuid = rs.GetObjects("Select Block(s): ",rs.filter.instance)

for block_id in block_uuid:
    block_name = rs.ObjectName(block_id)
    sub_blocks_ids = rs.BlockObjects(block_name)
    #print sub_blocks_ids
    for sub_block_id in sub_blocks_ids:
        sub_block_name = rs.ObjectName(sub_block_id)
        print sub_block_name
        if sub_block_name is None:

this gives the correct result:
sub_block_name = rs.BlockInstanceName(sub_block_id)

1 Like