- ;[冻结块内图层]-nentsel方式
- (defun C:LFSB ( / acaddocument acadobject actlay en ent lay layersobj TorN vlay)
- (setq AcadObject (vlax-get-acad-object)
- AcadDocument (vla-get-ActiveDocument AcadObject)
- LayersObj (vla-get-layers AcadDocument)
- Actlay (vla-get-name (vla-get-activeLayer AcadDocument)) ;取得激活的图层
- )
- (setvar "ErrNo" 0)
- (princ "\n请选择需要冻结的图层")
- (while (/= (getvar "ErrNo") 52)
- (if (setq en (nentsel "\n请选择需要冻结的图层:"))
- (progn
- (setq ent (car en)
- lay (cdr (assoc 8 (entget ent)))
- vlay (vla-item LayersObj lay)
- )
- (if (/= lay Actlay)
- (vla-put-freeze vlay :vlax-true) ;设定图层的冻结状态
- (setq TorN T)
- )
- (if TorN
- (princ "\n除当前层无法冻结外!已冻结其余选择图层")
- (princ "\n已冻结选择图层")
- )
- )
- )
- )
- (princ)
- )
|