If rs.ObjectType ==4096 #error Object does not exist in Object Table

Hello everyone,

I have a problem with a Rhino Python script which should explode all blocks and delete the blocks.
In Rhino 7 this script part worked very reliably.

    all_objects = rs.AllObjects()
    for obj_id in all_objects:
        if rs.ObjectType(obj_id) == 4096:  #this line throws the error
            rs.Command('_-ExplodeBlock "{}" _Delete'.format(obj_id))

In Rhino 8 there is always an error “Object does not exist in Object Table”, for details see attached picture.

Many thanks to all of you!

best regards max

Hi @Maximilian_Schorer I could not repeat that behavior here. Can you send a sample file that shows this behavior?

also, pls run _SystemInfo in Rhino 8 and post back the results.

Does that really work in Rhino7?

The ID you’re trying to delete doesn’t exist anymore because the the ID of the geometry added by the ExplodeBlock is different that he ID of block instance that was there.

Maybe this works for you?

rs.Command("_-ExplodeBlock _AllBlocks")
for bn in rs.BlockNames():
    rs.DeleteBlock(bn)

Hi Alain,

you’re right i think my old code never worked under rhino 7 i just never actually had blocks in the models i had processed…

Thank you for the code snippet to find and explode all blocks this works very well!