- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all!
I need help (in more ways than one my wife would say).
I am trying to get an existing block reference in my current document without a selection set and without inserting the block. So in other words, the block in question has previously been inserted into the drawing. I have found numerous examples on the forums, but all deal with either first inserting the block or using a selection set to get at it.
Everything works great until I try to declare myBlkRef. Everytime I run the code, I get an "InvalidCastException" error on the second line of code shown below. If I run the same code when using a selection set to select the block the code works fine.
I have no problem getting the blocktable, blocktablerecord or objectid of the block in question, but I cannot figure out how to cast it as a blockreference.
So, my basic question is, how do I get a blockreference that has already been inserted into a drawing without using a selection set??? My ultimate goal is to change it's attribute values.
Please forgive my ignorance... I am still trying to learn all of this blocktable, blocktablerecord, blockreference, objectid, etc... business.
Dim blkRefID As ObjectId
Dim myBlkRef As BlockReference = blkRefID.GetObject(OpenMode.ForRead)
TIA!
Solved! Go to Solution.