"TypeError" When Trying to Get Block Table Record of Model Space

Okay. I see that

bt.get_Item(BlockTableRecord.ModelSpace)

or

bt.get_Item("*Model_Space")

returns an object ID, not the block table reference its self, so I have to pass that into:

t.GetObject()

This works:

with adoc.LockDocument():
    with adoc.Database as db:
        with db.TransactionManager.StartTransaction() as t:
            bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite)
            btrID = bt.get_Item("*Model_Space")
            btr = t.GetObject(btrID, OpenMode.ForWrite)
            
            objectIDs = []
            for oid in btr:
                objectIDs.append(oid)

            t.Commit()
            pass

Thanks Zachri.

1 Like