- [code=lisp];图层锁定解锁 by:孤帆
- (defun c:layerlock( / layer layername layernames layers obj sset);<图层锁定解锁>
- (setq Layers(vla-get-Layers AcadDocument))
- (if (and (ssget)
- (setq sset (vla-get-ActiveSelectionSet AcadDocument))
- )
- (progn
- (setq layernames '())
- (vlax-for obj sset
- (if (not (member (setq layername (vla-get-layer obj)) layernames))
- (setq layernames (cons layername layernames))))
- (vlax-for layer Layers
- (if (member (vla-get-name layer)layernames)
- (vla-put-Lock layer :vlax-true)
- ;(vla-put-Lock layer :vlax-false)
- )
- )
- )
- (vlax-for layer Layers
- (vla-put-Lock layer :vlax-false))
- )
- (princ)
- )
[/code]
|