Lock and Unlock Layers
 
 
 

You cannot edit the objects on a locked layer; however, they are still visible if the layer is on and thawed. You can make a locked layer current and you can add objects to it. You can freeze and turn off locked layers and change their associated colors and linetypes.

To lock or unlock a layer, use the Lock property. If you input a value of TRUE to this property, the layer is locked. If you input a value of FALSE, the layer is unlocked.

Lock a layer

This example creates a new layer called “ABC” and then locks the layer.

Sub Ch4_LayerLock()
	' Create a new layer called "ABC"
	Dim layerObj As AcadLayer
	Set layerObj = ThisDrawing.Layers.Add("ABC")


	' Lock layer "ABC"
	layerObj.Lock = True
End Sub