.NET

Reply
Distinguished Contributor
VB_Autocad_guy
Posts: 136
Registered: ‎07-24-2009
Message 1 of 8 (367 Views)

Block Table Records & Invisible Block

367 Views, 7 Replies
01-18-2012 01:51 PM

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. 

 

Details

*Expert Elite*
chiefbraincloud
Posts: 753
Registered: ‎02-13-2008
Message 2 of 8 (352 Views)

Re: Block Table Records & Invisible Block

01-18-2012 03:25 PM in reply to: VB_Autocad_guy

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)

Dave O.                                                                  Sig-Logos32.png
Valued Contributor
FFlix
Posts: 95
Registered: ‎11-15-2011
Message 3 of 8 (350 Views)

Re: Block Table Records & Invisible Block

01-18-2012 03:45 PM in reply to: VB_Autocad_guy

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.)

Distinguished Contributor
VB_Autocad_guy
Posts: 136
Registered: ‎07-24-2009
Message 4 of 8 (334 Views)

Re: Block Table Records & Invisible Block

01-19-2012 07:27 AM in reply to: FFlix

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.

 


Distinguished Contributor
VB_Autocad_guy
Posts: 136
Registered: ‎07-24-2009
Message 5 of 8 (328 Views)

Re: Block Table Records & Invisible Block

01-19-2012 08:30 AM in reply to: chiefbraincloud

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. 

 

 

 

Using: ArxDbg

~BLOCK 7867.png

 

~BLOCK 7867.png

Valued Mentor
fieldguy
Posts: 371
Registered: ‎03-31-2005
Message 6 of 8 (324 Views)

Re: Block Table Records & Invisible Block

01-19-2012 08:35 AM in reply to: VB_Autocad_guy
Distinguished Contributor
VB_Autocad_guy
Posts: 136
Registered: ‎07-24-2009
Message 7 of 8 (317 Views)

Re: Block Table Records & Invisible Block

01-19-2012 10:37 AM in reply to: fieldguy

Thanks. I'll let you know how it goes.

Valued Contributor
FFlix
Posts: 95
Registered: ‎11-15-2011
Message 8 of 8 (303 Views)

Re: Block Table Records & Invisible Block

01-19-2012 06:03 PM in reply to: VB_Autocad_guy

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.

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.