This project has moved. For the latest updates, please go here.

removing every entity on a given layer?

Feb 6, 2013 at 3:45 AM
I'd like to read a dxf, remove every entity on a specified layer and then write the dxf. I'm reading the files and can determine some entity properties when I specify the entity type (lwpolyine, etc) but want a generic solution. (I'm using C#)
Any suggestions on how to accomplish this would be appreciated.
Feb 6, 2013 at 5:38 PM
At the moment the only way to remove the entities on a specified layer is run through the entities list and find the ones that have a reference to the specified layer. Keep in mind that this process will not remove entities that are part of a block.

Related to this matter is that now you cannot delete table objects, layers, linetypes, text styles, ... even if they are empty. I will in the future, some how, keep track of the entities that have a reference to these objects, to be able to safely delete them only when their reference count drops to zero. This will allow for a better query of entities that, for example, are part of a layer. In the case of block, most probably, you will have to erase the block to get rid of their entities.

But, this is still a work in progress.