What are all the block table records?
I've got Model Space & Paper Space(Or Layout Space) under control.
I've got two block reference instances of the same block on a drawing.
If I purge the Drawing the older duplicate block reference disappears.
7867 is the older reference that disappears when I use the purge command.
78A7 is the newer reference, I only want to see this one on my extraction of attributes.
What property of the block reference will tell me that it would be purged if I used the purge command?
As I want to detect what's the old block and which one is the current block reference.
Does that make sense what I'm asking here?
The problem is I only want to extract the attributes from the newer block reference.
The old block reference is coming up... how can I filter that out of my loop results?
I know I could just purge the drawing and my problem would be done with.
But I need to do this in a manner that only accesses the drawing from a read-only manner.
The only way your question makes any sense to me is if you are talking about a block reference that has been erased, but when you loop through the database it is still showing up in your loop.
If that sounds right to you, then you would check to make sure the IsErased property is false. (That also confuses me a bit, because I would think that trying to access the AttributeReferences of an erased block would fail)
work-around: read-only means the drawing cannot be changed and saved under its current name. therefore, can you purge the drawing, [check the block reference's .iserased property if necessary,] retrieve the attributes you're after and simply get out without persisting any changes from the purge? (sorry if this is exactly what you're trying not to do.)
Good Point Felix,
So I can purge the database on a database.purge
Any Pointers on how to use purge and get the ObjectIDCollection.
Seen any code samples for purge?
The Help Menu Says:
Anyone know what hard-referenced means?
Database.Purge Method (ObjectIdCollection) Description This function searches through the database to see if there are any hard references to objects with object ID entities in the ids array. If any such objects are found, their object ID entities are removed from the ids array. So, when this function returns, the ids array will contain only object ID entities of objects that are not currently hard-referenced and thus can safely be erased. If the database is in a partially opened state, object ID entities of objects that were not created in the current editing session are also removed from the ids array. Note This function does not modify the database in any way. To duplicate the AutoCAD purge mechanism functionality, use this function to determine what database objects (of the type desired) can be purged or erased, and then open each such object, call its erase() method to erase it, and close it. For example, to purge all unreferenced layers, call the purge method, passing in an array containing the object ID entities of all the LayerTableRecords in the LayerTable, then erase all the objects whose object ID entities are still in the array after the purge function has returned.
It's like the block doesn't show up.
I did find one thing that is different between the two blocks:
What's that mean? "SFR_ISO_BDR" is the name of one of our Standard Drawing Template files.
Hmmm.... I wonder if somehow it's stuck in the memory.
I'll try the purge thing and see If I have any luck.
judging by the context, 'hard-referenced' simply means that there is a reference to a block still in the database which hasn't a graphical representation in the database anymore.
the example in the note puts it quite beautifully -"i couldn't have put it better myself"- so you're on the right track: collect all block ids, purge the database with the id collection as parameter, and it remains an id collection with only those ids that can be erased, i.e. the 'hard-referenced' ones, in your case the block you say disappears. going back to your initial statement, you then have to extract data from those bock references that are not in the post-purge id collection, i.e. the pre-purge ids which do not survive the purge.