AddBlock() problems

I’m trying to update a block via python. When I run the test code below, the block only updates as long as none of the newobj are blocks. I want to nest the selected blocks into the updated block, but it fails. There is not error or warning or anything. The block just doesn’t update.

import rhinoscriptsyntax as rs

block = rs.GetObject("Block", 4096)
blockname = rs.BlockInstanceName(block)

newobj = rs.GetObjects("New Objects")


Hi @kyle_faulkner,

In this case, it may be easier to just script the _-Block command.

– Dale

Thanks Dale.

I replaced



rs.Command('-Block 0,0,0 "{}" Yes _Enter _Enter _Enter'.format(blockname))

and that seemed to work.

Is this a bug that’s causing the AddBlock() method to fail?

No, just a limitation with Rhino.AddBlock. Creating nested blocks take a bit more work than this simple function can handle.

Here is a sample of creating a nested block in C#. You can adapt this to Python if you want.

– Dale