获取文档的图层集合。 支持的平台:仅窗口 言论没有额外的评论。 例子工 务 局: 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."))
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 08:46
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.