Hi,
Is is possible to get the block handle from an attribute reference? I get the attribute reference from a previously stored attribute collection. I did try attref.BlockId.Handle.Value.ToString(), but it gives a different value, not the block's id.
Thanks
Try OwnerId instead of BlockId. Sorry, no time to try it myself.
Answer posted for same question at theSwamp without code example
attref.BlockId.Handle will give you the Handle for the Space it is inserted in.
So Model Space's handle if inserted in Model Space.
If you are wanting to get the BlockTableRecord(Block or Block Definition) Handle for the BlockReference that contains the AttributeReference in it's AttributeCollection Property then
You should be able to get the BlockReference from the AttributeReference.OwnerId property then
use the BlockReference.BlockTableRecord to get the Block and get its Handle.