05/22/2012

Generate Layer usage data before purge/delete

It can sometimes happen that a layer does not get purged and the "IsUsed" property of this layer table record returns true even though the layer is not being used. The reason for this is that, AutoCAD maintains a usage data for all the layer table records which is only refreshed when needed. To force an update of the usage data, the "GenerateUsageData" method of the LayerTable is to be used.

Here is a sample code to try and delete layer table records after the call to "GenerateUsageData".

Comments

It can sometimes happen that a layer does not get purged and the "IsUsed" property of this layer table record returns true even though the layer is not being used. The reason for this is that, AutoCAD maintains a usage data for all the layer table records which is only refreshed when needed. To force an update of the usage data, the "GenerateUsageData" method of the LayerTable is to be used.

Here is a sample code to try and delete layer table records after the call to "GenerateUsageData".