画層をロックまたはロック解除します。
サポートされているプラットフォーム: Windows のみ
読み込み専用: いいえ
タイプ: ブール型
ロックされた画層のオブジェクトは編集できませんが、画層がオンになっていてフリーズが解除されていれば、表示されています。ロックされた画層をアクティブにしてオブジェクトを追加することができます。オブジェクト スナップ モードをロックされた画層のオブジェクトに適用することもできます。ロックされた画層をフリーズしてオフにし、関連付けられた色を変更することができます。
ロックは、特定の画層に関連付けられたオブジェクトを編集しながら他の画層のオブジェクトも見たいときに有効です。
VBA:
Sub Example_Lock()
' This example creates a new layer called "Lock".
' It then displays the status of the Lock property
' for the new layer, toggles the status of the
' Lock 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 Lock status.
Dim layerObj As AcadLayer
' Create the new layer
Set layerObj = ThisDrawing.Layers.Add("Lock")
' Display the Lock status of the new layer
GoSub DISPLAYSTATUS
' Toggle the status of the Lock property for the layer
layerObj.Lock = Not (layerObj.Lock)
' Display the Lock status of the new layer
GoSub DISPLAYSTATUS
Exit Sub
DISPLAYSTATUS:
If layerObj.Lock Then
MsgBox "Layer " & layerObj.Name & " is locked.", , "Lock Example"
Else
MsgBox "Layer " & layerObj.Name & " is unlocked.", , "Lock Example"
End If
Return
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_Lock()
;; This example creates a new layer called "Lock".
;; It then displays the status of the Lock property
;; for the new layer, toggles the status of the
;; Lock 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 Lock 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) "Lock"))
;; Display the Lock status of the new layer
(if (= (vla-get-Lock layerObj) :vlax-true)
(alert (strcat "Layer " (vla-get-Name layerObj) " is locked."))
(alert (strcat "Layer " (vla-get-Name layerObj) " is unlocked."))
)
;; Toggle the status of the Lock property for the layer
(vla-put-Lock layerObj (if (= (vla-get-Lock layerObj) :vlax-true) :vlax-false :vlax-true))
;; Display the Lock status of the new layer
(if (= (vla-get-Lock layerObj) :vlax-true)
(alert (strcat "Layer " (vla-get-Name layerObj) " is locked."))
(alert (strcat "Layer " (vla-get-Name layerObj) " is unlocked."))
)
)