Gets the Layers collection for the document.
Supported platforms: Windows only
No additional remarks.
VBA:
Sub Example_Layers()
' This example finds the current Layers collection and
' adds a new layer to that collection.
Dim layerColl As AcadLayers
Set layerColl = ThisDrawing.Layers
' Create a dimension style named "TEST" in current drawing
Dim testlayer As AcadLayer
Set testlayer = layerColl.Add("TEST")
MsgBox "A new layer called " & testlayer.name & " has been added to the Layers collection.", vbInformation, "Layers Example"
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_Layers()
;; This example finds the current Layers collection and
;; adds a new layer to that collection.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq layerColl (vla-get-Layers doc))
;; Create a dimension style named "TEST" in current drawing
(setq testlayer (vla-Add layerColl "TEST"))
(alert (strcat "A new layer called " (vla-get-Name testlayer) " has been added to the Layers collection."))
)