Hi, again, I'll try.
Always try it first in the UI, if it's possible there then there might be a chance it's also possible in the API.
If it's not possible in the UI, then it's also not possilbe (or at least not supported/advised) in the API.
DWG link or import:
A. we can delete a layer by selecting import > Query command > pick dwg element > delete.
trouble here is that if the link is reloaded the delete elements are back!
Not sure if it's possible in API, can't see a method for it (GeometryElement is a displayed result of the original so no use for deleting elements)
B. Delete the subcategory of the DWG? > results in the element(s) no longer having a "layer" so doesn't work in UI.
Can't you turn visibility off for the layer or edit the DWG itself, or better split in 2 dwg the one to keep and the to use for the addin, and unload/detach when ready?
- Michel