画層の状態を指定します。
サポートされているプラットフォーム: Windows のみ
読み込み専用: いいえ
タイプ: ブール型
オフになっている画層に関連付けられたオブジェクトは、画面に表示されず、印刷もされません。Freeze プロパティとは異なり、オフになっている画層は再描画中に作図されますが、表示されません。
非表示の画層上またはフリーズされた画層上の AutoCAD サーフェスと円は非表示になりますが、それでも HIDE[隠線処理]、SHADEMODE[シェーディング モード設定]、RENDER[レンダリング]コマンドの使用時にはオブジェクトを隠します。
VBA:
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."))
)
)