Layers 属性 (ActiveX) 
获取文档的 Layers 集合。 支持的平台:仅限 Windows 言论没有其他评论。 例子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
可视化 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-11-4 07:57
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.