
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
We have some code that takes a block table record ID, iterates the entities, and for each one opens, erases and closes it. Thanks to a code profiler we can see that the AcDbObject::close() is *hugely* expensive in such a case (probably due to the clean-up required after erasing an object).
If we instead take the block table record ID, find any AcDbBlockReference objects that refer to that record, and erase *those* instead of iterating and erasing the individual entities, it cuts out 99% of that time delay. It's also a tiny bit neater in the code and easier to understand.
My question is, is this tactic valid? Will it correctly dump (erase) all the nested entities in the block exactly as if I had manually erased them? I can't see why it wouldn't since as far as I know that's the whole point of the AcDbBlockReference object, to manage the entities behind the scenes - but I wanted to check before I made the change permanently.
Thanks in advance.
Solved! Go to Solution.