purge a block by name

purge a block by name

Anonymous
Not applicable
473 Views
5 Replies
Message 1 of 6

purge a block by name

Anonymous
Not applicable
I thought what I wanted to do would be simple yet I haven't found a clean way to do it.
I have a drawing that contains an unreferenced block called "ELP1" All want to do is purge that block from the dwg using VBA without using .purgeall
Any suggestions?
Thanks in advance
0 Likes
474 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
If it's not used it should be as simple as :

Thisdrawing.Blocks("ELP1").Delete

HTH
0 Likes
Message 3 of 6

Anonymous
Not applicable
Brain cramp!!!!!
Thank you
0 Likes
Message 4 of 6

Anonymous
Not applicable
What if it isn't used, but the delete will not work?

I posted a question about this today. My code won't let me delete it (my code is the same as what you wrote), because it says it is referenced. But it isn't as far as I know. It is shown in the purge list, and will let me purge it, so it can't be referenced, right?

So if it isn't referenced, but says it is, then what is referenced?
0 Likes
Message 5 of 6

Anonymous
Not applicable
wrote in message news:5720910@discussion.autodesk.com...
What if it isn't used, but the delete will not work?

I posted a question about this today. My code won't let me delete it (my
code is the same as what you wrote), because it says it is referenced. But
it isn't as far as I know. It is shown in the purge list, and will let me
purge it, so it can't be referenced, right?

So if it isn't referenced, but says it is, then what is referenced?




That anomaly has plagued me for years.
I've not seen anyone else mention it or solve it.
My assumption was there was some "hidden" reference...maybe for the undo
functionality...but I don't know that is correct...
The fact is that if you close the dwg and reopen it is then "free" to
delete....
And as you say, there are *NO* references to it...yet it says there
are...liar liar

Perhaps renaming the block to something... "Block-Delete" or whatever, that
may free up at least the name, in case you're trying to replace the block
with something else...eg substituting an xref for a block???

It is a very irritating bug in acad imho

:-)
good luck
If you find a solution please post your results.
Thanks
Mark
0 Likes
Message 6 of 6

Anonymous
Not applicable
I worked around it by using Thisdrawing.Purgeall.
Because the nature of my application begins with a blank dwg and then inserts two blocks, when one block is erased Purgeall would work. Then the application simply re-adds the other block I need to the blocks collection so it can be inserted.
Works fine in this case but would require much more effort if I had to reinsert many blocks or many layers for that matter.
0 Likes