Use the LayerStateManager to Manage Layer Settings
 
 
 

The LayerStateManager object is similar to the AutoCAD Utility object in that it provides a set of functions for manipulating data. These functions are methods for working with saved layer settings. Use the following LayerStateManager methods to work with saved layer settings:

Delete

Deletes a saved layer setting.

Export

Exports the specified saved layer setting to a file.

Import

Imports a saved layer setting from the specified file.

Rename

Renames a saved layer setting.

Restore

Restores the specified layer setting in the current drawing.

Save

Saves the specified layer states and properties.

SetDataBase

Associates an AutoCAD database with the LayerStateManager.

To access the LayerStateManager object, use the GetInterfaceObject method.

Dim oLSM As AcadLayerStateManager
Set oLSM = ThisDrawing.Application. _
   GetInterfaceObject("AutoCAD.AcadLayerStateManager.17")

After you retrieve the LayerStateManager object, you must associate a database with it before you can access the object's methods. Use the SetDatabase method to associate a database with the LayerStateManager.

oLSM.SetDatabase ThisDrawing.Database