Lock 属性 (ActiveX)
锁定或解锁图层。 支持的平台:仅限 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 可视化 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.")) ) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2024-12-15 11:26
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.