指定图层的状态。 支持的平台:仅窗口 属性值只读:不 类型:布尔
言论与关闭的图层关联的对象不会显示在屏幕上或打印。与属性不同,关闭的图层在再生期间生成,但不显示。Freeze 关闭或冻结的图层上的 AutoCAD 曲面和圆是不可见的,但在使用“隐藏”、“着色模式”或“渲染”命令时,它们仍会隐藏对象。 例子工 务 局: Sub Example_LayerOn()
' This example creates a new layer called "LayerOn".
' It then displays the status of the LayerOn property
' for the new layer, toggles the status of the
' LayerOn property, and again displays its status.
' After running this example, you can check the layer
' control on the Object Properties tool bar. It will
' show the new layer and the latest LayerOn status.
Dim layerObj As AcadLayer
' Create the new layer
Set layerObj = ThisDrawing.Layers.Add("LayerOn")
' Display the LayerOn status of the new layer
GoSub DISPLAYSTATUS
' Toggle the status of the LayerOn property for the layer
layerObj.LayerOn = Not (layerObj.LayerOn)
' Display the LayerOn status of the new layer
GoSub DISPLAYSTATUS
Exit Sub
DISPLAYSTATUS:
If layerObj.LayerOn Then
MsgBox "Layer " & layerObj.name & " is turned on.", , "LayerOn Example"
Else
MsgBox "Layer " & layerObj.name & " is turned off.", , "LayerOn Example"
End If
Return
End Sub
Visual LISP: (vl-load-com)
(defun c:Example_LayerOn()
;; This example creates a new layer called "LayerOn".
;; It then displays the status of the LayerOn property
;; for the new layer, toggles the status of the
;; LayerOn property, and again displays its status.
;; After running this example, you can check the layer
;; control on the Object Properties tool bar. It will
;; show the new layer and the latest LayerOn status.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Create the new layer
(setq layerObj (vla-Add (vla-get-Layers doc) "LayerOn"))
;; Display the LayerOn status of the new layer
(if (= (vla-get-LayerOn layerObj) :vlax-true)
(alert (strcat "Layer " (vla-get-Name layerObj) " is turned on."))
(alert (strcat "Layer " (vla-get-Name layerObj) " is turned off."))
)
;; Toggle the status of the LayerOn property for the layer
(vla-put-LayerOn layerObj (if (= (vla-get-LayerOn layerObj) :vlax-true) :vlax-false :vlax-true))
;; Display the LayerOn status of the new layer
(if (= (vla-get-LayerOn layerObj) :vlax-true)
(alert (strcat "Layer " (vla-get-Name layerObj) " is turned on."))
(alert (strcat "Layer " (vla-get-Name layerObj) " is turned off."))
)
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 09:03
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.