'第四节
Sub CreateLayer() '创建图层
Dim objlyr As AcadLayer
Set objlyr = ThisDrawing.Application.ActiveDocument.Layers.Add("hello")
objlyr.color = acRed
objlyr.LayerOn = True
objlyr.Freeze = False
objlyr.Lock = False
ThisDrawing.Application.ActiveDocument.ActiveLayer = objlyr
End Sub
Sub SearchLayer() '查找图层
Dim objlyr As AcadLayer
Dim blnExist As Boolean
For Each objlyr In ThisDrawing.Application.ActiveDocument.Layers
If objlyr.Name = "hello" Then
MsgBox "图层已找到!"
blnExist = True
Exit For
End If
Next
If blnExist = False Then MsgBox "图层未找到!"
End Sub
全部评论